I have a really hard time understanding the documentation for the Assistants, API, what am I missing?
https://platform.openai.com/docs/assistants/tools/function-calling
assistant = client.beta.assistants.create(
instructions="You are a weather bot. Use the provided functions to answer questions.",
model="gpt-4-turbo-preview",
tools=[{
"type": "function",
"function": {
"name": "getCurrentWeather",
"description": "Get the weather in location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state e.g. San Francisco, CA"},
"unit": {"type": "string", "enum": ["c", "f"]}
},
"required": ["location"]
}
}
}, {
"type": "function",
"function": {
"name": "getNickname",
"description": "Get the nickname of a city",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "The city and state e.g. San Francisco, CA"},
},
"required": ["location"]
}
}
}]
)
- I have built several custom gpts, which has access to API’s that I’ve built, I understand that this the schema for defining functions are similar to that of an openapi schema.
But what I dont understand is, is the schema definition provided in the example for actual python code or is it referring to an external api?
It doesn’t make sense in my head that this will refer to python functions for example, what am I missing here?
Where and what is the parameter for defining where said functions are stored?
Is the function definition for REST api calls?
Is it for python functions that I have created and stored on some server or locally? (That doesn’t make sense, I mean, how would it even have access to those functions to begin with if they aren’t exposed through an HTTP endpoint, SSH or some other network protocol, and if that were the case what parameter indicates how I would even expose the Assistant to said hypothetical functions?)
I mean yeah, okay, I get it that you are supposed to define the functions here? But okay, where do the functions come from ? How do I give the assistant access to functions that I have created?
Is this for defining instructions on how to interact with an api? And if so, WHERE IS THE PARAMETER FOR PUTTING THE ACTUAL HTTP endpoint?
This documentation raises to many questions.
OpenAi: Be better and make a clearer documentation