microsoft / sample-app-aoai-chatGPT

Sample code for a simple web chat experience through Azure OpenAI, including Azure OpenAI On Your Data.
MIT License
1.43k stars 2.14k forks source link

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

Open apvarana opened 1 month ago

apvarana commented 1 month ago

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

warmdev commented 1 month ago

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.

abhahn commented 1 month ago

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.

abhahn commented 1 month ago

881 Docs update is in this PR.

apvarana commented 1 month ago

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

abhahn commented 1 month ago

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?

apvarana commented 1 month ago

I do not have AZURE_SEARCH_PERMITTED_GROUPS_COLUMN variable set

MoustafaAMahmoud commented 1 month ago

One more issue here, on the one click deployment there is no option to set DATA_SOURCE

https://github.com/microsoft/sample-app-aoai-chatGPT/blob/main/infrastructure/deployment.json.

WIP: https://github.com/microsoft/sample-app-aoai-chatGPT/pull/896/files