microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

settings.py issue - Data Source Setting with Search - Azure OpenAI grounding Issue

apvarana opened this issue · comments

looks like some env variables required like Data Source type, the new code is failing saying the data source is not set and Az open ai cannot be grounded. Specifically if we are using AI search. This problem surfaced after the latest checkout and settings,py file . Can someone pls look into this issue

Also encountered the same issue. If you use Azure AI Search, creating an environment variable DATASOURCE_TYPE = "AzureCognitiveSearch" (in your .env file or App Service environment settings) solves the problem.

Hi @apvarana / @warmdev, thanks for bringing this to our attention. The variable DATASOURCE_TYPE is now required. I will update the docs accordingly in the README, which is something I missed in the recent settings refactoring PR.

#881 Docs update is in this PR.

Hi Thanks for the above one.

There is one more error that I got

Error code: 400 - {'error': {'requestid': 'xxxxxx', 'code': 400, 'message': 'An error occurred when calling Azure Cognitive Search: Azure Search Error: 400, message='Server responded with status 400. Error message: {"error":{"code":"","message":"Invalid expression: Could not find a property named \'True\' on type \'search.document\'.\\r\\nParameter name: $filter"}}', url=URL('https://xxxxxxxx.windows.net/indexes/xxxxxxxx/docs/search?api-version=2024-03-01-preview\')\nPotential issue with Azure search filter. Please ensure all field names in the filter are correct and syntax is correct for filter.'}}

Potential Fix
In settings.py , I changed the filters line to
filter: Optional[str] = Field(default=None, exclude=True)

in _AzureSearchSettings Class

Hi @apvarana , thanks for sharing the details of the issue with the filter. I have changed the line to what you have recommended above for the time being, but actually I'm not sure if exclude=True is what we want, since it will prevent the value from being available in the dumped model output.

Did you have the AZURE_SEARCH_PERMITTED_GROUPS_COLUMN variable set in your environment at the time you got the error message above?

I do not have AZURE_SEARCH_PERMITTED_GROUPS_COLUMN variable set