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

Update map_finish_reason #7264

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Update map_finish_reason #7264

wants to merge 3 commits into from

Conversation

RyanMarten
Copy link

Title

Update mapping helper function that converts from api specific finish reasons to a standard set

Type

🧹 Refactoring
📖 Documentation

Changes

Documented the source
Made it clearer what the mappings are

Copy link

vercel bot commented Dec 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2024 3:40pm

@RyanMarten
Copy link
Author

@ishaan-jaff updated this function

"SPII": "content_filter",
}

return finish_reason_mapping.get(finish_reason, finish_reason)
Copy link
Contributor

Choose a reason for hiding this comment

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

would this return None if unmapped?

Copy link
Author

Choose a reason for hiding this comment

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

This returns the finish_reason if unmapped, just like the original definition.
The second value of get provides the default value if the key does not exist

@krrishdholakia

Copy link
Contributor

Choose a reason for hiding this comment

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

nice - can we add a unit test for this, maybe here -

from datetime import datetime

if you can share a screenshot of it passing, this pr should be good to merge!

Copy link
Author

Choose a reason for hiding this comment

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

@RyanMarten
Copy link
Author

@krrishdholakia Ready for merge :)

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