Comments (1)
To address the issue with CondenseQuestionChatEngine#astream_chat
failing to handle AsyncStreamingResponse
objects, you'll need to modify the _get_tool_output_from_response
method to properly await the response. Here's a revised version of the method that supports AsyncStreamingResponse
:
async def _get_tool_output_from_response(
self, query: str, response: RESPONSE_TYPE
) -> ToolOutput:
if isinstance(response, AsyncStreamingResponse):
content = await response.get_response() # Await the async response
return ToolOutput(
content=str(content),
tool_name="query_engine",
raw_input={"query": query},
raw_output=response,
)
elif isinstance(response, StreamingResponse):
return ToolOutput(
content="",
tool_name="query_engine",
raw_input={"query": query},
raw_output=response,
)
else:
return ToolOutput(
content=str(response),
tool_name="query_engine",
raw_input={"query": query},
raw_output=response,
)
This change requires the method to be asynchronous, so you'll also need to update any calls to _get_tool_output_from_response
to be awaited. This adjustment ensures that AsyncStreamingResponse
objects are handled correctly by awaiting their content before processing.
Details
Sources
- llama-index-core/llama_index/core/chat_engine/condense_question.py
- llama-index-core/llama_index/core/base/response/schema.py
- llama-index-legacy/llama_index/legacy/multi_modal_llms/openai.py
- llama-index-legacy/llama_index/legacy/multi_modal_llms/dashscope.py
- llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-openai/llama_index/multi_modal_llms/openai/base.py
- llama-index-legacy/llama_index/legacy/multi_modal_llms/ollama.py
- llama-index-integrations/llms/llama-index-llms-vllm/tests/cassettes/TestVllmIntegration.test_astream_chat.yaml
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from llama_index.
Related Issues (20)
- [Bug]: HOT 2
- Chromadb embeddings not working with densex HOT 1
- [Question]: I want to make sure that the chatbot uses the retriever only when the question is related to ingested documents. HOT 1
- [Bug]: pipeline arun does not parallelize query pipeline HOT 3
- Json +pdf engine HOT 1
- [Question]: SentenceNodeParser ignores max_length of embed model HOT 4
- [Bug]: Unable to run UnstructuredElementNodeParser with OpenAILike LLM HOT 2
- [Feature Request]: Async support for Qdrant Vector store HOT 2
- [Question]: when break complex problem into sub-problems raise “JSONDecodeError" HOT 3
- [Question]: is default in VectorIndexRetriever semantic search HOT 2
- [Question]: Cannot import name 'DEFAULT HUGGING FACE EMBEDDING MODEL from 'llama_index.embeddings' (/usr/local/lib/python3.11/site-packages/llama_index/embeddings/__init__.py) HOT 2
- [Question]: way to emit similarity score from the retriever? HOT 1
- [Feature Request]: Adding Azure Cosmos DB NoSql as a new vector store
- [Feature Request]: Upgrade llama-index-embeddings-text-embeddings-inference package dependency requirements
- [Question]: Storing agent HOT 1
- [Bug]: Gemini.stream_chat is missing @llm_chat_callback() HOT 1
- [Bug]: Qwen2 compete error HOT 1
- [Bug]: SQLTableRetrieverQueryEngine response metadata not correctly formatted HOT 1
- [Question]: Big problem on saving and retrieve KnowledgeGraphIndex (Neo4j) HOT 3
- [Bug]: Text match filter doesn't work with PostgreSQL filter search and gives unknown operator error. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from llama_index.