Memori icon indicating copy to clipboard operation
Memori copied to clipboard

The database is not automatically stored when streaming response

Open tianqihou opened this issue 3 months ago • 6 comments

response1 = openai_client.chat.completions.create( model="xxx", stream=True, messages=[{"role": "user", "content": "I'm working on a Python FastAPI project"}], ) like this, the sqlite database does not store dialogs

tianqihou avatar Sep 22 '25 09:09 tianqihou

@tianqihou Thanks for raising this! Currently, streamed responses aren’t recorded in Memori, but support for this is planned for an upcoming update.

harshalmore31 avatar Sep 23 '25 19:09 harshalmore31

I'm confused about how the streaming output of LiteLLM can be stored in Memori. How is this implemented?

tianqihou avatar Sep 24 '25 08:09 tianqihou

Hi @tianqihou , Memori uses LiteLLM's success_callback system. When streaming completes, LiteLLM automatically calls our callback with the reconstructed full conversation (input + complete output), which Memori then stores in SQL Custom Callbacks | liteLLM. The callback gets registered automatically when you call memori.enable(). Thanks!

harshalmore31 avatar Sep 26 '25 16:09 harshalmore31

Thank you. I really like this pluggable memory approach. I hope this project becomes more and more popular.

tianqihou avatar Sep 26 '25 16:09 tianqihou

Thank you! Really appreciate the support. 🙏 Feel free to star the repo and share it if you find it useful. Community feedback like yours helps drive the project forward!

harshalmore31 avatar Oct 02 '25 12:10 harshalmore31

Hello @harshalmore31 , I've created a PR to support streaming responses from LiteLLM in #169 . Could you please take a look at it?

Thank you!

andypalmi avatar Nov 22 '25 03:11 andypalmi