BilberryDB 1.0.0
dotnet add package BilberryDB --version 1.0.0
NuGet\Install-Package BilberryDB -Version 1.0.0
<PackageReference Include="BilberryDB" Version="1.0.0" />
<PackageVersion Include="BilberryDB" Version="1.0.0" />
<PackageReference Include="BilberryDB" />
paket add BilberryDB --version 1.0.0
#r "nuget: BilberryDB, 1.0.0"
#:package BilberryDB@1.0.0
#addin nuget:?package=BilberryDB&version=1.0.0
#tool nuget:?package=BilberryDB&version=1.0.0
BilberryDB - Image Search
Developer SDK for creating image search engines with BilberryDB in C#.
What it does
This library helps you find images that look similar to a given image. Just provide an image path, and it will return the most similar images from your Bilberry Vector DB.
Installation
Install via NuGet Package Manager:
Install-Package BilberryDB
Or via .NET CLI:
dotnet add package BilberryDB
Or via PackageReference in your .csproj
:
<PackageReference Include="BilberryDB" Version="1.0.0" />
Getting API Keys
You need API keys to use BilberryDB:
- Visit www.bilberrydb.com
- Go to API Key section
- Click Create New API Key
- Enter API Key Name (like "My image search project")
- Click Create Key
Setup
Option 1: Using appsettings.json
Create an appsettings.json
file in your project root:
{
"BilberryDB": {
"ApiKey": "your_api_key_here",
"ApiId": "your_registered_email_here"
}
}
Option 2: Using User Secrets (Recommended for development)
dotnet user-secrets init
dotnet user-secrets set "BilberryDB:ApiKey" "your_api_key_here"
dotnet user-secrets set "BilberryDB:ApiId" "your_registered_email_here"
Option 3: Using Environment Variables
Set these environment variables:
BILBERRY_API_KEY
: Your API keyBILBERRY_API_ID
: Your registered email
Usage
using System;
using System.Threading.Tasks;
using BilberryDB;
using Microsoft.Extensions.Configuration;
class Program
{
static async Task Main(string[] args)
{
await SearchSimilarImages();
}
static async Task SearchSimilarImages()
{
try
{
// Load configuration
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true)
.AddUserSecrets<Program>()
.AddEnvironmentVariables()
.Build();
// Get API credentials
var apiKey = configuration["BilberryDB:ApiKey"] ?? Environment.GetEnvironmentVariable("BILBERRY_API_KEY");
var apiId = configuration["BilberryDB:ApiId"] ?? Environment.GetEnvironmentVariable("BILBERRY_API_ID");
// Check if API keys exist
if (string.IsNullOrEmpty(apiKey) || string.IsNullOrEmpty(apiId))
{
throw new InvalidOperationException("Missing API keys. Check your configuration.");
}
// Initialize client
var config = new BilberryConfig
{
ApiKey = apiKey,
ApiId = apiId
};
using var client = BilberryClient.Init(config);
var vector = client.GetVector();
// Search for similar images
var results = await vector.SearchAsync("path/to/your/image.jpg", new SearchOptions
{
TopK = 5, // Get top 5 similar images
ContentType = "image"
});
// Show results
Console.WriteLine($"Found {results.Count} similar images:");
for (int i = 0; i < results.Count; i++)
{
var result = results[i];
var filename = result.FileName ?? $"item_{result.Id}";
Console.WriteLine($"{i + 1}. Image: {filename}");
Console.WriteLine($" Similarity: {result.SimilarityScore:F3}");
Console.WriteLine($" File Type: {result.FileType}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Search failed: {ex.Message}");
}
}
}
How to use
- Replace
"path/to/your/image.jpg"
with the actual path to your image - Change
TopK = 5
to get more or fewer results - Build and run your application:
dotnet build dotnet run
What you get back
Each result includes:
- FileName: Name of the similar image
- SimilarityScore: How similar it is (higher = more similar)
- FileType: Type of image file (jpg, png, etc.)
- Id: Unique ID of the image
Common issues
"Missing API keys": Make sure your configuration has the correct API key and API ID.
"Search failed": Check that:
- Your image path is correct and the file exists
- Your API keys are valid
- You have internet connection
- The image file format is supported
Project Requirements
Add these NuGet packages to your .csproj
:
<PackageReference Include="BilberryDB" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
Requirements
- .NET 6.0 or higher
- Valid BilberryDB account and API keys
License
Check the BilberryDB package license for details.
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
- Newtonsoft.Json (>= 13.0.3)
- System.Net.Http (>= 4.3.4)
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 |
---|---|---|
1.0.0 | 132 | 8/18/2025 |