Skip to content

Added files for Prompt template demo #1334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added AI-sample-demo/analyze-doc
Empty file.
16 changes: 16 additions & 0 deletions AI-sample-demo/connections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"managedApiConnections": {},
"serviceProviderConnections": {
"openai": {
"parameterValues": {
"openAIEndpoint": "@appsetting('openai_openAIEndpoint')",
"openAIKey": "@appsetting('openai_openAIKey')"
},
"parameterSetName": "KeyAndEndpointConnection",
"serviceProvider": {
"id": "/serviceProviders/openai"
},
"displayName": "new-sampleconnection"
}
}
}
7 changes: 7 additions & 0 deletions AI-sample-demo/host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
}
}
23 changes: 23 additions & 0 deletions AI-sample-demo/local.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_EXTENSION_VERSION": "~4",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "<your-connection-string>",
"WEBSITE_SITE_NAME": "AI-sample-demo",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"APP_KIND": "workflowApp",
"WEBSITE_AUTH_ENABLED": "False",
"WEBSITE_DEFAULT_HOSTNAME": "<your-app-name>.azurewebsites.net",
"openai_openAIKey": "152f2b7d6fb84ba7972e51ec0383c56b",
"AzureFunctionsJobHost__extensionBundle__id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"ScmType": "None",
"openai_openAIEndpoint": "https://<your-azureopenai-endpoint>.openai.azure.com/",
"WEBSITE_CONTENTSHARE": "",
"AzureWebJobsStorage": "",
"FUNCTIONS_RUNTIME_SCALE_MONITORING_ENABLED": "1",
"AzureFunctionsJobHost__extensionBundle__version": "[1.*, 2.0.0)",
"WEBSITE_SLOT_NAME": "Production",
"APPLICATIONINSIGHTS_CONNECTION_STRING": "",
"WEBSITE_NODE_DEFAULT_VERSION": "20.18.3"
}
}
97 changes: 97 additions & 0 deletions AI-sample-demo/procurement-flow/workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"documents": {
"type": "Compose",
"inputs": [
{
"id": "1",
"title": "Dell Latitude 5540 Laptop",
"content": "Intel i7, 16GB RAM, 512GB SSD, standard issue for IT new hire onboarding"
},
{
"id": "2",
"title": "Docking Station",
"content": "Dell WD19S docking stations for dual monitor setup"
}
],
"runAfter": {}
},
"question": {
"type": "Compose",
"inputs": [
{
"role": "user",
"content": "When did we last order laptops for new hires in IT?"
}
],
"runAfter": {
"documents": [
"SUCCEEDED"
]
}
},
"customer": {
"type": "Compose",
"inputs": {
"firstName": "Alex",
"lastName": "Taylor",
"department": "IT",
"employeeId": "E12345",
"orders": [
{
"name": "Dell Latitude 5540 Laptop",
"description": "Ordered 15 units for Q1 IT onboarding",
"date": "2024/02/20"
},
{
"name": "Docking Station",
"description": "Bulk purchase of 20 Dell WD19S docking stations",
"date": "2024/01/10"
}
]
},
"runAfter": {
"question": [
"SUCCEEDED"
]
}
},
"Get_chat_completions_using_Prompt_Template": {
"type": "ServiceProvider",
"inputs": {
"parameters": {
"deploymentId": "gpt-4o",
"promptTemplateInput": "system:\nYou are an AI assistant for Contoso's internal procurement team. You help employees get quick answers \nabout previous orders and product catalog details. Be brief, professional, and use markdown formatting \nwhen appropriate. Include the employee’s name in your response for a personal touch.\n\n# Product Catalog\nUse this documentation to guide your response. Include specific item names and any relevant descriptions.\n\n{% for item in documents %}\nCatalog Item ID: {{item.id}}\nName: {{item.title}}\nDescription: {{item.content}}\n{% endfor %}\n\n# Order History\nHere is the employee's procurement history to use as context when answering their question.\n\n{% for item in customer.orders %}\nOrder Item: {{item.name}}\nDetails: {{item.description}} — Ordered on {{item.date}}\n{% endfor %}\n\n# Employee Info\nName: {{customer.firstName}} {{customer.lastName}} \nDepartment: {{customer.department}} \nEmployee ID: {{customer.employeeId}}\n\n# Question\nThe employee has asked the following:\n\n{% for item in question %}\n{{item.role}}:\n{{item.content}}\n{% endfor %}\n\nBased on the product documentation and order history above, please provide a concise and helpful answer to their question. Do not fabricate information beyond the provided inputs.\n",
"temperature": 1,
"promptTemplateInputVariables": {
"documents": "@outputs('documents')",
"question": "@outputs('question')",
"customer": "@outputs('customer')"
}
},
"serviceProviderConfiguration": {
"connectionName": "openai",
"operationId": "getChatCompletionsUsingPromptTemplate",
"serviceProviderId": "/serviceProviders/openai"
}
},
"runAfter": {
"customer": [
"SUCCEEDED"
]
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"triggers": {
"When_a_HTTP_request_is_received": {
"type": "Request",
"kind": "Http"
}
}
},
"kind": "Stateful"
}
14 changes: 14 additions & 0 deletions AI-sample-demo/workflow-designtime/host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle.Workflows",
"version": "[1.*, 2.0.0)"
},
"extensions": {
"workflow": {
"settings": {
"Runtime.WorkflowOperationDiscoveryHostMode": "true"
}
}
}
}
9 changes: 9 additions & 0 deletions AI-sample-demo/workflow-designtime/local.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"IsEncrypted": false,
"Values": {
"APP_KIND": "workflowapp",
"FUNCTIONS_WORKER_RUNTIME": "node",
"ProjectDirectoryPath": "c:\\Users\\shahparth\\Downloads\\AI-sample-demo",
"AzureWebJobsSecretStorageType": "Files"
}
}