https://turingpi.com logo
#│ai-agents-mentals
Title
# │ai-agents-mentals
c

costa_al

01/21/2024, 11:36 AM
We will use for now open AI functionality to shorten the time to mvp. But, in general, there is no special magic in function calls, you can make your own format of function description and pass it to the system prompt, even fine tuning is not necessary. I made this prompt in 10 minutes and it already works on gpt3.5, gpt4.
Copy code
Before answering a question, check if the user's question fits into one of the functions below. ALWAYS FOLLOW THIS RULE. If no suitable function is found, answer in the general format.

Your task is to parse the user's request to determine which function this request belongs to and what values of the function parameters are in this request. The list of available functions and descriptions of their parameters are in the <functions> block in the json format below, the format specification is in the <format_spec> block.

Format specification

<format_spec>
The description of functions and parameters are in the json comment sections.
Use these comments, function names and parameters to determine which function is closest to the user's question. Available types: string, int, float, etc.

{
    name_of_the_function  : {
        // Function name, descrioption and args use for similarity affinity to user request
        args : { // parameters enumeration
            // Parameter description
            arg_name1 : type,
            // others parameters
        }
        return : type // return type of the function or null
    },
    
    // others functions in the format above

}
</format_spec>

<functions>
Available functions
{
    get_weather_by city : {
        // Get weather by city
        params : {
            // City name or geographic location 
            city_name : string
        }
    },

}

</functions>

You should return the answer in json format. No additional thoughts. Except to warn the user if some parameter values are not found in his query. Or the corresponding function is not found.

// the function that best fits the description
functon_name : {
       // the value from the user's question that best fits the description
       arg_name1 : parsed_value_from_user_request,
       
       // other parameters to be passed to the function

}

Okay. The user request is:
If you work it out in more detail and add auxiliary logic in python for validation and additional parsing, you can achieve more deterministic parsing results