1. Go to this page and download the library: Download mathsgod/sense-nova-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mathsgod / sense-nova-client example snippets
use SenseNovo\Client;
$client = new Client('your_access_key', 'your_secret_key');
print_r($client->chatCompletions()->create([
"model" => "SenseChat-5",
"messages"=>[
[
"role"=>"user",
"content"=>"Hello, how are you?"
]
]
]));
use SenseNova\ChatCompletions\Attributes\Parameter;
use SenseNova\ChatCompletions\Attributes\Tool;
class MyTool
{
public $price = "$799";
#[Tool(description: 'Get the price of iphone')]
public function getIPhonePrice(#[Parameter("model of the phone")] string $model)
{
return ["price" => $this->price, "model" => $model];
}
#[Tool(description: 'Get the release date of iphone')]
public function getIPhoneReleaseDate(#[Parameter("model of the phone")] string $model)
{
return ["date" => "2023-01-01", "model" => $model];
}
}