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

Use callbacks when using LLM with cache #3391

Closed
gramliu opened this issue Nov 23, 2023 · 2 comments · Fixed by #3392
Closed

Use callbacks when using LLM with cache #3391

gramliu opened this issue Nov 23, 2023 · 2 comments · Fixed by #3392
Labels
auto:improvement Medium size change to existing code to handle new use-cases

Comments

@gramliu
Copy link
Contributor

gramliu commented Nov 23, 2023

Integrations with observability platforms like LangSmith have been great for tracing calls to OpenAI. However, when a cache is specified, the callbacks (handleLLMStart, handleLLMEnd, and handleLLMError) aren't called unlike in their uncached counterparts.

I presume this is the case because the callbacks don't currently handle the case of cached responses, so there wouldn't be a way to tell if tokens were actually consumed or not. That being said, I think it would be pretty worthwhile to add this and even initially just specify that it's cached in the callback metadata. I would very much like to see the messages being generated on LangSmith and not just the calls to the tools.

Uncached

image

Cached

image
Copy link

dosubot bot commented Nov 23, 2023

🤖

It seems like you've got this under control, if you want help or have specific questions, let me know what I can do for you!

@dosubot dosubot bot added the auto:improvement Medium size change to existing code to handle new use-cases label Nov 23, 2023
@gramliu
Copy link
Contributor Author

gramliu commented Nov 23, 2023

This could likely be handled well by creating a _generateCached counterpart to the _generateUncached callbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:improvement Medium size change to existing code to handle new use-cases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant