MSUSAzureAccelerators / Azure-Cognitive-Search-Azure-OpenAI-Accelerator

Virtual Assistant - GPT Smart Search Engine - Bot Framework + Azure OpenAI + Azure AI Search + Azure SQL + Bing API + Azure Document Intelligence + LangChain + CosmosDB
https://gptsmartsearchapp.azurewebsites.net
MIT License
336 stars 555 forks source link

Getting error pydantic.error_wrappers.ValidationError: 1 validation error for AIMessage, when trying to interact in live chat with @docsearch after deploying in web app. #31

Closed sohamok closed 1 year ago

sohamok commented 1 year ago

The bot works fine locally with @docsearch , however when running in web app i am getting error

log in web app logstream:

2023-10-30T11:26:48.002567988Z 2023-10-30T11:26:48.002588789Z [on_turn_error] unhandled error: 1 validation error for AIMessage 2023-10-30T11:26:48.002594489Z content 2023-10-30T11:26:48.002624989Z none is not an allowed value (type=type_error.none.not_allowed) 2023-10-30T11:26:48.019385627Z Traceback (most recent call last): 2023-10-30T11:26:48.020082732Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/botbuilder/core/bot_adapter.py", line 128, in run_pipeline 2023-10-30T11:26:48.020100033Z return await self._middleware.receive_activity_with_status( 2023-10-30T11:26:48.020962740Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/botbuilder/core/middleware_set.py", line 69, in receive_activity_with_status 2023-10-30T11:26:48.020980040Z return await self.receive_activity_internal(context, callback) 2023-10-30T11:26:48.020985140Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/botbuilder/core/middleware_set.py", line 79, in receive_activity_internal 2023-10-30T11:26:48.020989140Z return await callback(context) 2023-10-30T11:26:48.021769646Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/botbuilder/core/activity_handler.py", line 70, in on_turn 2023-10-30T11:26:48.021803747Z await self.on_message_activity(turn_context) 2023-10-30T11:26:48.037765778Z File "/tmp/8dbd938a08a3f74/bot.py", line 110, in on_message_activity 2023-10-30T11:26:48.037786278Z answer = await loop.run_in_executor(ThreadPoolExecutor(), run_agent, input_text, agent_chain) 2023-10-30T11:26:48.037864979Z File "/opt/python/3.10.12/lib/python3.10/concurrent/futures/thread.py", line 58, in run 2023-10-30T11:26:48.037873179Z result = self.fn(*self.args, self.kwargs) 2023-10-30T11:26:48.037876779Z File "/tmp/8dbd938a08a3f74/utils.py", line 485, in run_agent 2023-10-30T11:26:48.037880479Z x=agent_chain.run(input=question) 2023-10-30T11:26:48.037883779Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/chains/base.py", line 480, in run 2023-10-30T11:26:48.037887379Z return self(kwargs, callbacks=callbacks, tags=tags, metadata=metadata)[ 2023-10-30T11:26:48.037890679Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/chains/base.py", line 284, in call 2023-10-30T11:26:48.037894179Z final_outputs: Dict[str, Any] = self.prep_outputs( 2023-10-30T11:26:48.037897479Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/chains/base.py", line 378, in prep_outputs 2023-10-30T11:26:48.037900879Z self.memory.save_context(inputs, outputs) 2023-10-30T11:26:48.037904279Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/memory/chat_memory.py", line 38, in save_context 2023-10-30T11:26:48.037907779Z self.chat_memory.add_ai_message(output_str) 2023-10-30T11:26:48.037911079Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/schema/memory.py", line 108, in add_ai_message 2023-10-30T11:26:48.037914579Z self.add_message(AIMessage(content=message)) 2023-10-30T11:26:48.037917879Z File "/tmp/8dbd938a08a3f74/antenv/lib/python3.10/site-packages/langchain/load/serializable.py", line 74, in init 2023-10-30T11:26:48.037921379Z super().init(kwargs) 2023-10-30T11:26:48.037924679Z File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init 2023-10-30T11:26:48.037936279Z pydantic.error_wrappers.ValidationError: 1 validation error for AIMessage 2023-10-30T11:26:48.037939779Z content 2023-10-30T11:26:48.037942979Z none is not an allowed value (type=type_error.none.not_allowed)

the live chat works fine with @sqlsearch and @bing , only fails with @docsearch, however @docsearch works fine locally.

image

what can be the issue here?