asimplevectors.Client 0.2.1.1

dotnet add package asimplevectors.Client --version 0.2.1.1
                    
NuGet\Install-Package asimplevectors.Client -Version 0.2.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="asimplevectors.Client" Version="0.2.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="asimplevectors.Client" Version="0.2.1.1" />
                    
Directory.Packages.props
<PackageReference Include="asimplevectors.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add asimplevectors.Client --version 0.2.1.1
                    
#r "nuget: asimplevectors.Client, 0.2.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package asimplevectors.Client@0.2.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=asimplevectors.Client&version=0.2.1.1
                    
Install as a Cake Addin
#tool nuget:?package=asimplevectors.Client&version=0.2.1.1
                    
Install as a Cake Tool

asimplevectors Client Library (C#)

asimplevectors is a high-performance vector database optimized for retrieval-augmented generation (RAG) vector database. asimplevectors Client is a C# library designed to interact with the asimplevectors service. It provides a fully asynchronous API for managing vector spaces, performing searches, handling snapshots, and applying RBAC-based security.

Features

  • Space Management: Create, update, delete, and list spaces with configurable settings.
  • Versioning: Manage versions within spaces, including creating, updating, and retrieving specific versions.
  • Vector Operations: Upsert, retrieve, and search vectors with support for metadata.
  • RBAC Security: Manage tokens for role-based access control (RBAC).
  • Snapshot Management: Create and manage snapshots of spaces.
  • Async Support: Fully asynchronous API for modern, high-performance applications.
  • Rerank Capability: Provides reranking of initial search results using advanced scoring techniques like BM25. This feature ensures highly relevant results for document retrieval use cases.

Installation

Add the asimplevectors.Client package to your project using NuGet:

dotnet add package asimplevectors.Client

Requirements

Usage

Initialization

using asimplevectors.Services;

// Initialize the client
var client = new asimplevectorsClient("http://localhost:21001");

// Example API call
var spaces = await client.ListSpacesAsync();
Console.WriteLine(spaces);

Example: Space Management

using asimplevectors.Models;
using asimplevectors.Services;

var client = new asimplevectorsClient("http://localhost:21001");

// Create a space
var createSpaceData = new SpaceRequest
{
    Name = "spacename",
    Dimension = 128,
    Metric = "L2"
};
await client.CreateSpaceAsync(createSpaceData);
Console.WriteLine("Space created successfully.");

// List spaces
var spaces = await client.ListSpacesAsync();
Console.WriteLine("Available spaces: " + spaces);

Example: Vector Operations

using asimplevectors.Models;
using asimplevectors.Services;

var client = new asimplevectorsClient("http://localhost:21001");

// Upsert vectors
var vectorData = new VectorRequest
{
    Vectors = new[]
    {
        new VectorData
        {
            Id = 1,
            Data = new float[] { 0.1f, 0.2f, 0.3f, 0.4f },
            Metadata = new Dictionary<string, object> { { "label", "first" } }
        }
    }
};
await client.CreateVectorAsync("spacename", vectorData);
Console.WriteLine("Vector upserted successfully.");

// Retrieve vectors by version
var vectors = await client.GetVectorsByVersionAsync("spacename", 0);
Console.WriteLine("Retrieved vectors: " + vectors);

Example: RBAC Token Management

using asimplevectors.Models;
using asimplevectors.Services;

var client = new asimplevectorsClient("http://localhost:21001");

// Create an RBAC token
var tokenData = new RbacTokenRequest
{
    UserId = 1,
    Space = 2,
    Vector = 2
};
var token = await client.CreateRbacTokenAsync(tokenData);
Console.WriteLine("Token created successfully: " + token);

// List RBAC tokens
var tokens = await client.ListRbacTokensAsync();
Console.WriteLine("Available tokens: " + tokens);

Development

Setting up the development environment

  1. Setup the asimplevectors server using Docker:

    docker pull billionvectors/asimplevectors:latest
    docker run -p 21001:21001 -p 21002:21002 billionvectors/asimplevectors:latest
    
  2. Clone the repository:

    git clone https://github.com/billionvectors/client_api.git
    cd client_api/csharp
    
  3. Run the examples:

    dotnet run --project example/example_space.csproj
    

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.2.1.1 170 1/7/2025
0.2.0.1 146 12/23/2024
0.1.1.1 173 12/14/2024
0.1.1 159 12/14/2024