I want to add a simple chat UI to my RAG based chatbot. All the materials(one example) I came across online have a very simple prompt template with question and chat_history variables. I do not see those variables being explicitly passed to the prompt in chainlit's @on_message method implementation. I assume that, by default, chainlit passes message param to question variable of prompt?
However my prompt has many more variables and I do not see how to pass them when invoking the @on_message decorated method of chainlit. I tried this but it does not work:
@cl.on_message
async def main(message: cl.message):
chain = cl.user_session.get("chain")
cb = cl.AsyncLangchainCallbackHandler()
res = await chain.acall(inputs={
"question": message,
"chat_history": "",
"doc_name": "Sample name",
"contact_info": "[email protected]",
"doc_url": "foo.com",
"doc_owner": "Sample owner"
}, callbacks=[cb])
answer = res["answer"]
await cl.Message(content=answer).send()
It gives an error expected string or buffer when I send a message on chainlit's UI. Screenshot attached.
Does anyone know how to send custom prompt variables via chainlit to the model? Checked chainlit's official doc as well but not helpful. Chainlit seems like a framework with very high level abstraction and does too much "magic" under the covers! :(
