Skip to content

Commit 318482e

Browse files
committed
feat: adds embeddings support for parasail
1 parent 341ae96 commit 318482e

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

core/providers/parasail/parasail.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,23 @@ func (provider *ParasailProvider) ResponsesStream(ctx *schemas.BifrostContext, p
164164
)
165165
}
166166

167-
// Embedding is not supported by the Parasail provider.
167+
// Embedding performs an embedding request to the Parasail API.
168+
// Uses Parasail's OpenAI-compatible embeddings endpoint.
168169
func (provider *ParasailProvider) Embedding(ctx *schemas.BifrostContext, key schemas.Key, request *schemas.BifrostEmbeddingRequest) (*schemas.BifrostEmbeddingResponse, *schemas.BifrostError) {
169-
return nil, providerUtils.NewUnsupportedOperationError(schemas.EmbeddingRequest, provider.GetProviderKey())
170+
return openai.HandleOpenAIEmbeddingRequest(
171+
ctx,
172+
provider.client,
173+
provider.networkConfig.BaseURL+providerUtils.GetPathFromContext(ctx, "/v1/embeddings"),
174+
request,
175+
openai.BearerAuthHeader(key),
176+
provider.networkConfig.ExtraHeaders,
177+
provider.GetProviderKey(),
178+
providerUtils.ShouldSendBackRawRequest(ctx, provider.sendBackRawRequest),
179+
providerUtils.ShouldSendBackRawResponse(ctx, provider.sendBackRawResponse),
180+
nil,
181+
nil,
182+
provider.logger,
183+
)
170184
}
171185

172186
// Speech is not supported by the Parasail provider.

core/providers/parasail/parasail_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestParasail(t *testing.T) {
2727
Provider: schemas.Parasail,
2828
ChatModel: "parasail-llama-33-70b-fp8",
2929
TextModel: "", // Parasail doesn't support text completion
30-
EmbeddingModel: "", // Parasail doesn't support embedding
30+
EmbeddingModel: "parasail-bge-m3",
3131
Scenarios: llmtests.TestScenarios{
3232
TextCompletion: false, // Not supported
3333
SimpleChat: true,
@@ -42,7 +42,7 @@ func TestParasail(t *testing.T) {
4242
ImageBase64: false, // Not supported yet
4343
MultipleImages: false, // Not supported yet
4444
CompleteEnd2End: true,
45-
Embedding: false, // Not supported yet
45+
Embedding: true,
4646
ListModels: true,
4747
},
4848
}

docs/providers/supported-providers/overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The following table summarizes which operations are supported by each provider v
3535
| Ollama (`ollama/<model>`) ||||||||||||||||||||||||||||
3636
| OpenAI (`openai/<model>`) ||||||||||||||||||||||||||||
3737
| OpenRouter (`openrouter/<model>`) ||||||||||||||||||||||||||||
38-
| Parasail (`parasail/<model>`) ||||||||||||| |||||||||||||||
38+
| Parasail (`parasail/<model>`) ||||||||||||| |||||||||||||||
3939
| Perplexity (`perplexity/<model>`) ||||||||||||||||||||||||||||
4040
| Replicate (`replicate/<model>`) ||||||||||||||||||||||||||||
4141
| Runware (`runware/<model>`) ||||||||||||||||||||||||||||

docs/providers/supported-providers/parasail.mdx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ Parasail is an **OpenAI-compatible provider** offering high-performance inferenc
2020
| Chat Completions ||| `/v1/chat/completions` |
2121
| Responses API ||| `/v1/chat/completions` |
2222
| List Models || - | `/v1/models` |
23+
| Embeddings || - | `/v1/embeddings` |
2324
| Text Completions ||| - |
24-
| Embeddings ||| - |
2525
| Image Generation ||| - |
2626
| Speech (TTS) ||| - |
2727
| Transcriptions (STT) ||| - |
2828
| Files ||| - |
2929
| Batch ||| - |
3030

3131
<Note>
32-
**Unsupported Operations** (❌): Text Completions, Embeddings, Image Generation, Speech, Transcriptions, Files, and Batch are not supported by the upstream Parasail API. These return `UnsupportedOperationError`.
32+
**Unsupported Operations** (❌): Text Completions, Image Generation, Speech, Transcriptions, Files, and Batch are not supported by the upstream Parasail API. These return `UnsupportedOperationError`.
3333
</Note>
3434

3535
## Setup & Configuration
@@ -139,12 +139,19 @@ Lists available Parasail models with capabilities and context information.
139139

140140
---
141141

142+
# 4. Embeddings
143+
144+
Parasail's OpenAI-compatible `/v1/embeddings` endpoint, used through the standard embeddings interface. Accepts a single string or an array of strings, and `encoding_format` of `float` or `base64`.
145+
146+
Embedding models are addressed either by Parasail's own ID or by the underlying HuggingFace ID, for example `parasail-bge-m3` or `BAAI/bge-m3`. Which ones your key can reach comes from `/v1/models`.
147+
148+
---
149+
142150
## Unsupported Features
143151

144152
| Feature | Reason |
145153
|---------|--------|
146154
| Text Completions | Not offered by Parasail API |
147-
| Embedding | Not offered by Parasail API |
148155
| Image Generation | Not offered by Parasail API |
149156
| Speech/TTS | Not offered by Parasail API |
150157
| Transcription/STT | Not offered by Parasail API |

0 commit comments

Comments
 (0)