This commit is contained in:
17
docs/snippets/csharp/utils/standalone_embed.md
Normal file
17
docs/snippets/csharp/utils/standalone_embed.md
Normal file
@@ -0,0 +1,17 @@
|
||||
```csharp title="C#"
|
||||
using Kreuzberg;
|
||||
|
||||
var client = new KreuzbergLib();
|
||||
|
||||
var config = new EmbeddingConfig { Model = EmbeddingModelType.Preset("balanced"), Normalize = true };
|
||||
var texts = new[] { "Hello, world!", "Kreuzberg is fast" };
|
||||
|
||||
// Synchronous
|
||||
var embeddings = client.EmbedSync(texts, config).ToList();
|
||||
Console.WriteLine(embeddings.Count); // 2
|
||||
Console.WriteLine(embeddings[0].Length); // 768
|
||||
|
||||
// Asynchronous
|
||||
var asyncEmbeddings = await client.EmbedAsync(texts, config);
|
||||
Console.WriteLine(asyncEmbeddings.First().Length); // 768
|
||||
```
|
||||
Reference in New Issue
Block a user