Vectorizer.Sdk 1.5.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Vectorizer.Sdk --version 1.5.1
                    
NuGet\Install-Package Vectorizer.Sdk -Version 1.5.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="Vectorizer.Sdk" Version="1.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Vectorizer.Sdk" Version="1.5.1" />
                    
Directory.Packages.props
<PackageReference Include="Vectorizer.Sdk" />
                    
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 Vectorizer.Sdk --version 1.5.1
                    
#r "nuget: Vectorizer.Sdk, 1.5.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 Vectorizer.Sdk@1.5.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=Vectorizer.Sdk&version=1.5.1
                    
Install as a Cake Addin
#tool nuget:?package=Vectorizer.Sdk&version=1.5.1
                    
Install as a Cake Tool

Vectorizer C# SDK

NuGet version License

High-performance C# SDK for Vectorizer vector database.

Package: Vectorizer.Sdk
Version: 1.5.1
NuGet: https://www.nuget.org/packages/Vectorizer.Sdk

Features

  • Async/Await Support: Full async/await support for high performance
  • .NET 8.0+: Modern C# with latest language features
  • Type Safety: Strong typing with comprehensive models
  • Collection Management: CRUD operations for collections
  • Vector Operations: Insert, search, update, delete vectors
  • Semantic Search: Text and vector similarity search
  • Intelligent Search: AI-powered search with query expansion, MMR diversification, and domain expansion
  • Semantic Search: Advanced semantic search with reranking and similarity thresholds
  • Contextual Search: Context-aware search with metadata filtering
  • Multi-Collection Search: Cross-collection search with intelligent aggregation
  • Hybrid Search: Combine dense and sparse vectors for improved search quality
  • Discovery Operations: Collection filtering, query expansion, and intelligent discovery
  • File Operations: File content retrieval, chunking, project outlines, and related files
  • Graph Relationships: Automatic relationship discovery, path finding, and edge management
  • Summarization: Text and context summarization with multiple methods
  • Workspace Management: Multi-workspace support for project organization
  • Backup & Restore: Collection backup and restore operations
  • Batch Operations: Efficient bulk insert, update, delete, and search
  • Qdrant Compatibility: Full Qdrant REST API compatibility for easy migration
  • Error Handling: Comprehensive exception handling
  • IDisposable: Proper resource management

Installation

dotnet add package Vectorizer.Sdk

# Or via NuGet Package Manager
Install-Package Vectorizer.Sdk

# Or specific version
dotnet add package Vectorizer.Sdk --version 1.5.1

Quick Start

using Vectorizer;
using Vectorizer.Models;

// Create client
var client = new VectorizerClient(new ClientConfig
{
    BaseUrl = "http://localhost:15002",
    ApiKey = "your-api-key"
});

try
{
    // Health check
    await client.HealthAsync();
    Console.WriteLine("✓ Server is healthy");

    // Create collection
    var collection = await client.CreateCollectionAsync(new CreateCollectionRequest
    {
        Name = "documents",
        Config = new CollectionConfig
        {
            Dimension = 384,
            Metric = DistanceMetric.Cosine
        }
    });
    Console.WriteLine($"✓ Created collection: {collection.Name}");

    // Insert text
    var result = await client.InsertTextAsync("documents", "Hello, world!", null);
    Console.WriteLine($"✓ Inserted vector ID: {result.Id}");

    // Search
    var results = await client.SearchTextAsync("documents", "hello", new SearchOptions
    {
        Limit = 10
    });
    Console.WriteLine($"✓ Found {results.Count} results");

    // Intelligent search
    var intelligentResults = await client.IntelligentSearchAsync(new IntelligentSearchRequest
    {
        Query = "machine learning algorithms",
        Collections = new List<string> { "documents" },
        MaxResults = 15,
        DomainExpansion = true,
        TechnicalFocus = true,
        MMREnabled = true,
        MMRLambda = 0.7
    });
    Console.WriteLine($"✓ Intelligent search found {intelligentResults.Count} results");

    // Graph Operations (requires graph enabled in collection config)
    // List all graph nodes
    var nodes = await client.ListGraphNodesAsync("documents");
    Console.WriteLine($"✓ Graph has {nodes.Count} nodes");

    // Get neighbors of a node
    var neighbors = await client.GetGraphNeighborsAsync("documents", "document1");
    Console.WriteLine($"✓ Node has {neighbors.Neighbors.Count} neighbors");

    // Find related nodes within 2 hops
    var related = await client.FindRelatedNodesAsync("documents", "document1", new FindRelatedRequest
    {
        MaxHops = 2,
        RelationshipType = "SIMILAR_TO"
    });
    Console.WriteLine($"✓ Found {related.Related.Count} related nodes");

    // Find shortest path between two nodes
    var path = await client.FindGraphPathAsync(new FindPathRequest
    {
        Collection = "documents",
        Source = "document1",
        Target = "document2"
    });
    if (path.Found)
    {
        Console.WriteLine($"✓ Path found: {string.Join(" -> ", path.Path.Select(n => n.Id))}");
    }

    // Create explicit relationship
    var edge = await client.CreateGraphEdgeAsync(new CreateEdgeRequest
    {
        Collection = "documents",
        Source = "document1",
        Target = "document2",
        RelationshipType = "REFERENCES",
        Weight = 0.9f
    });
    Console.WriteLine($"✓ Created edge: {edge.EdgeId}");

    // Semantic search
    var semanticResults = await client.SemanticSearchAsync(
        "documents",
        "neural networks",
        maxResults: 10,
        semanticReranking: true
    );
    Console.WriteLine($"✓ Semantic search found {semanticResults.Count} results");
}
catch (VectorizerException ex)
{
    Console.WriteLine($"Error: {ex.ErrorType} - {ex.Message}");
}
finally
{
    client.Dispose();
}

