🔒 You must be logged in as an Administrator or Editor to listen to this audio.
Since you already have bge-m3:latest downloaded in Ollama, you can consume it via the REST API or official client libraries. Since your file path (~/Code/DotNest-Core-SDK/...) suggests you are working in a .NET/C# environment, I will provide examples for both CLI/Shell and C#.
1. Test via CLI (cURL)
The quickest way to verify the model is working is by sending a POST request to Ollama's local endpoint.
curl http://localhost:11434/api/embed -d '{
"model": "bge-m3",
"input": "Llamas are members of the camelid family"
}'
- Response: You will receive a JSON object containing a large array of numbers (the vector).
- Note:
bge-m3is a high-performance model that supports a sequence length of up to 8192 tokens, making it great for long documents.
2. Consume in .NET (C#)
Since you are working on the DotNest-Core-SDK, you'll likely want to integrate this programmatically. The most popular library for this is OllamaSharp.
Install the package:
dotnet add package OllamaSharp
Basic Usage:
using OllamaSharp;
// Initialize the client
var uri = new Uri("http://localhost:11434");
var ollama = new OllamaApiClient(uri);
// Set the model you just listed
ollama.SelectedModel = "bge-m3";
// Generate an embedding for a string
var request = new EmbedRequest
{
Model = "bge-m3",
Input = "How do I use embeddings in my SDK?"
};
var response = await ollama.Embed(request);
// Access the vector
float[] vector = response.Embeddings[0];
Console.WriteLine($"Generated vector with {vector.Length} dimensions.");
3. Usage via Python (Alternative)
If you are doing data science or preprocessing scripts outside of your SDK:
Install the library:
pip install ollama
Script:
import ollama
response = ollama.embed(
model='bge-m3',
input='The sky is blue because of Rayleigh scattering.',
)
print(response['embeddings'])
Key Technical Details for bge-m3
- Dimensions: This model typically outputs vectors with 1024 dimensions.
- Multilingual:
bge-m3stands for Multi-functionality, Multi-linguality, and Multi-granularity. It works exceptionally well for non-English languages. - Context Window: Unlike standard models (like
all-MiniLM-L6-v2which caps at 256 or 512 tokens),bge-m3handles up to 8k tokens, allowing you to embed entire chapters or long technical docs at once.
Are you planning to store these embeddings in a specific vector database (like ChromaDB, Qdrant, or pgvector), or are you performing simple in-memory similarity comparisons?