Can you please add more context to your question (including a concrete example)?
Here are some general thoughts:
Notice the api now supports parallel function calling which sounds like can be useful for your use-case (not sure if you’re already using it).
It can sometimes be helpful to give some general instructions to the model in the system message (possibly directly addressing the issue you’re encountering).
class GetInfo(BaseModel):
company_name: str = Field(..., description='Name of the company of this page')
brands: List[str] = Field(..., description='list of brands of this company?')
class Config:
name = 'extract_info'
description = 'Get information about companies from text'
class GetInfoV2(BaseModel):
company_name: str = Field(..., description='Name of the company of this page')
brands: List[str] = Field(..., description='list of brands of this company?')
products: List[str] = Field(..., description='what products this company sells?')
class Config:
name = 'extract_info'
description = 'Get information about companies from text'
GetInfo returns the exact data I need.
GetInfoV2 returns empty data for brands and products.
I have the same input, Don’t understand why adding a field reduce model performance
This kind of issues heavily depend on the context so imho this potentially seems like a different problem.
In your case, I think it’s not completely clear what the function is intended to do- I can see Get information about companies from text, but where is the text input for it? What do the brands and products mean in this context?
I think it might be possible that you’re using function calling incorrectly- to structure an expected output of a task, instead of calling a different api to do it, which is what function calling does. (sorry in advance if I misunderstood something!)
If you can provide more concrete example (of an input, expected output, and potentially the eventual expected output of the function call itself) it can be helpful to look further into this.
Anyway, if the above assumption is correct I would actually try to convert that function calling to a system message describing the task and its expected eventual output schema, along with ‘JSON mode’ on.
Something like:
From the following provided text extract the information about the discussed company, and return a json object with the following attributes:
'company_name': Name of the company
'brands': array of brands of this company
'products': array of products this company sells