-
Notifications
You must be signed in to change notification settings - Fork 875
Expand file tree
/
Copy pathIngestedChunk.cs
More file actions
47 lines (40 loc) · 1.66 KB
/
Copy pathIngestedChunk.cs
File metadata and controls
47 lines (40 loc) · 1.66 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Text.Json.Serialization;
using Microsoft.Extensions.VectorData;
namespace AIChatWeb_CSharp.Web.Services;
public class IngestedChunk
{
#if (IsOllama)
public const int VectorDimensions = 384; // 384 is the default vector size for the all-minilm embedding model
#elif (IsFoundryLocal)
public const int VectorDimensions = 1024; // 1024 is the default vector size for the qwen3-embedding-0.6b embedding model
#else
public const int VectorDimensions = 1536; // 1536 is the default vector size for the OpenAI text-embedding-3-small model
#endif
#if (IsAzureAISearch || IsQdrant)
public const string VectorDistanceFunction = DistanceFunction.CosineSimilarity;
#else
public const string VectorDistanceFunction = DistanceFunction.CosineDistance;
#endif
public const string CollectionName = "data-AIChatWeb-CSharp.Web-chunks";
#if (IsQdrant)
[VectorStoreKey(StorageName = "key")]
[JsonPropertyName("key")]
public required Guid Key { get; set; }
#else
[VectorStoreKey(StorageName = "key")]
[JsonPropertyName("key")]
public required string Key { get; set; }
#endif
[VectorStoreData(StorageName = "documentid")]
[JsonPropertyName("documentid")]
public required string DocumentId { get; set; }
[VectorStoreData(StorageName = "content")]
[JsonPropertyName("content")]
public required string Text { get; set; }
[VectorStoreData(StorageName = "context")]
[JsonPropertyName("context")]
public string? Context { get; set; }
[VectorStoreVector(VectorDimensions, DistanceFunction = VectorDistanceFunction, StorageName = "embedding")]
[JsonPropertyName("embedding")]
public string? Vector => Text;
}