microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service
MIT License
1.14k stars 940 forks source link

Azure AI search extension #319

Open sonphnt opened 4 months ago

sonphnt commented 4 months ago

Hi, I could not get it to work with my own data on AI Search. When I click on Azure AI Search extension. I fill in Key, Search name, Index name. But it does not work, What should I put in the API Endpoint "https:AZURE_CHAT_HOST.com/api/document"?, And I dont see where we store AZURE_CHAT_HOST on KeyVault.

Thanks

dpayne-voss commented 4 months ago

Hi @sonphnt, I am experiencing the same problem (issue 314).

I replaced AZURE_CHAT_HOST with the domain of my App Service (not I'm using a custom domain), and then ultimately get an Unauthorized error when the tool is trying to make the API request in the ExecuteFunction function.

For now I've modified the ExecuteFunction to check for the api/document endpoint and in that case call the similarity search function directly.

thivy commented 4 months ago

@sonphnt as @dpayne-voss mentioned, please replace the AZURE_CHAT_HOST with the name of the Azure App service name.

Note: this is not the Azure Search name.

dpayne-voss commented 4 months ago

Thanks @thivy , but even after using my App Service name (not I'm using a custom domain), I get an Unauthorized error when the tool tries to make the /api/document request.

thivy commented 4 months ago

Thanks @thivy , but even after using my App Service name (not I'm using a custom domain), I get an Unauthorized error when the tool tries to make the /api/document request.

Can you ensure that the endpoint is similar to below this should include azurewebsites.net https://your_website_name.azurewebsites.net/api/document

sonphnt commented 4 months ago

I run localhost and set that API endpoint to http://localhost:3000/api/document. it works for me but the response is very slow on GPT4-1106 model for each question.

Switching to GPT 3.5 1106 seems to be much faster with about 5 seconds. I will try to run this on Azure App Service later.

mkandukuri4 commented 4 months ago

Hi, I'm trying to set up this AI search on a small set of documents, what values should be passed for vectors in headers in step: 6-chat-over-file.md. I have passed (content, title) but still failing with the below error in the tool output

status: ERROR message: RestError: The field 'content' in the vector field list is not a vector field. Parameter name: vector.fields

derkoe commented 4 months ago

Hi, I'm trying to set up this AI search on a small set of documents, what values should be passed for vectors in headers in step: 6-chat-over-file.md. I have passed (content, title) but still failing with the below error in the tool output

status: ERROR message: RestError: The field 'content' in the vector field list is not a vector field. Parameter name: vector.fields

Seems like this cannot be working because it uses the same vectors for search and then for filtering the result fields.

mkandukuri4 commented 4 months ago

@derkoe Any Idea on how can we get it to work? @thivy any thoughts?

derkoe commented 4 months ago

@mkandukuri4 removing these lines https://github.com/microsoft/azurechat/blob/ba17a8dd6ed4fb041f8aeaed9900611f31ab5d9c/src/features/chat-page/chat-services/azure-ai-search/azure-ai-search.ts#L164-L176

and then using document instead of newDocument on this line https://github.com/microsoft/azurechat/blob/ba17a8dd6ed4fb041f8aeaed9900611f31ab5d9c/src/features/chat-page/chat-services/azure-ai-search/azure-ai-search.ts#L180

will fix it

mkandukuri4 commented 4 months ago

Hi @derkoe , I have tried the suggested solution but still failing with the below error. see the code for changes made in the azure-ai-search.ts can you check if I'm missing something // // exclude the all the fields that are not in the fields array // const document = item.document as any; // const newDocument: any = {};

  // // iterate over the object entries in document
  // // and only include the fields that are in the fields array

  // for (const key in document) {
  //   const hasKey = vectors.includes(key);
  //   if (!hasKey) {
  //     newDocument[key] = document[key];
  //   }
  // }

  results.push({
    score: result.score,
    document: document, // Use the newDocument object instead of the original document
  });
}

Error: message: RestError: The field 'content' in the vector field list is not a vector field. Parameter name: vector.fields

sonphnt commented 3 months ago

@mkandukuri4 Are you using Vector search? it seems like the field "content" in Azure AI Search is not a Vector type

mkandukuri4 commented 3 months ago

Hi @sonphnt

Thank you, I was able to get this working after enabling vector search in Azure OpenAI studio when creating an index.

image

samsutherland commented 2 months ago

@mkandukuri4 - where is that checkbox exactly?

rbandi71 commented 2 months ago

I am getting https://webapphost/api/document Unauthorized. Have you ever been able to address this issue? It works locally when used: http://localhost:3000/api/document

jnxjent commented 1 month ago

I can not upload the file in local clone (local host:3000) even though I can do in remote. There is error saying index error

jnxjent commented 1 month ago

I have another quesiton. I wish to search contents of the file uploaded before. I can search the file's uploaded in the chat but cannot search the file uploaded in different chat. Probably, how to index is the key??