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

add log10 callback for litellm compeltion and examples #132

Merged
merged 3 commits into from
Apr 5, 2024

Conversation

wenzhe-log10
Copy link
Collaborator

@wenzhe-log10 wenzhe-log10 commented Apr 2, 2024

Use:

from log10.litellm import Log10LitellmLogger

log10_handler = Log10LitellmLogger() # can add tags with Log10LitellmLogger(tags=["foo", "bar"])
litellm.callbacks = [log10_handler]

screenshot of log from running example examples/logging/litellm_image.py
Screenshot 2024-04-02 at 3 42 03 PM

@wenzhe-log10 wenzhe-log10 force-pushed the wenzhe/litellm_callback branch 2 times, most recently from b1de251 to 366115d Compare April 2, 2024 23:47
@wenzhe-log10 wenzhe-log10 requested review from nqn and kxtran April 2, 2024 23:51
"content": [
{
"type": "image_url",
"image_url": {"url": f"data:{image_media_type};base64,{image_data}"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: think you can send urls, too. But no biggie

log10/litellm.py Outdated
self.log_end(run["completion_id"], response_obj.dict(), duration)

def log_failure_event(self, kwargs, response_obj, start_time, end_time):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be useful to hook this one up too and use the failure fields we have?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hooked up for log_failure_event and the async version of it.

@wenzhe-log10 wenzhe-log10 merged commit b0ee6b9 into main Apr 5, 2024
1 check passed
@wenzhe-log10 wenzhe-log10 deleted the wenzhe/litellm_callback branch April 5, 2024 18:43
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

Successfully merging this pull request may close these issues.

2 participants