We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
loader = TextLoader("static/faq/ecommerce_faq.txt") documents = loader.load() text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0) texts = text_splitter.split_documents(documents) docsearch = Chroma.from_documents(texts, embeddings) faq_chain = RetrievalQA.from_chain_type( llm, chain_type="stuff", retriever=docsearch.as_retriever() ) @tool("FAQ") def faq(intput: str) -> str: """"useful for when you need to answer questions about shopping policies, like return policy, shipping policy, etc.""" return faq_chain.acall(intput) async def call_openai(question): callback = AsyncIteratorCallbackHandler() # coroutine = wait_done(model.agenerate(messages=[[HumanMessage(content=question)]]), callback.done) coroutine = wait_done(faq(question), callback.done) task = asyncio.create_task(coroutine) print('coroutine', callback.aiter()) # <async_generator object AsyncIteratorCallbackHandler.aiter at 0x11e4ffa40> async for token in callback.aiter(): yield f"{token}" await task
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: