|
| 1 | +{ |
| 2 | + "$schema": "/schemaLink", |
| 3 | + "actions": { |
| 4 | + "Azure_OpenAI_-_Get_an_embedding": { |
| 5 | + "type": "ServiceProvider", |
| 6 | + "inputs": { |
| 7 | + "parameters": { |
| 8 | + "deploymentId": "@parameters('OpenAIEmbeddingModel_#workflowname#')", |
| 9 | + "input": "@triggerBody()?['question']" |
| 10 | + }, |
| 11 | + "serviceProviderConfiguration": { |
| 12 | + "connectionName": "openai_#workflowname#", |
| 13 | + "operationId": "getSingleEmbedding", |
| 14 | + "serviceProviderId": "/serviceProviders/openai" |
| 15 | + } |
| 16 | + }, |
| 17 | + "runAfter": {} |
| 18 | + }, |
| 19 | + "Response": { |
| 20 | + "type": "Response", |
| 21 | + "kind": "Http", |
| 22 | + "inputs": { |
| 23 | + "statusCode": 200, |
| 24 | + "body": "@body('Azure_OpenAI_-_Get_chat_completions')?['content']" |
| 25 | + }, |
| 26 | + "runAfter": { |
| 27 | + "Azure_OpenAI_-_Get_chat_completions": [ |
| 28 | + "SUCCEEDED" |
| 29 | + ] |
| 30 | + } |
| 31 | + }, |
| 32 | + "SQL_Server_-_Vector_Search": { |
| 33 | + "type": "ServiceProvider", |
| 34 | + "description": "Use this query to retrieve vector embeddings from your SQL vector table. Update the query based on your SQL table and schema.", |
| 35 | + "inputs": { |
| 36 | + "parameters": { |
| 37 | + "query": "SELECT TOP(2) filename, chunkid, chunk,\n 1-vector_distance('cosine', CAST(@embedding AS VECTOR(1536)), embedding) AS similarity_score,\n vector_distance('cosine', CAST(@embedding AS VECTOR(1536)), embedding) AS distance_score\n FROM dbo.resumedocs\n ORDER BY distance_score ", |
| 38 | + "queryParameters": { |
| 39 | + "embedding ": "@{body('Azure_OpenAI_-_Get_an_embedding')['embedding']}" |
| 40 | + } |
| 41 | + }, |
| 42 | + "serviceProviderConfiguration": { |
| 43 | + "connectionName": "azuresql_#workflowname#", |
| 44 | + "operationId": "executeQuery", |
| 45 | + "serviceProviderId": "/serviceProviders/sql" |
| 46 | + } |
| 47 | + }, |
| 48 | + "runAfter": { |
| 49 | + "Azure_OpenAI_-_Get_an_embedding": [ |
| 50 | + "SUCCEEDED" |
| 51 | + ] |
| 52 | + } |
| 53 | + }, |
| 54 | + "Azure_OpenAI_-_Get_chat_completions": { |
| 55 | + "type": "ServiceProvider", |
| 56 | + "description": "Update the system message for the LLM based on your requirements.", |
| 57 | + "inputs": { |
| 58 | + "parameters": { |
| 59 | + "deploymentId": "@parameters('OpenAIChatModel_#workflowname#')", |
| 60 | + "messages": [ |
| 61 | + { |
| 62 | + "role": "System", |
| 63 | + "content": "You're an intelligent and funny assistant who exclusively answers based on the data provided in the search_results: \n- Use the information from search_results to generate your top 3 responses. If the data isn't a perfect match for the user's query, use your best judgment to provide helpful suggestions and include the following format: \n File: {filename}\n Chunk ID: {chunkid}\n Similarity Score: {similarity_score}\n Add a small snippet from the Relevant Text: {chunktext}\n Don't use the entire chunk.\n- Avoid any other external data sources.\n- At the end of the recommendations, add a summary about why the candidate might be a good fit, even if the exact skills and hiring role don't match. Make sure you call out skills that match the description and which ones are missing. If the candidate doesn't have prior experience for the hiring role, we might need to pay extra attention during the interview process.\n- Add an interesting Microsoft-related fact about the technology that was searched: \n\nsearch_results = @{body('SQL_Server_-_Vector_Search')}" |
| 64 | + }, |
| 65 | + { |
| 66 | + "role": "User", |
| 67 | + "content": "@triggerBody()?['question']", |
| 68 | + "user": "Anon" |
| 69 | + } |
| 70 | + ], |
| 71 | + "temperature": 1 |
| 72 | + }, |
| 73 | + "serviceProviderConfiguration": { |
| 74 | + "connectionName": "openai_#workflowname#", |
| 75 | + "operationId": "getChatCompletions", |
| 76 | + "serviceProviderId": "/serviceProviders/openai" |
| 77 | + } |
| 78 | + }, |
| 79 | + "runAfter": { |
| 80 | + "SQL_Server_-_Vector_Search": [ |
| 81 | + "SUCCEEDED" |
| 82 | + ] |
| 83 | + } |
| 84 | + } |
| 85 | + }, |
| 86 | + "contentVersion": "1.0.0.0", |
| 87 | + "outputs": {}, |
| 88 | + "triggers": { |
| 89 | + "When_a_HTTP_request_is_received": { |
| 90 | + "type": "Request", |
| 91 | + "kind": "Http", |
| 92 | + "inputs": { |
| 93 | + "schema": { |
| 94 | + "type": "object", |
| 95 | + "properties": { |
| 96 | + "question": { |
| 97 | + "type": "string" |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | +} |
0 commit comments