Find answers from the community

k
kar
Offline, last seen 4 months ago
Joined September 25, 2024
Hi, I'm going crazy with the astream_chat implementation,, this is my code ''' async def generate_response_qa(
query: str, chat_session_id: str, type: str, db
) -> AsyncGenerator[str, None]:
memory, message_history, chat_memory = await get_memory_for_session(chat_session_id, db)

chat_engine = SimpleChatEngine.from_defaults(memory=chat_memory, llm=QA_LLM_MODEL, prefix_messages=[])
response = chat_engine.astream_chat(query)

result = ""
async for token in response.async_response_gen:
result += token
yield token ''' . Each time I'm running a request I have Error: 'coroutine' object has no attribute 'async_response_gen' What I'm doing wrong here. BTW I'm using llama-index==0.10.51, Any help is welcome. Thank you.
19 comments
L
k