Configuration

Basic Configuration

var client = new VectorizerClient(new ClientConfig
{
    BaseUrl = "http://localhost:15002",
    ApiKey = "your-api-key",
    TimeoutSeconds = 30
});

Custom HTTP Client

var httpClient = new HttpClient
{
    Timeout = TimeSpan.FromSeconds(60)
};

var client = new VectorizerClient(new ClientConfig
{
    BaseUrl = "http://localhost:15002",
    ApiKey = "your-api-key",
    HttpClient = httpClient
});

API Reference

Collection Management

// List collections
var collections = await client.ListCollectionsAsync();

// Get collection info
var info = await client.GetCollectionInfoAsync("documents");

// Create collection
var collection = await client.CreateCollectionAsync(new CreateCollectionRequest
{
    Name = "documents",
    Config = new CollectionConfig
    {
        Dimension = 384,
        Metric = DistanceMetric.Cosine
    }
});

// Delete collection
await client.DeleteCollectionAsync("documents");

Vector Operations

// Insert text (with automatic embedding)
var result = await client.InsertTextAsync("documents", "Hello, world!", new Dictionary<string, object>
{
    ["source"] = "example.txt"
});

// Get vector
var vector = await client.GetVectorAsync("documents", "vector-id");

// Update vector
await client.UpdateVectorAsync("documents", "vector-id", new Vector
{
    Id = "vector-id",
    Data = new float[] { 0.1f, 0.2f, 0.3f },
    Payload = new Dictionary<string, object>
    {
        ["updated"] = true
    }
});

// Delete vector
await client.DeleteVectorAsync("documents", "vector-id");

// Vector search
var results = await client.SearchAsync("documents", new float[] { 0.1f, 0.2f, 0.3f }, new SearchOptions
{
    Limit = 10
});

// Text search
var textResults = await client.SearchTextAsync("documents", "query", new SearchOptions
{
    Limit = 10,
    Filter = new Dictionary<string, object>
    {
        ["category"] = "AI"
    }
});
// Intelligent search with multi-query expansion
var results = await client.IntelligentSearchAsync(new IntelligentSearchRequest
{
    Query = "machine learning algorithms",
    Collections = new List<string> { "documents", "research" },
    MaxResults = 15,
    DomainExpansion = true,
    TechnicalFocus = true,
    MMREnabled = true,
    MMRLambda = 0.7
});
// Semantic search with reranking
var results = await client.SemanticSearchAsync(
    collectionName: "documents",
    query: "neural networks",
    maxResults: 10,
    semanticReranking: true,
    similarityThreshold: 0.6
);
// Context-aware search with metadata filtering
var results = await client.ContextualSearchAsync(new ContextualSearchRequest
{
    Collection = "docs",
    Query = "API documentation",
    ContextFilters = new Dictionary<string, object>
    {
        ["category"] = "backend",
        ["language"] = "csharp"
    },
    MaxResults = 10
});
// Cross-collection search with intelligent aggregation
var results = await client.MultiCollectionSearchAsync(new MultiCollectionSearchRequest
{
    Query = "authentication",
    Collections = new List<string> { "docs", "code", "tickets" },
    MaxTotalResults = 20,
    MaxPerCollection = 5,
    CrossCollectionReranking = true
});

