deep-chat icon indicating copy to clipboard operation
deep-chat copied to clipboard

Data source to azure openAI

Open moiscye opened this issue 8 months ago • 3 comments

Is there any way to add a parameter for data_source to the azure openAI ? In other words I want to deploy a chat in azure and also vectorized data. In postman I get it to work this way:

{ "messages": [ { "role": "user", "content": "show me one record you have in the data" } ], "max_tokens": 800, "temperature": 0.7, "top_p": 0.95, "data_sources": [ { "type": "azure_search", "parameters": { "endpoint": "https://record-test-chat.search.windows.net", "index_name": "vector-148489220332", "authentication": { "type": "api_key", "key": "my-api" } } } ]
}

Image

moiscye avatar Mar 17 '25 06:03 moiscye

Hi @moiscye.

I have updated the Azure OpenAI Chat type to allow data_sources.

Here is the new TypeScript interface for this:

type AzureOpenAIDataSources = {
  type: string;
  parameters?: object;
}[];

type AzureOpenAIChat = OpenAIChat & {data_sources?: AzureOpenAIDataSources};

interface AzureOpenAI {
  urlDetails: URLDetails;
  chat?: true | AzureOpenAIChat;
  assistant?: true | OpenAIAssistant;
}

You can use it like this:

chatElementRef.directConnection = {
    azure: {
      openAI: {
        urlDetails: {
          deploymentId: 'deployment_id',
          endpoint: 'endpoint',
          version: 'version',
        },
        chat: {
          data_sources: [
            {
              type: 'azure_search',
              parameters: {
                endpoint: 'endpoint',
                index_name: 'vector-14848022002',
                authentication: {
                  type: 'system_assigned_managed_identity',
              }}}
          ]
}}}}

This is currently available in deep-chat-dev and deep-chat-react-dev version 9.0.243. These packages work exactly like the core ones except their names are different.

I will keep this issue open until this update gets merged into the core versions.

Let me know if there are any issues!

Thanks!

OvidijusParsiunas avatar Mar 17 '25 10:03 OvidijusParsiunas

That works, thank you! I will be implementing this with a backend server, so this will also work from there, I am assuming. Cheers!

moiscye avatar Mar 18 '25 04:03 moiscye

The Azure OpenAI Service is built to specifically call Azure as it uses the urlDetails object to construct the correct URL. Code here If you are hosting your own backend server, I would suggest simply using the connect property.

OvidijusParsiunas avatar Mar 18 '25 09:03 OvidijusParsiunas

This is now available in deep-chat and deep-chat-react version 2.2.0. See AzureDataSources for more information.

OvidijusParsiunas avatar May 08 '25 13:05 OvidijusParsiunas