Files
ragflow/conf/models/togetherai.json

80 lines
1.4 KiB
JSON
Raw Normal View History

{
"name": "TogetherAI",
"url": {
"default": "https://api.together.ai/v1"
},
"url_suffix": {
"chat": "chat/completions",
Go: implement Embed (embeddings) in TogetherAI driver (#15017) ### What problem does this PR solve? Fixes #15015 The TogetherAI Go driver in `internal/entity/models/togetherai.go` shipped a stub `Embed` method that returned `"TogetherAI, no such method"`, so TogetherAI could not be used as an embedding provider in RAGFlow. This PR fills that gap. TogetherAI exposes a public OpenAI-compatible embeddings endpoint at `POST https://api.together.ai/v1/embeddings` that accepts the standard `{model, input}` shape with `Authorization: Bearer <api_key>` (confirmed in TogetherAI's official docs: https://docs.together.ai/docs/embeddings-overview). Documented embedding models include `intfloat/multilingual-e5-large-instruct`, `BAAI/bge-large-en-v1.5`, and `BAAI/bge-base-en-v1.5`. ### Changes - `internal/entity/models/togetherai.go`: implement `TogetherAIModel.Embed`. - Validate inputs (api key, model name) and short-circuit on empty texts. - Resolve region with the existing `baseURLForRegion` helper. - Build URL from `URLSuffix.Embedding`. - Send `{model, input}` POST body, add `dimensions` when `embeddingConfig.Dimension > 0` (matches the pattern in #14735). - Bearer auth + JSON content type, mirroring the chat path. - Parse `{data: [{embedding, index}]}` and reorder by `index`, rejecting out-of-range indices, duplicates, and missing entries so the output always lines up with the input. Same shape as the merged Mistral, Upstage, and Novita Embed implementations. - `conf/models/togetherai.json`: - Add `"embedding": "embeddings"` to `url_suffix`. - Add default embedding model entries for `intfloat/multilingual-e5-large-instruct`, `BAAI/bge-large-en-v1.5`, and `BAAI/bge-base-en-v1.5`. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
2026-05-20 08:48:44 -04:00
"models": "models",
"embedding": "embeddings",
"rerank": "rerank",
"asr": "audio/transcriptions",
"tts": "audio/speech"
},
"class": "together",
"models": [
{
"name": "openai/gpt-oss-20b",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"max_tokens": 131072,
"model_types": [
"chat"
]
},
{
"name": "Qwen/Qwen3-Coder-480B-A35B-Instruct-FP8",
"max_tokens": 262144,
"model_types": [
"chat"
]
Go: implement Embed (embeddings) in TogetherAI driver (#15017) ### What problem does this PR solve? Fixes #15015 The TogetherAI Go driver in `internal/entity/models/togetherai.go` shipped a stub `Embed` method that returned `"TogetherAI, no such method"`, so TogetherAI could not be used as an embedding provider in RAGFlow. This PR fills that gap. TogetherAI exposes a public OpenAI-compatible embeddings endpoint at `POST https://api.together.ai/v1/embeddings` that accepts the standard `{model, input}` shape with `Authorization: Bearer <api_key>` (confirmed in TogetherAI's official docs: https://docs.together.ai/docs/embeddings-overview). Documented embedding models include `intfloat/multilingual-e5-large-instruct`, `BAAI/bge-large-en-v1.5`, and `BAAI/bge-base-en-v1.5`. ### Changes - `internal/entity/models/togetherai.go`: implement `TogetherAIModel.Embed`. - Validate inputs (api key, model name) and short-circuit on empty texts. - Resolve region with the existing `baseURLForRegion` helper. - Build URL from `URLSuffix.Embedding`. - Send `{model, input}` POST body, add `dimensions` when `embeddingConfig.Dimension > 0` (matches the pattern in #14735). - Bearer auth + JSON content type, mirroring the chat path. - Parse `{data: [{embedding, index}]}` and reorder by `index`, rejecting out-of-range indices, duplicates, and missing entries so the output always lines up with the input. Same shape as the merged Mistral, Upstage, and Novita Embed implementations. - `conf/models/togetherai.json`: - Add `"embedding": "embeddings"` to `url_suffix`. - Add default embedding model entries for `intfloat/multilingual-e5-large-instruct`, `BAAI/bge-large-en-v1.5`, and `BAAI/bge-base-en-v1.5`. ### Type of change - [x] New Feature (non-breaking change which adds functionality)
2026-05-20 08:48:44 -04:00
},
{
"name": "intfloat/multilingual-e5-large-instruct",
"max_tokens": 514,
"model_types": [
"embedding"
]
},
{
"name": "BAAI/bge-large-en-v1.5",
"max_tokens": 512,
"model_types": [
"embedding"
]
},
{
"name": "BAAI/bge-base-en-v1.5",
"max_tokens": 512,
"model_types": [
"embedding"
]
},
{
"name": "mixedbread-ai/mxbai-rerank-large-v2",
"max_tokens": 16384,
"model_types": [
"rerank"
]
},
{
"name": "openai/whisper-large-v3",
"model_types": [
"asr"
]
},
{
"name": "canopylabs/orpheus-3b-0.1-ft",
"model_types": [
"tts"
]
}
]
}