Skip to content
BAAI logo

bge-m3

Text EmbeddingsBAAIHosted

Multi-Functionality, Multi-Linguality, and Multi-Granularity embeddings model.

Model Info
Context Window60,000 tokens
Unit Pricing$0.012 per M input tokens

Usage

export interface Env {
AI: Ai;
}
export default {
async fetch(request, env): Promise<Response> {
// Can be a string or array of strings]
const stories = [
"This is a story about an orange cloud",
"This is a story about a llama",
"This is a story about a hugging emoji",
];
const embeddings = await env.AI.run(
"@cf/baai/bge-m3",
{
text: stories,
}
);
return Response.json(embeddings);
},
} satisfies ExportedHandler<Env>;

Parameters

Synchronous — Send a request and receive a complete response
query
stringminLength: 1A query you wish to perform against the provided contexts. If no query is provided the model with respond with embeddings for contexts
truncate_inputs
booleandefault: falseWhen provided with too long context should the model error out or truncate the context to fit?
Batch — Send multiple requests in a single API call

API Schemas (Raw)

Synchronous Input
Synchronous Output
Batch Input
Batch Output