Discovery Operations

// Filter collections based on query relevance
var filtered = await client.FilterCollectionsAsync(new FilterCollectionsRequest
{
    Query = "machine learning",
    MinScore = 0.5
});

// Expand queries with related terms
var expanded = await client.ExpandQueriesAsync(new ExpandQueriesRequest
{
    Query = "neural networks",
    MaxExpansions = 5
});

// Intelligent discovery across collections
var discovery = await client.DiscoverAsync(new DiscoverRequest
{
    Query = "authentication methods",
    MaxResults = 10
});

File Operations

// Get file content from collection
var content = await client.GetFileContentAsync("docs", "src/Client.cs");

// List all files in a collection
var files = await client.ListFilesInCollectionAsync("docs");

// Get ordered chunks of a file
var chunks = await client.GetFileChunksOrderedAsync("docs", "README.md", 1000);

// Get project structure outline
var outline = await client.GetProjectOutlineAsync("codebase");

// Find files related to a specific file
var related = await client.GetRelatedFilesAsync("codebase", "src/Client.cs", 5);

Summarization Operations

// Summarize text using various methods
var summary = await client.SummarizeTextAsync(new SummarizeTextRequest
{
    Text = "Long document text...",
    Method = "extractive", // "extractive", "abstractive", "hybrid"
    MaxLength = 200
});

// Summarize context with metadata
var summary = await client.SummarizeContextAsync(new SummarizeContextRequest
{
    Context = "Document context...",
    Method = "abstractive",
    Focus = "key_points"
});

Workspace Management

// Add a new workspace
await client.AddWorkspaceAsync(new AddWorkspaceRequest
{
    Name = "my-project",
    Path = "/path/to/project"
});

// List all workspaces
var workspaces = await client.ListWorkspacesAsync();

// Remove a workspace
await client.RemoveWorkspaceAsync("my-project");

Backup Operations

// Create a backup of collections
var backup = await client.CreateBackupAsync(new CreateBackupRequest
{
    Name = "backup-2024-11-24"
});

// List all available backups
var backups = await client.ListBackupsAsync();

// Restore from a backup
await client.RestoreBackupAsync(new RestoreBackupRequest
{
    Filename = "backup-2024-11-24.vecdb"
});

Batch Operations

// Batch insert
var batchResult = await client.BatchInsertAsync("documents", new BatchInsertRequest
{
    Texts = new List<string>
    {
        "Machine learning algorithms",
        "Deep learning neural networks",
        "Natural language processing"
    }
});

// Batch search
var batchSearchResult = await client.BatchSearchAsync("documents", new BatchSearchRequest
{
    Queries = new List<string>
    {
        "machine learning",
        "neural networks",
        "NLP techniques"
    },
    Limit = 5
});

Error Handling

try
{
    var collection = await client.CreateCollectionAsync(new CreateCollectionRequest
    {
        Name = "documents",
        Config = new CollectionConfig
        {
            Dimension = 384,
            Metric = DistanceMetric.Cosine
        }
    });
}
catch (VectorizerException ex)
{
    if (ex.IsNotFound)
    {
        Console.WriteLine("Collection not found");
    }
    else if (ex.IsUnauthorized)
    {
        Console.WriteLine("Authentication failed");
    }
    else if (ex.IsValidationError)
    {
        Console.WriteLine($"Validation error: {ex.Message}");
    }
    else
    {
        Console.WriteLine($"Error: {ex.ErrorType} - {ex.Message} (status: {ex.StatusCode})");
    }
}

Examples

See Examples directory for more usage examples:

Development

# Restore dependencies
dotnet restore

# Build
dotnet build

# Run tests
dotnet test

# Build release
dotnet build -c Release

# Pack NuGet package
dotnet pack -c Release

Requirements

  • .NET 8.0 or later
  • System.Text.Json 9.0.0+

License

Apache License 2.0 - see LICENSE for details.

Support

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
2.2.0 410 12/11/2025
2.1.0 414 12/11/2025
1.7.1 256 11/30/2025
1.5.1 186 11/24/2025
1.3.1 222 11/16/2025
1.3.0 228 11/16/2025