agent_or_engine = create_summary_index_agent_from_s3_keys(
model=model,
user_id=user_id,
content_s3_key_extension_pairs=content_s3_key_extension_pairs,
history=history,
)
....
summary_index = SummaryIndex.from_documents(
documents, llm=LLM_INSTANCES[model], embed_model=get_embed_model()
)
retriever = get_retriever(
user_id=user_id,
model=model,
index=summary_index,
)
chat_engine = CondensePlusContextChatEngine.from_defaults(
retriever=retriever,
llm=LLM_INSTANCES[model],
chat_history=history,
memory=ChatMemoryBuffer.from_defaults( # pyright: ignore
chat_history=history,
token_limit=128000, # When the memory parameter is omitted, the token limit is a small number and causes an error to be thrown.
),
)
response = await agent_or_engine.astream_chat(message) # pyright: ignore