-
-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
📑 [DEMO] This is a demo PR of how to add an OpenAI Compatible Provider #2804
Changes from 2 commits
ac15845
ee16af0
23ce792
a2dac14
2ea97f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function of this file is the server implementation called by 这个文件的作用是 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the server API KEY environment variable here, there are usually two: 在此处添加服务端 API KEY 环境变量,一般会有两个: |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Metadata of this provider 对应 provider 的 元信息 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { ModelProviderCard } from '@/types/llm'; | ||
|
||
// ref https://platform.stepfun.com/docs/llm/text | ||
const Stepfun: ModelProviderCard = { | ||
chatModels: [ | ||
{ | ||
enabled: true, | ||
id: 'step-1-256k', | ||
tokens: 32_768, | ||
}, | ||
{ | ||
enabled: true, | ||
id: 'step-1-128k', | ||
tokens: 32_768, | ||
}, | ||
{ | ||
enabled: true, | ||
id: 'step-1-32k', | ||
tokens: 32_768, | ||
}, | ||
{ | ||
enabled: true, | ||
id: 'step-1v-32k', | ||
tokens: 32_768, | ||
vision: true, | ||
}, | ||
{ | ||
id: 'step-1-8k', | ||
tokens: 8192, | ||
}, | ||
], | ||
checkModel: 'step-1-8k', | ||
id: 'stepfun', | ||
modelList: { showModelFetcher: true }, | ||
name: '阶跃星辰', | ||
}; | ||
|
||
export default Stepfun; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. llm The default value of the configuration, llm 配置的默认值, |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. The runtime implementation of this model provider. For OpenAI compatible providers, we provide the 该模型 provider 的运行时实现,针对 OpenAI 兼容的 provider,我们提供了 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { ModelProvider } from '../types'; | ||
import { LobeOpenAICompatibleFactory } from '../utils/openaiCompatibleFactory'; | ||
|
||
export const LobeStepfunAI = LobeOpenAICompatibleFactory({ | ||
baseURL: 'https://api.stepfun.com/v1', | ||
debug: { | ||
chatCompletion: () => process.env.DEBUG_STEPFUN_CHAT_COMPLETION === '1', | ||
}, | ||
provider: ModelProvider.Stepfun, | ||
}); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add the model identifier, this ModelProvider is all provider types we support. 添加模型标识符,这个 ModelProvider 是我们所支持的所有 provider 类型。 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the module where the server-side configuration is sent to the front-end. When the user configures the API key of the Provider in the env, it is natural to hope that the provider is open by default. Therefore, the status needs to be sent from the server to the client 此处是服务端配置发送到前端的模块,当用户在 env 中配置了 Provider 的 API key,自然希望该 provider 是默认打开的状态。因此需要把该状态从 server 发给 client。 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Add the configuration information of Provider Config in this file. After adding it, it can be displayed in the configuration list.
在这个文件中添加 Provider Config 的配置信息,添加后就可以显示在配置列表中。