-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (29 loc) · 982 Bytes
/
Program.cs
File metadata and controls
32 lines (29 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using UndreamAI.LlamaLib;
namespace LlamaLibExamples
{
class Program
{
static string previousText = "";
static void StreamingCallback(string text)
{
Console.Write(text.Substring(previousText.Length));
previousText = text;
}
static void Main(string[] args)
{
LLMService llmService = new LLMService("model.gguf", embeddingOnly:true);
llmService.Start();
Console.WriteLine("\n----------------------- embeddings -----------------------");
List<float> embeddings = llmService.Embeddings("this is the text I want to embed");
Console.Write("embeddings: ");
int maxCount = Math.Min(embeddings.Count, 10);
for (int i = 0; i < maxCount; i++)
{
Console.Write($"{embeddings[i]} ");
}
Console.WriteLine("...");
}
}
}