CyberEye.CommonAi.Lib
3.0.34
dotnet add package CyberEye.CommonAi.Lib --version 3.0.34
NuGet\Install-Package CyberEye.CommonAi.Lib -Version 3.0.34
<PackageReference Include="CyberEye.CommonAi.Lib" Version="3.0.34" />
<PackageVersion Include="CyberEye.CommonAi.Lib" Version="3.0.34" />
<PackageReference Include="CyberEye.CommonAi.Lib" />
paket add CyberEye.CommonAi.Lib --version 3.0.34
#r "nuget: CyberEye.CommonAi.Lib, 3.0.34"
#:package CyberEye.CommonAi.Lib@3.0.34
#addin nuget:?package=CyberEye.CommonAi.Lib&version=3.0.34
#tool nuget:?package=CyberEye.CommonAi.Lib&version=3.0.34
CyberEye.CommonAi.Lib
Client Chat và Embedding qua HTTP OpenAI-compatible. Embedding có batching, loại bỏ đầu vào trùng, cache hai tầng và trạng thái Circuit Breaker.
Target framework: net8.0.
Cài đặt
dotnet add package CyberEye.CommonAi.Lib
Cần cấu hình NuGet feed của dự án và chọn phiên bản tương thích với các package CyberEye khác trong host.
Đăng ký và cấu hình
using Ce.CommonAi.Lib.StartupExtensions;
builder.Services.AddCommonAiServices(builder.Configuration);
{
"Ai": {
"Chat": { "Enabled": false },
"Embedding": {
"Enabled": true,
"Endpoint": "http://localhost:11434/v1",
"Model": "bge-m3",
"Dimensions": 1024,
"BatchSize": 32,
"Cache": { "Enabled": false }
}
}
}
Model phải tồn tại trên inference server; Dimensions phải phù hợp model và index. Khi chạy container, localhost là chính container đó.
Sử dụng
Inject Ce.CommonAi.Lib.Abstractions.IEmbeddingService, rồi gọi EmbedAsync(text, ct) hoặc EmbedManyAsync(texts, ct). Package không có IAiEmbeddingClient.
Tier1 dùng AsyncLocal theo luồng async; tier2 dùng IDistributedCache (memory hoặc Redis theo cấu hình). BatchSize chia danh sách đầu vào thành lô, không phải cam kết tự gom mọi request HTTP đồng thời.
IEmbeddingHealth phản ánh trạng thái Circuit Breaker. Consumer chọn cách fallback; package không tự đổi mọi truy vấn tìm kiếm thành BM25. Khi embedding tắt, NullEmbeddingService trả zero vector đúng số chiều.
Metrics collector thuộc Ce.Observability.Lib và phải được bật riêng.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- CyberEye.CommonCaching.Lib (>= 3.0.34)
- CyberEye.Configuration.Lib (>= 3.0.34)
- CyberEye.Constant.Lib (>= 3.0.34)
- Microsoft.Extensions.AI (>= 9.5.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Http.Resilience (>= 8.10.0)
- System.IO.Hashing (>= 8.0.0)
- Tokenizers.HuggingFace (>= 3.23.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.34 | 0 | 11/15/2026 |
| 3.0.33 | 0 | 11/15/2026 |
| 3.0.32 | 0 | 11/15/2026 |
| 3.0.31 | 37 | 11/15/2026 |
| 3.0.30 | 47 | 11/15/2026 |
| 3.0.29 | 49 | 11/13/2026 |
| 3.0.28 | 99 | 11/6/2026 |
| 3.0.27 | 151 | 9/17/2026 |
| 3.0.26 | 118 | 9/8/2026 |
| 3.0.25 | 134 | 8/22/2026 |
| 3.0.24 | 134 | 8/10/2026 |
| 3.0.23 | 130 | 8/9/2026 |
| 3.0.22 | 146 | 8/1/2026 |
| 3.0.21 | 134 | 7/28/2026 |
| 3.0.20 | 152 | 7/27/2026 |
| 3.0.19 | 139 | 7/27/2026 |
| 3.0.18 | 126 | 7/17/2026 |
| 3.0.17 | 131 | 7/13/2026 |
| 3.0.16 | 137 | 7/12/2026 |
| 3.0.15 | 131 | 7/10/2026 |