WeaviateNET 1.20.5
See the version list below for details.
dotnet add package WeaviateNET --version 1.20.5
NuGet\Install-Package WeaviateNET -Version 1.20.5
<PackageReference Include="WeaviateNET" Version="1.20.5" />
paket add WeaviateNET --version 1.20.5
#r "nuget: WeaviateNET, 1.20.5"
// Install WeaviateNET as a Cake Addin #addin nuget:?package=WeaviateNET&version=1.20.5 // Install WeaviateNET as a Cake Tool #tool nuget:?package=WeaviateNET&version=1.20.5
Weaviate.NET
This library is designed to wrap Weaviate vector DB for .NET core. The core API has been wrapped with NSwagStudio and then some extra layer has been added. The API mapping is incomplete and Unit tests should be generalized (they currently use a demo instance).
It is designed to manipulate Weaviate objects and not just to adapt the connection to some LLM framework as other NuGet packages do.
Implementation status
The library implements almost all the schema, class, and object manipulation. It is possible to perform GraphQL queries though the current implementation is pretty raw. Thanks to Newtonsoft JObject it is possible to parse returned data pretty easily.
Missing implementation areas (notice that you can still use the NSwag generated wrapper calls):
- Proper references management
- /backups/* endpoints are not implemented
- /batch/references endpoint is not implemented
- /classifications/* endpoints are not implemented
- /nodes/* endpoints are not implemented
- Tenants
Roadmap
After implementing the missing endpoints in the object model we will work in providing a better GraphQL experience. In the ideal world a LINQ provider would be great to integrate queries into C#.
Using the library
The data model is respectful of the database object model. To start create a connection (using the authorization key) and update the Schema to load the configuration:
weaviateDB = new WeaviateDB("https://yourhost/v1", "WEAVIATE_KEY");
await weaviateDB.Update();
In the Weaviate model objects are made of a set of fields (i.e. properties) with the appropriate data type (see WeaviateDataType class for the full list). Weaviate.NET maps properties to class fields (with few restrictions of course). So we can define the class Movie to describe a movie document:
public class Movie
{
public string? film;
public string? genre;
public string? leadStudio;
public int audienceScore;
public double profitability;
public int rottenTomatoes;
public double worldWideGross;
public int year;
}
Notice that all names follow the camel notation, if you use pascal notation Weaviate will lower case the first letter.
We can create the class in the schema and load data (of type WeaviateObject< Movie>):
var mc = weaviateDB.Schema.NewClass<Movie>("MovieDBTest");
Movie[] movies = ReadMoviesDBFromCsv();
var toadd = new List<WeaviateObject<Movie>>();
foreach (var m in movies) {
var d = mc.Create(); // create the document
d.Properties = m; // set the properties (of type Movie)
toadd.Add(d);
}
await mc.Add(toadd);
To query the database you use explicitly the GraphQL syntax and the ability of JObject to deserialize a field. This basic approach will be supported in the future but a better abstraction will be provided.
var q = new GraphQLQuery();
q.Query = @"{
Get {
MovieDBTest(
limit: 5
nearText: { concepts: [ "robot in the future" ] }
)
{
film
genre
leadStudio
audienceScore
profitability
rottenTomatoes
worldWideGross
year
}
}
}";
var ret = await weaviateDB.Schema.RawQuery(q);
var d = ret.Data["Get"];
var a = data.ToObject<Movie[]>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on WeaviateNET:
Package | Downloads |
---|---|
Oraculum
Library to create and organize factual knowledge inside a Weaviate vector DB and define AI GPT based assistants using this knowledge. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.23.9.1 | 1,395 | 2/18/2024 |
1.23.7.1 | 547 | 2/3/2024 |
1.22.2.1 | 399 | 11/1/2023 |
1.21.6.2 | 474 | 10/22/2023 |
1.21.6.1 | 146 | 10/22/2023 |
1.21.3.1 | 261 | 9/20/2023 |
1.21.2.1 | 211 | 9/2/2023 |
1.21.1.5 | 305 | 8/29/2023 |
1.21.1.4 | 166 | 8/25/2023 |
1.21.1.3 | 162 | 8/25/2023 |
1.21.1.2 | 143 | 8/24/2023 |
1.21.1.1 | 138 | 8/24/2023 |
1.21.0.2 | 153 | 8/21/2023 |
1.21.0.1 | 155 | 8/21/2023 |
1.20.5.3 | 153 | 8/18/2023 |
1.20.5.2 | 127 | 8/18/2023 |
1.20.5.1 | 180 | 8/13/2023 |
1.20.5 | 178 | 8/12/2023 |
1.0.0 | 151 | 8/11/2023 |