mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
feat(embeddings): add OpenRouter support (#6396)
* feat(knowledge): add OpenRouter embedding fallback * fix(knowledge): preserve successful embedding batches * feat(embeddings): add OpenRouter provider * fix(knowledge): bill only platform embedding tokens * test(embeddings): include OpenRouter provider * feat(embeddings): load OpenRouter model catalog * fix(embeddings): preserve legacy provider default * fix(embeddings): batch OpenRouter requests * fix(embeddings): reset stale OpenRouter model
This commit is contained in:
@@ -25,7 +25,7 @@ Sim's knowledge bases embed separately, at a fixed vector width and from a small
|
||||
|
||||
## Usage Instructions
|
||||
|
||||
Turn text into embedding vectors for semantic search, clustering, and similarity. Supports OpenAI, Google Gemini, Cohere, and Mistral embedding models.
|
||||
Turn text into embedding vectors for semantic search, clustering, and similarity. Supports OpenAI, OpenRouter, Google Gemini, Cohere, and Mistral embedding models.
|
||||
|
||||
|
||||
|
||||
@@ -55,6 +55,30 @@ Generate embeddings from text using OpenAI's embedding models
|
||||
| `dimensions` | number | Dimensionality of each vector |
|
||||
| `usage` | json | Token usage |
|
||||
|
||||
### OpenRouter Embeddings
|
||||
|
||||
Generate embeddings through OpenRouter
|
||||
|
||||
#### Input
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| --------- | ---- | -------- | ----------- |
|
||||
| `input` | string | Yes | Text to embed, or an array of texts to embed in one call |
|
||||
| `model` | string | No | Embedding model to use |
|
||||
| `taskType` | string | No | What the embedding is for, when the model supports task conditioning: document, query, similarity, classification, or clustering |
|
||||
| `dimensions` | number | No | Output dimensions, when the model supports truncation. Defaults to native. |
|
||||
| `apiKey` | string | Yes | API key for the selected embedding provider |
|
||||
|
||||
#### Output
|
||||
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ---- | ----------- |
|
||||
| `embeddings` | json | Generated embeddings |
|
||||
| `model` | string | Model used |
|
||||
| `provider` | string | Provider used |
|
||||
| `dimensions` | number | Dimensionality of each vector |
|
||||
| `usage` | json | Token usage |
|
||||
|
||||
### Gemini Embeddings
|
||||
|
||||
Generate embeddings from text using Google's Gemini embedding models
|
||||
|
||||
Reference in New Issue
Block a user