#API Function calling, make it goal oriented.

9 messages · Page 1 of 1 (latest)

tribal python
#

Hi community:) I am looking for help from someone mastering the ‘function calling’ api.
I am trying to implement a simple task, but what I see is that it's not so simple for AI or I do something wrong.

In my scenario I have text which describes a car.
I want chat to populate all required fields for model

role = "user",
content = "Please extract data from this text: SOMETEXT…"
var functions = new List<object>
{
    new
    {
        name = "get_сar_details",
        description = "Extract possible properties from text.",
        parameters = new
        {
            type = "object",
            properties = new
            {
                brand = new
                {
                    type = "string",
                    description = "Brand name, eg. Audi, BMW, keep empty if no corresponding text"
                },
                model = new
                {
                    type = "string",
                    description = "Model name, eg. A4, A5, G63, keep empty if no corresponding text"
                },
                //.... more properties ProductionYear, Transmittion...
            },
            required = new { "brand", "model" }
        }
    }
};

Everything is simple and the response is correct, until I send bigger text, with a bigger properties model.

After I have added 20 properties, the required attribute becomes redundant, because chat populates randomly only a few of them, each time different.
Is it possible to explain chat that those properties are required to populate or keep empty, but finish this task with all properties?

This code was done in c# but I will be thankful with any help on any language.

violet verge
#

@tribal python I’m not sure exactly if this will work, but I have had success treating function descriptions as a prompt. Telling gpt that the function does x and y is cool, but also saying “give it as much detail as possible” in some form of prompt engineering may help your case.

tribal python
spring cedar
#

It's too inconsistent. I've seen this too, so I just wrote code to add defaults for any missing parameters after the GPT call.

tribal python
spring cedar
oak lava
tribal python
tribal python