lingoose
lingoose copied to clipboard
Add functions setter for LLMs
I have a specific case where I'm modifying the functions' description, mostly enum options, at run time. The issue is that the current struct-based approach makes it too difficult.
The solution is having a SetFunctions method for the LLM, so we can create our own function's schema. This two lines of code will save a lot of pain:
// File: llm/openai/function.go
// SetFunctions is a setter the functions list
func (o *OpenAI) SetFunctions(funcs map[string]Function) { o.functions = funcs }
I have tried to bypass the function binding tool by using the invopop/jsonschema custom types support, but it doesn't work due to how LinGoose and OpenAI SDK handle serialization.
The proposed changes are addressed in this PR.
Sounds good to me, left a comment on the PR