-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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: function argument parsing using named regex #4700
Conversation
✅ Deploy Preview for localai ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Signed-off-by: Maximilian Kenfenheuer <[email protected]>
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, thanks!
It would be nice, if you feel like it, also to update the llama3.2 templates in the gallery so everyone will benefit.
In any case, I see just small golang nits here and there but nothing blocking. Thank you!
@@ -322,3 +329,39 @@ func ParseFunctionCall(llmresult string, functionConfig FunctionsConfig) []FuncC | |||
|
|||
return results | |||
} | |||
|
|||
func ParseFunctionCallArgs(functionArguments string, functionConfig FunctionsConfig) string { | |||
if len(functionConfig.ArgumentRegex) > 0 { |
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.
A small nit here - instead of branching I would propose something the lines of:
if len(functionConfig.ArgumentRegex) == 0 {
return functionArguments
}
// Here the logic to handle argument regexes
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.
A small nit here - instead of branching I would propose something the lines of:
if len(functionConfig.ArgumentRegex) == 0 { return functionArguments } // Here the logic to handle argument regexes
That's a good point!
I'll open another PR to change that, as well as for the templates in the gallery.
Welcome! |
Signed-off-by: Maximilian Kenfenheuer <[email protected]>
Signed-off-by: Maximilian Kenfenheuer <[email protected]>
Description
This PR fixes #4671
I've added a function to parse function call arguments using named regex into valid json, in case the model is trained on non json argument / function calling.
Notes for Reviewers
Example model configuration can be found here
Signed commits