-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AzureOpenAI and Skylark support stream ChatCompletion #2
base: master
Are you sure you want to change the base?
Conversation
微软OpenAI 和 豆包 支持视觉 |
{ | ||
$buffer = ''; | ||
while (! $stream->eof()) { | ||
if ('' === ($byte = $stream->read(1))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这代码性能爆炸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不影响大局,暂时先这样吧
@@ -54,7 +54,7 @@ public function chat( | |||
array $tools = [], | |||
bool $stream = false, | |||
): ChatCompletionResponse { | |||
$deploymentPath = $this->buildDeploymentPath($model); | |||
$deploymentPath = $this->buildDeploymentPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥所有 $model 传参都去掉了?这样会让这个类在 DI 单例的情况下只能支持一种 Model
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为下面的那个
protected function buildDeploymentPath(): string
{
return 'openai/deployments/' . $this->config->getDeploymentName();
}
中的 $this->config->getDeploymentName()
已经不提供入参了,语法检测会提示让我去掉
对于 AzureOpenAI 来说,传入一种配置,其实也就只能访问一个模型,因为 url 里面会有模型名,这里传入不同的 model 其实是无影响的,AzureOpenAI 的接口没有使用该参数
|
||
protected bool $debug = false; | ||
|
||
protected string $model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
理论上应该想办法去掉这个 $this->model 才对
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对,其实这个 model 没啥用,里面的 $clients 其实也只会有一个值
Skylark 应该直接废弃掉,讲道理现在火山的模型名字不叫做云雀了,应该统一叫豆包(Doubao) |
微软OpenAI 和 豆包 支持流式响应