langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

The problem with FunctionDefinition struct

Open ImPedro29 opened this issue 1 year ago • 1 comments

Problem

The structure of the FunctionDefinition still uses any type of parameter, the code is not as modular when it allows it. This creates a problem forcing the client to implement a function call interface for each provider. https://github.com/tmc/langchaingo/blob/03b74ec5c76370198108c00a64c36f33d10c9601/llms/options.go#L81

Context

I will need to implement this modularity for the application I am building and I am happy to leave this thing open source. I'm opening this issue because I'm not sure of the motivations for the code to be written this way.

Possible Solution 1

I believe we can have a fixed model for all llms, as in general, we want to achieve the same result. I don't really like this solution, but it should solve the problem in the short term.

Possible Solution 2

Another proposal would be to create an interface for the parameters where each llm will implement its own structure, the interface only guarantees that they all share mandatory methods, such as the name of the parameters

Let's discuss

ImPedro29 avatar Jun 10 '24 00:06 ImPedro29

Can you be a bit more specific in your proposed solution?

tmc avatar Jun 12 '24 17:06 tmc