Azure / azure-functions-openai-extension

An extension that adds support for Azure OpenAI/ OpenAI bindings in Azure Functions for LLM (GPT-3.5-Turbo, GPT-4, etc)
MIT License
63 stars 18 forks source link

Request for Enhancements in Configurability of Azure AI Search Settings in OpenAI Extension #90

Open yoshioterada opened 2 weeks ago

yoshioterada commented 2 weeks ago

Expected Behavior

While I implementing Semantic Search using Azure AI Search with the OpenAI Extension(Java Worker) of Azure Functions, I faced a connectivity issue. By examining the debug logs and tracing the source code, I discovered a problem in the current implementation.

Enhancements Request

To ensure seamless integration with existing Azure AI Search indexes, I kindly request that the implementation be modified to allow the following names to be configurable via environment variables or properties rather than being hardcoded:

Code References:

https://github.com/Azure/azure-functions-openai-extension/blob/94c5c5aed4207bb5e894adc7f49ca6bd75017bba/src/WebJobs.Extensions.OpenAI.AzureAISearch/AzureAISearchProvider.cs#L122-L133

https://github.com/Azure/azure-functions-openai-extension/blob/94c5c5aed4207bb5e894adc7f49ca6bd75017bba/src/WebJobs.Extensions.OpenAI.AzureAISearch/AzureAISearchProvider.cs#L198-L201

https://github.com/Azure/azure-functions-openai-extension/blob/94c5c5aed4207bb5e894adc7f49ca6bd75017bba/src/WebJobs.Extensions.OpenAI.AzureAISearch/AzureAISearchProvider.cs#L236-L242

What language of preference?

Dotnet (OOP)

Relevant sample code snipped

N/A

Additional Information

Background:

I have already created an index in Azure AI Search that supports Hybrid + Semantic Ranking using the "Bring Your Own Data" wizard in Azure AI Studio. When using this wizard, the vector field name is automatically set to "contentVector" instead of the "embeddings".

AI-Search-Vector-Field

Given that the vector field name can be specified arbitrarily by users during index creation, the hardcoding of these names in the current implementation prevents connectivity to existing Azure AI Search indices. Similar issues arise with "Semantic Configuration" names and "Vector Profiles" names.

By making these fields configurable, it would greatly enhance the flexibility and usability of the extension, allowing it to be used with a wider range of existing Azure AI Search setups.

Thank you for considering this enhancement. I am confident that it will benefit many users who are looking to integrate Azure AI Search with the OpenAI Extension.

Best regards, Yoshio

yoshioterada commented 2 weeks ago

Following is the actual log when I used difference field name. And if I created the "embeddings" for Vector, following messages was not shown.

Request [769a8e32-d297-46e0-9eb5-553dc499dbf3] 
POST https://yoshio-ai-search.search.windows.net/indexes('javadocja')/docs/search.post.search?api-version=2023-11-01 
Accept:application/json; odata.metadata=none Content-Type:application/json api-key:REDACTED 
x-ms-client-request-id:769a8e32-d297-46e0-9eb5-553dc499dbf3 x-ms-return-client-request-id:true 
User-Agent:azsdk-net-Search.Documents/11.5.1 (.NET 8.0.5; Debian GNU/Linux 12 (bookworm)) client assembly: 
Azure.Search.Documents

Error response [769a8e32-d297-46e0-9eb5-553dc499dbf3] 400 Bad Request (00.1s) Cache-Control:no-store, 
no-cache Pragma:no-cache Server:Microsoft-IIS/10.0 client-request-id:769a8e32-d297-46e0-9eb5-553dc499dbf3 
x-ms-client-request-id:769a8e32-d297-46e0-9eb5-553dc499dbf3 
request-id:769a8e32-d297-46e0-9eb5-553dc499dbf3 elapsed-time:70 
Strict-Transport-Security:REDACTED Date:Tue, 11 Jun 2024 02:53:54 GMT Content-Length:202 
Content-Type:application/json; charset=utf-8 Content-Language:REDACTED Expires:-1

Unknown field 'embeddings' in vector field list. Status: 400 (Bad Request) ErrorCode: InvalidRequestParameter 
Content: {"error":{"code":"InvalidRequestParameter","message":"Unknown field 'embeddings' in vector field list.",
"details":[{"code":"UnknownField","message":"Unknown field 'embeddings' in vector field list."}]}} 
Headers: Cache-Control: no-store, no-cache Pragma: no-cache Server: Microsoft-IIS/10.0 
client-request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 
x-ms-client-request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 elapsed-time: 70 Strict-Transport-Security: REDACTED 
Date: Tue, 11 Jun 2024 02:53:54 GMT Content-Length: 202 Content-Type: application/json; 
charset=utf-8 Content-Language: REDACTED Expires: -1

Executed 'Functions.PromptFile' (Failed, Id=05af9af6-0159-4170-9b58-64dab82c08d5, Duration=161ms)

Unknown field 'embeddings' in vector field list. Status: 400 (Bad Request) ErrorCode: InvalidRequestParameter 
Content: {"error":{"code":"InvalidRequestParameter","message":"Unknown field 'embeddings' in vector field list.",
"details":[{"code":"UnknownField","message":"Unknown field 'embeddings' in vector field list."}]}} 
Headers: Cache-Control: no-store, no-cache Pragma: no-cache Server: 
Microsoft-IIS/10.0 client-request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 
x-ms-client-request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 
request-id: 769a8e32-d297-46e0-9eb5-553dc499dbf3 elapsed-time: 70 Strict-Transport-Security: REDACTED 
Date: Tue, 11 Jun 2024 02:53:54 GMT Content-Length: 202 Content-Type: application/json; 
charset=utf-8 Content-Language: REDACTED Expires: -1