-
Notifications
You must be signed in to change notification settings - Fork 618
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
feat: deepseek r1 alternative tool calling format #975
Conversation
.and_then(|obj| obj.get_mut("messages")) | ||
.and_then(|messages| messages.as_array_mut()) | ||
{ | ||
// Add "cache_control" to the last and second-to-last "user" messages |
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.
cache_control is just for anthropic models
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.
yeah - it is conditional in some spots but not others, still messy code!
let effective_tools = if let Some(system_tools) = Self::extract_tools_from_system(system) { | ||
system_tools | ||
} else { | ||
tools.to_vec() | ||
}; |
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.
why do you need to parse tools from the system prompt if the tools get translated into strings in the system prompt below in create_request_based_on_model
?
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.
yeah that was left over code from earlier attempt
I think you need to parse the response into tool calls? |
trying a fresh take here: #1016 |
deepseek can be used (in many ways) from openrouter, so I am trying the largest ones with this.
I found that I can replace the tool calls with a system prompt and it works... a lot of the time. If this continues, could be a more general approach for models which don't support tool calling (use type of format).
cc @ahau-square for the idea