-
Notifications
You must be signed in to change notification settings - Fork 28
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
fix: flatten core model params #168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but we'll have to duplicate the effort in other SDKs (TypeScript), so proposing inlining into the plugin server too!
@@ -29,6 +29,35 @@ def get_model_params(kwargs: Dict[str, Any]) -> Dict[str, Any]: | |||
return model_params | |||
|
|||
|
|||
def extract_core_model_params(kwargs: Dict[str, Any], provider: str) -> Dict[str, Any]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this in the plugin server, so that we only have to update one place to cover all SDKs!
Extracts core model parameters from the kwargs dictionary. | ||
""" | ||
output = {} | ||
if provider == "anthropic": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To track AI cost processing's case-insensitive behavior:
if provider == "anthropic": | |
if provider: | |
provider = provider.lower() | |
if provider == "anthropic": |
if "max_completion_tokens" in kwargs: | ||
output["$ai_max_tokens"] = kwargs.get("max_completion_tokens") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might also be clearest to standardize on max_completion_tokens
(though hard to say if other providers releasing reasoning models will follow this naming)
Extract core values from model params.