How to pass additional data to the user prompt to get the response from both RAG documents as well as Additional data passed in the prompt

Hi,
We are trying to get the response from both Rag Documents as well as with additional case data which we want to pass as a json data to the chat completion API ,

Could you please suggest me the correct way of doing search to get matching response from both the sources?

As I am not getting 100% results either from case data or from Documents…

we are using azure_search type as data source, below is the request body

{
  "data_sources": [
    {
      "type": "azure_search",
      "parameters": {
        "endpoint": "Dummy endpoint",
        "index_name": "chandra",
        "authentication": {
          "type": "api_key",
          "key": "Dummy KEY"
        },
        "query_type": "vector_simple_hybrid",
        "fields_mapping": {
          "content_fields_separator": "\n",
          "content_fields": [
            "TA_SYSTEM_CHUNK_TEXT"
          ],
          "title_field": "TA_SYSTEM_CAPTURE_DOC_NAME",
          "filepath_field": "TA_SYSTEM_CAPTURE_DOC_ID",
          "vector_fields": [
            "TA_SYSTEM_CHUNK_VECTORS"
          ]
        },
        "embedding_dependency": {
          "deployment_name": "TextEmbeddings",
          "url": null,
          "type": "deployment_name"
        },
        "semantic_configuration": "chandra_semanticConf",
        "strictness": 3,
        "topNDocuments": 5,
        "filter": ""
      }
    }
  ],
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant. The user data includes job information and related history. Use both the user data and retrieved documents to answer queries. Do not rely on exact keyword matches; instead, provide detailed responses based on semantic meaning and context. ** Case Data **:\"  {\"CaseDetails\":{\"ProcessName\":\"CD\",\"ProcessDescription\":\"This is CD Description\",\"ProcessVersion\":14.0,\"Createdby\":\"ChandraShekar.Machip\",\"Owner\":\"ChandraShekar.Machip\",\"SLA\":\"Red\",\"Status\":\"Completed Awaiting Associated Jobs Completion\",\"Score\":\"0\",\"State\":\"state1\",\"StatePercentage\":\"5\",\"CreatedOn\":\"2024-10-08T18:29:04\",\"ExpectedDuration\":\"0 Days 0 Hours 0 Minutes 0 Seconds\",\"ExpectedFinish\":\"2024-10-08T18:29:04\",\"TimeSpent\":null,\"ActualFinish\":\"2024-10-08T18:32:32\",\"CurrentDuration\":\"0 Days 0 Hours 0 Minutes 2 Seconds\",\"Cost\":\"0\"},\"History\":[{\"ProcessName\":\"CD\",\"ProcessDescription\":\"This is CD Description\",\"NodeHistory\":{\"NodeName\":\"End\",\"NodeDescription\":null,\"PerformedBy\":\"TotalAgility\",\"PerformedOn\":\"2024-10-08T18:32:32\",\"TimeSpent\":\"0 Days 0 Hours 0 Minutes 0 Seconds\"}},{\"ProcessName\":\"P1\",\"ProcessDescription\":\"This is CD Description\",\"NodeHistory\":{\"NodeName\":\"End\",\"NodeDescription\":null,\"PerformedBy\":\"TotalAgility\",\"PerformedOn\":\"2024-10-08T18:32:32\",\"TimeSpent\":\"0 Days 0 Hours 0 Minutes 0 Seconds\"}},{\"ProcessName\":\"P1\",\"ProcessDescription\":\"\",\"NodeHistory\":{\"NodeName\":\"Activity 1\",\"NodeDescription\":\"\",\"PerformedBy\":\"TotalAgility\",\"PerformedOn\":\"2024-10-08T18:32:32\",\"TimeSpent\":\"0 Days 0 Hours 0 Minutes 0 Seconds\"}},{\"ProcessName\":\"CD\",\"ProcessDescription\":\"This is CD Description\",\"NodeHistory\":{\"NodeName\":\"Decision\",\"NodeDescription\":\"This is Decision Node\",\"PerformedBy\":\"TotalAgility\",\"PerformedOn\":\"2024-10-08T18:32:31\",\"TimeSpent\":\"0 Days 0 Hours 0 Minutes 0 Seconds\"}},{\"ProcessName\":\"CD\",\"ProcessDescription\":\"This is CD Description\",\"NodeHistory\":{\"NodeName\":\"Activity 1\",\"NodeDescription\":\"This is a test Dsc Avtivity 1\",\"PerformedBy\":\"ChandraShekar.Machip\",\"PerformedOn\":\"2024-10-08T18:32:30\",\"TimeSpent\":\"0 Days 0 Hours 0 Minutes 2 Seconds\"}}],\"Variables\":[{\"Name\":\"aa\",\"Value\":\"Server=(local);Trusted_Connection=Yes;Database=DataCenterTenants;\"},{\"Name\":\"Job Id\",\"Value\":\"\"},{\"Name\":\"Milestone Name\",\"Value\":\"\"},{\"Name\":\"Milestone Target Date\",\"Value\":\"09/17/2024 12:56:40\"},{\"Name\":\"sdfsd\",\"Value\":\"\"},{\"Name\":\"Sub Job Id\",\"Value\":\"\"}],\"MileStones\":[{\"Name\":\"MileStone1\",\"TargetDate\":\"2024-10-08T18:30:04\",\"ActualDate\":\"2024-10-08T18:32:31\"}],\"Notes\":[{\"ResourceName\":\"ChandraShekar.Machip\",\"CreatedOn\":\"2024-10-08T18:31:56\",\"Note\":\" This is System note \"},{\"ResourceName\":\"ChandraShekar.Machip\",\"CreatedOn\":\"2024-10-08T18:31:42\",\"Note\":\"Test Default Note\"}],\"Events\":[{\"Name\":\"PE\",\"Source\":\"TotalAgility\",\"EventFiredOn\":\"2024-10-08T18:32:31\"}],\"States\":[{\"Name\":\"state1\",\"PerformedBy\":\"ChandraShekar.Machip\",\"PerformedOn\":\"2024-10-08T18:32:31\"},{\"Name\":\"state1\",\"PerformedBy\":\"ChandraShekar.Machip\",\"PerformedOn\":\"2024-10-08T18:31:14\"}],\"Roles\":[{\"RoleName\":\"ABcd\",\"AssociatedResources\":[{\"Name\":\"ChandraShekar.Machip\"}]},{\"RoleName\":\"floartingrole\",\"AssociatedResources\":[{\"Name\":\"ChandraShekar.Machip\"}]}],\"LinkedCases\":[{\"CaseRef\":\"c22\",\"ProcessName\":\"CD\",\"ProcessDescription\":null,\"LinkDescription\":\"C22 link Desc\"}],\"AssociatedJobs\":[{\"ProcessName\":\"Cf\",\"Creator\":\"ChandraShekar.Machip\",\"CreatedOn\":\"2024-10-08T18:30:05\"}]} .Find information in the json along with the retrieved documents from the search to complete your response.",
      "end_turn": false,
      "context": null
    },
    {
      "role": "user",
      "content": "What is the expected duration. Get information from case data and the retrieved documents.Do not rely on exact keyword matches; instead, provide detailed responses based on semantic meaning and context",
      "end_turn": false,
      "context": null
    }
  ]
}

Thanks in Advance…

1 Like

Hello!

I haven’t posted it in a while, but it’s always nice to be able to share good things in the community.

As you have not specified your VectorDB configuration scenario (AI Search) or the strategy for retrieving RAG contexts, I will suggest, at the beginning, 3 links:

I hope the links above can help you evolve in the general scenario, in addition, there are some official notebooks from Azure itself that helped me a lot:

1 Like