Chainlit / cookbook

Chainlit's cookbook repo
https://github.com/Chainlit/chainlit
713 stars 270 forks source link

How can I access user feedback in the main python script? #66

Closed benoitmiserez closed 7 months ago

benoitmiserez commented 7 months ago

I'm just getting to know it but I already think Chainlit is awesome!

However, I would like to access the user feedback in the main python script for further analysis. I cannot find it in the documentation or issues. Data persistence is enabled and I can find the feedback in the Literal AI dashboard.

How can I access the feedback in the main python script?

Thanks!

willydouhard commented 7 months ago

Thank you!

  1. You can access your data with the literal sdk
  2. You can override the chainlit data layer
benoitmiserez commented 7 months ago

Thanks! Do you have an example of how to do this elegantly? I'm working on a langchain RAG application. Do I create a separate step for it? I'm not familiar with threads either.

willydouhard commented 7 months ago

What are you looking to achieve with the feedback exactly?

benoitmiserez commented 7 months ago

I want to use it to create canned answers. If the feedback is good, I want to store the question answer pair in my vector db.

I can add code to chainlit/data/init.py in order to create a custom data layer or to modify ChainlitDataLayer, but I suppose there's better ways to do this?

benoitmiserez commented 7 months ago

Worked around the issue. My current solution is:

willydouhard commented 7 months ago

Awesome!