Skip to content

Commit

Permalink
新增类 OpenAI 客户端
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Aug 10, 2024
1 parent 1103a00 commit 345943d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions server/Module/OpenAI/Client/LikeOpenAI/Client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace app\Module\OpenAI\Client\LikeOpenAI;

use app\Module\OpenAI\Client\Annotation\OpenAIClient;

/**
* 类 OpenAI 客户端,计算 Tokens 用字符串长度.
*/
#[
OpenAIClient(title: 'Like OpenAI'),
]
class Client extends \app\Module\OpenAI\Client\OpenAI\Client
{
public function calcTokens(string $string, string $model): int
{
return mb_strlen($string);
}
}

0 comments on commit 345943d

Please sign in to comment.