Skip to content

Commit

Permalink
feat: add together.ai support (songquanpeng#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
songquanpeng committed Apr 29, 2024
1 parent 1f76c80 commit 71f4403
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ _✨ 通过标准的 OpenAI API 格式访问所有的大模型,开箱即用
+ [x] [DeepSeek](https://www.deepseek.com/)
+ [x] [Cloudflare Workers AI](https://developers.cloudflare.com/workers-ai/)
+ [x] [DeepL](https://www.deepl.com/)
+ [x] [together.ai](https://www.together.ai/)
2. 支持配置镜像以及众多[第三方代理服务](https://iamazing.cn/page/openai-api-third-party-services)
3. 支持通过**负载均衡**的方式访问多个渠道。
4. 支持 **stream 模式**,可以通过流式传输实现打字机效果。
Expand Down
4 changes: 4 additions & 0 deletions relay/adaptor/openai/compatible.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/songquanpeng/one-api/relay/adaptor/mistral"
"github.com/songquanpeng/one-api/relay/adaptor/moonshot"
"github.com/songquanpeng/one-api/relay/adaptor/stepfun"
"github.com/songquanpeng/one-api/relay/adaptor/togetherai"
"github.com/songquanpeng/one-api/relay/channeltype"
)

Expand All @@ -24,6 +25,7 @@ var CompatibleChannels = []int{
channeltype.LingYiWanWu,
channeltype.StepFun,
channeltype.DeepSeek,
channeltype.TogetherAI,
}

func GetCompatibleChannelMeta(channelType int) (string, []string) {
Expand All @@ -48,6 +50,8 @@ func GetCompatibleChannelMeta(channelType int) (string, []string) {
return "stepfun", stepfun.ModelList
case channeltype.DeepSeek:
return "deepseek", deepseek.ModelList
case channeltype.TogetherAI:
return "together.ai", togetherai.ModelList
default:
return "openai", ModelList
}
Expand Down
10 changes: 10 additions & 0 deletions relay/adaptor/togetherai/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package togetherai

// https://docs.together.ai/docs/inference-models

var ModelList = []string{
"meta-llama/Llama-3-70b-chat-hf",
"deepseek-ai/deepseek-coder-33b-instruct",
"mistralai/Mixtral-8x22B-Instruct-v0.1",
"Qwen/Qwen1.5-72B-Chat",
}
1 change: 1 addition & 0 deletions relay/channeltype/define.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
DeepSeek
Cloudflare
DeepL
TogetherAI

Dummy
)
1 change: 1 addition & 0 deletions relay/channeltype/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var ChannelBaseURLs = []string{
"https://api.deepseek.com", // 36
"https://api.cloudflare.com", // 37
"https://api-free.deepl.com", // 38
"https://api.together.xyz", // 39
}

func init() {
Expand Down
6 changes: 6 additions & 0 deletions web/berry/src/constants/ChannelConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ export const CHANNEL_OPTIONS = {
value: 38,
color: 'primary'
},
39: {
key: 39,
text: 'together.ai',
value: 39,
color: 'primary'
},
8: {
key: 8,
text: '自定义渠道',
Expand Down
1 change: 1 addition & 0 deletions web/default/src/constants/channel.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const CHANNEL_OPTIONS = [
{key: 36, text: 'DeepSeek', value: 36, color: 'black'},
{key: 37, text: 'Cloudflare', value: 37, color: 'orange'},
{key: 38, text: 'DeepL', value: 38, color: 'black'},
{key: 39, text: 'together.ai', value: 39, color: 'blue'},
{key: 8, text: '自定义渠道', value: 8, color: 'pink'},
{key: 22, text: '知识库:FastGPT', value: 22, color: 'blue'},
{key: 21, text: '知识库:AI Proxy', value: 21, color: 'purple'},
Expand Down

0 comments on commit 71f4403

Please sign in to comment.