-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Not sure if I grasped the concept correctly, but I would say, and based on the links below:
that we can't define a tool function in PHP - a function that will be called in case of using tools
parameter.
As we can see from the links above, those functions could be defined using either TS or Python libs.
Relevant docs part:
$response = $client->chat()->create([
'model' => 'llama3.1',
'messages' => [
['role' => 'user', 'content' => 'What is the weather today in Paris?'],
],
'tools' => [
[
'type' => 'function',
'function' => [
'name' => 'get_current_weather',
'description' => 'Get the current weather',
'parameters' => [
'type' => 'object',
'properties' => [
'location' => [
'type' => 'string',
'description' => 'The location to get the weather for, e.g. San Francisco, CA',
],
'format' => [
'type' => 'string',
'description' => 'The location to get the weather for, e.g. San Francisco, CA',
'enum' => ['celsius', 'fahrenheit']
],
],
'required' => ['location', 'format'],
],
],
]
]
]);
$toolCall = $response->message->toolCalls[0];
$toolCall->function->name; // 'get_current_weather'
$toolCall->function->arguments; // ['location' => 'Paris', 'format' => 'celsius']
$response->toArray(); // ['model' => 'llama3.1', 'message' => ['role' => 'assistant', 'toolCalls' => [...]], ...]
Metadata
Metadata
Assignees
Labels
No labels