ai-dial icon indicating copy to clipboard operation
ai-dial copied to clipboard

Addon breaks the chat

Open im1ex opened this issue 8 months ago • 0 comments

Name and Version

ai-dial main branch, commit 2bb99782cd2ad4b104a745724e09b8afd02c814c

Images with versions from docker compose: epam/ai-dial-chat-themes:0.6.0 epam/ai-dial-chat:0.17.0 epam/ai-dial-core:0.16.0 epam/ai-dial-adapter-openai:0.14.0 epam/ai-dial-assistant:0.7.0

What steps will reproduce the bug?

Steps to reproduce are based on Ai Dial Addon tutorial.

  1. git clone https://github.com/epam/ai-dial.git
  2. cd ai-dial/dial-docker-compose/addon
  3. Edit core/config.json file to configure upstreams of GPT models
  4. docker compose up -d
  5. Open http://localhost:3000/
  6. Select Talk to "TODO Assistant"
  7. Send Ping message

What is the expected behavior?

Something like Hello! How can I help you today? received.

What do you see instead?

Error Sorry, we were unable to process your request at this time due to a server error. Please try again later. Thank you for your patience and understanding.

Additional information

addon-assistant container log:

2025-03-17 14:41:00 INFO:     Uvicorn running on http://0.0.0.0:5000 (Press CTRL+C to quit)
2025-03-17 14:41:00 INFO:     Started parent process [1]
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import APIOperation`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import APIOperation`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import APIOperation`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import OpenAPISpec`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import OpenAPISpec`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 /app/.venv/lib/python3.11/site-packages/langchain/tools/__init__.py:63: LangChainDeprecationWarning: Importing tools from langchain is deprecated. Importing from langchain will no longer be supported as of langchain==0.2.0. Please import from langchain-community instead:
2025-03-17 14:41:04 
2025-03-17 14:41:04 `from langchain_community.tools import OpenAPISpec`.
2025-03-17 14:41:04 
2025-03-17 14:41:04 To install langchain-community run `pip install -U langchain-community`.
2025-03-17 14:41:04   warnings.warn(
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 10 | Started server process [10]
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 9 | Started server process [9]
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 10 | Waiting for application startup.
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 9 | Waiting for application startup.
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 9 | Application startup complete.
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 10 | Application startup complete.
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 8 | Started server process [8]
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 8 | Waiting for application startup.
2025-03-17 14:41:04 INFO:     | 2025-03-17 13:41:04 | uvicorn.error | 8 | Application startup complete.
2025-03-17 14:52:10 INFO:     | 2025-03-17 13:52:10 | aidial_assistant.utils.open_ai_plugin | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - Fetching plugin info from http://addon:5003/.well-known/ai-plugin.json
2025-03-17 14:52:10 INFO:     | 2025-03-17 13:52:10 | aidial_assistant.utils.open_ai_plugin | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - Fetching plugin spec from http://addon:5003/openapi.yaml
2025-03-17 14:52:10 WARNING:  | 2025-03-17 13:52:10 | langchain_community.utilities.openapi | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - Attempting to load an OpenAPI 3.0.1 spec.  This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.
2025-03-17 14:52:10 WARNING:  | 2025-03-17 13:52:10 | langchain_community.utilities.openapi | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - Attempting to load an OpenAPI 3.0.1 spec.  This may result in degraded performance. Convert your OpenAPI spec to 3.1.* spec for better support.
2025-03-17 14:52:10 INFO:     | 2025-03-17 13:52:10 | uvicorn.access | 10 | 172.18.0.7:58538 - "POST /openai/deployments/assistant/chat/completions?api-version=2024-02-01 HTTP/1.1" 200
2025-03-17 14:52:14 INFO:     | 2025-03-17 13:52:14 | httpx | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - HTTP Request: POST http://core:8080/openai/deployments/gpt-4/chat/completions?api-version=2023-12-01-preview "HTTP/1.1 200 OK"
2025-03-17 14:52:14 ERROR:    | 2025-03-17 13:52:14 | aidial_assistant.utils.exceptions | 10 | [trace_id=c79dca61e48c4e927431123fbc021e46 span_id=10af1350ef958a14] - Unhandled exception
2025-03-17 14:52:14 Traceback (most recent call last):
2025-03-17 14:52:14   File "/app/aidial_assistant/utils/exceptions.py", line 47, in wrapper
2025-03-17 14:52:14     return await func(*args, **kwargs)
2025-03-17 14:52:14            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-17 14:52:14   File "/app/aidial_assistant/application/assistant_application.py", line 188, in chat_completion
2025-03-17 14:52:14     await AssistantApplication._run_emulated_tools_chat(
2025-03-17 14:52:14   File "/app/aidial_assistant/application/assistant_application.py", line 256, in _run_emulated_tools_chat
2025-03-17 14:52:14     await chain.run_chat(history, callback, model_request_limiter)
2025-03-17 14:52:14   File "/app/aidial_assistant/chain/command_chain.py", line 100, in run_chat
2025-03-17 14:52:14     dialogue_turn = await self._run_with_protocol_failure_retries(
2025-03-17 14:52:14                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-17 14:52:14   File "/app/aidial_assistant/chain/command_chain.py", line 148, in _run_with_protocol_failure_retries
2025-03-17 14:52:14     await model_request_limiter.verify_limit(all_messages)
2025-03-17 14:52:14   File "/app/aidial_assistant/application/addons_dialogue_limiter.py", line 24, in verify_limit
2025-03-17 14:52:14     self._initial_tokens = await self.model_client.count_tokens(
2025-03-17 14:52:14                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-03-17 14:52:14   File "/app/aidial_assistant/model/model_client.py", line 140, in count_tokens
2025-03-17 14:52:14     await _flush_stream(
2025-03-17 14:52:14   File "/app/aidial_assistant/model/model_client.py", line 34, in _flush_stream
2025-03-17 14:52:14     async for _ in stream:
2025-03-17 14:52:14   File "/app/aidial_assistant/model/model_client.py", line 101, in agenerate
2025-03-17 14:52:14     choice = chunk.choices[0]
2025-03-17 14:52:14              ~~~~~~~~~~~~~^^^
2025-03-17 14:52:14 IndexError: list index out of range

im1ex avatar Mar 17 '25 13:03 im1ex