lingoose icon indicating copy to clipboard operation
lingoose copied to clipboard

Add functions setter for LLMs

Open pedro-a-n-moreira opened this issue 10 months ago • 1 comments

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.

pedro-a-n-moreira avatar Feb 21 '25 14:02 pedro-a-n-moreira

Sounds good to me, left a comment on the PR

henomis avatar Mar 07 '25 13:03 henomis