mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-21 11:04:59 +00:00
feat(tools): support Tool calls in the API (#1715)
* feat(tools): support Tools in the API Co-authored-by: =?UTF-8?q?Stephan=20A=C3=9Fmus?= <stephan.assmus@sap.com> * feat(tools): support function streaming * Adhere to new return types when using tools instead of functions * Keep backward compatibility with function calling * Evaluate function names in chat templates * Disable recovery with --debug * Correctly stream out the entire result * Detect when llm chooses to reply and to not perform any action in SSE * Feedback from code review --------- Co-authored-by: =?UTF-8?q?Stephan=20A=C3=9Fmus?= <stephan.assmus@sap.com>
This commit is contained in:
parent
6b539a2972
commit
c72808f18b
6 changed files with 287 additions and 93 deletions
|
@ -11,6 +11,12 @@ type Function struct {
|
|||
}
|
||||
type Functions []Function
|
||||
|
||||
type Tool struct {
|
||||
Type string `json:"type"`
|
||||
Function Function `json:"function,omitempty"`
|
||||
}
|
||||
type Tools []Tool
|
||||
|
||||
func (f Functions) ToJSONStructure() JSONFunctionStructure {
|
||||
js := JSONFunctionStructure{}
|
||||
for _, function := range f {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue