Skip to content
New issue

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

I get double output if i use this code, dont know how to fix this? #13

Open
shivamehta opened this issue Sep 20, 2023 · 1 comment
Open

Comments

@shivamehta
Copy link

shivamehta commented Sep 20, 2023

image

This is the code copied from your repo :

@cl.on_chat_start
async def start():
chain = qa_bot()
msg = cl.Message(content="Starting the bot...")
await msg.send()
msg.content = "Hi, Welcome to School Assist Bot. What is your query?"
await msg.update()

cl.user_session.set("chain", chain)

@cl.on_message
async def main(message):
chain = cl.user_session.get("chain")
cb = cl.AsyncLangchainCallbackHandler(
stream_final_answer=True, answer_prefix_tokens=["FINAL", "ANSWER"]
)
cb.answer_reached = True
res = await chain.acall(message, callbacks=[cb])
answer = res["result"]
print(answer)
#sources = res["source_documents"]

# if sources:
#     answer += f"\nSources:" + str(sources)
#     #pass
# else:
#     answer += "\nNo sources found"

await cl.Message(content=answer).send()
@maksood5010
Copy link

maksood5010 commented Nov 9, 2023

I also got this issue. did anyone find any solution?

in the terminal i am getting this error:

Error in LangchainTracer.on_llm_end callback: ValueError('too many values to unpack (expected 2)')

@AIAnytime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants