Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8fe2f62
Add alias code and fix errors
g-despot Nov 24, 2025
1dc3fe6
Update code
g-despot Nov 25, 2025
f6117e0
Update code
g-despot Nov 25, 2025
c47765f
Update code
g-despot Nov 25, 2025
1a0796b
Fix new syntax
g-despot Nov 26, 2025
1ead59a
Update docs and code
g-despot Nov 26, 2025
3563448
Update docs & code
g-despot Nov 27, 2025
781796f
Fix test execution
g-despot Nov 27, 2025
976ec67
Update docs and code
g-despot Nov 28, 2025
eb1fef9
Update docs and code
g-despot Nov 28, 2025
4dfdf47
Merge branch 'main' into csharp-client-ga
g-despot Dec 1, 2025
6d16f70
Update code
g-despot Dec 1, 2025
d7ecf2b
Update code
g-despot Dec 2, 2025
72aed7a
Merge branch 'main' into csharp-client-ga
g-despot Dec 2, 2025
41e9978
Update vectorizer name
g-despot Dec 3, 2025
b594a73
Update code
g-despot Dec 3, 2025
af62c48
Merge branch 'main' into csharp-client-ga
databyjp Dec 8, 2025
1632346
Update target framework to net9.0 and update project paths to ref
databyjp Dec 8, 2025
b71d4c8
Updates to match client changes
databyjp Dec 8, 2025
be4d593
update addreference
databyjp Dec 9, 2025
38c3f79
dotnet format
databyjp Dec 9, 2025
934fcf4
Update code
g-despot Dec 15, 2025
5ea6774
Update code
g-despot Dec 15, 2025
018501d
Merge pull request #300 from weaviate/csharp-client-ga-updates
databyjp Dec 15, 2025
bb03454
Merge pull request #295 from weaviate/csharp-client-ga-jph-20251208
databyjp Dec 15, 2025
d29f707
Merge pull request #304 from weaviate/csharp-client-ga-updates
g-despot Dec 16, 2025
b026c62
Minor update
g-despot Dec 16, 2025
3d0eb6d
Update code
g-despot Dec 18, 2025
948d85a
GA updates
g-despot Dec 18, 2025
4bd0ec0
Update code
g-despot Dec 19, 2025
75bbbe4
Merge branch 'main' into csharp-client-ga
g-despot Dec 19, 2025
7747a2a
Update docs
g-despot Dec 19, 2025
b119686
Update docs and code
g-despot Jan 8, 2026
2d0f6b9
Merge branch 'main' into csharp-client-ga
g-despot Jan 8, 2026
a0b39a7
Update code
g-despot Jan 8, 2026
1e24b2a
Update code
g-despot Jan 9, 2026
6ab2a5c
Update code
g-despot Jan 9, 2026
c2a5a4f
Update docs
g-despot Jan 9, 2026
72a043b
Merge branch 'main' into csharp-client-ga
g-despot Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 153 additions & 153 deletions _includes/code/csharp/ConfigureRQTest.cs
Original file line number Diff line number Diff line change
@@ -1,166 +1,166 @@
// using Xunit;
// using Weaviate.Client;
// using Weaviate.Client.Models;
// using System;
// using System.Threading.Tasks;
using Xunit;
using Weaviate.Client;
using Weaviate.Client.Models;
using System;
using System.Threading.Tasks;

// namespace WeaviateProject.Tests;
namespace WeaviateProject.Tests;

// public class ConfigureRQTest : IAsyncLifetime
// {
// private WeaviateClient client;
// private const string COLLECTION_NAME = "MyCollection";
public class ConfigureRQTest : IAsyncLifetime
{
private WeaviateClient client;
private const string COLLECTION_NAME = "MyCollection";

// // Runs before each test
// public async Task InitializeAsync()
// {
// // START ConnectCode
// // Note: The C# client doesn't support setting headers like 'X-OpenAI-Api-Key' via the constructor for local connections.
// // This must be configured in Weaviate's environment variables.
// client = new WeaviateClient(new ClientConfiguration { RestAddress = "localhost", RestPort = 8080 });
// // END ConnectCode
// Runs before each test
public async Task InitializeAsync()
{
// START ConnectCode
// Note: The C# client doesn't support setting headers like 'X-OpenAI-Api-Key' via the constructor for local connections.
// This must be configured in Weaviate's environment variables.
client = new WeaviateClient(new ClientConfiguration { RestAddress = "localhost", RestPort = 8080 });
// END ConnectCode

// // Clean slate for each test
// if (await client.Collections.Exists(COLLECTION_NAME))
// {
// await client.Collections.Delete(COLLECTION_NAME);
// }
// }
// Clean slate for each test
if (await client.Collections.Exists(COLLECTION_NAME))
{
await client.Collections.Delete(COLLECTION_NAME);
}
}

// // Runs after each test
// public Task DisposeAsync()
// {
// // No action needed here, as cleanup happens in InitializeAsync before the next test.
// return Task.CompletedTask;
// }
// Runs after each test
public Task DisposeAsync()
{
// No action needed here, as cleanup happens in InitializeAsync before the next test.
return Task.CompletedTask;
}

// [Fact]
// public async Task TestEnableRQ()
// {
// // START EnableRQ
// await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig(
// "default",
// new Vectorizer.Text2VecTransformers(),
// new VectorIndex.HNSW
// {
// // highlight-start
// Quantizer = new VectorIndex.Quantizers.RQ()
// // highlight-end
// }
// )
// });
// // END EnableRQ
// }
[Fact]
public async Task TestEnableRQ()
{
// START EnableRQ
await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig(
"default",
new Vectorizer.Text2VecTransformers(),
new VectorIndex.HNSW
{
// highlight-start
Quantizer = new VectorIndex.Quantizers.RQ()
// highlight-end
}
)
});
// END EnableRQ
}

// [Fact]
// public async Task Test1BitEnableRQ()
// {
// // START 1BitEnableRQ
// await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig(
// "default",
// new Vectorizer.Text2VecTransformers(),
// new VectorIndex.HNSW
// {
// // highlight-start
// Quantizer = new VectorIndex.Quantizers.RQ { Bits = 1 }
// // highlight-end
// }
// )
// });
// // END 1BitEnableRQ
// }
[Fact]
public async Task Test1BitEnableRQ()
{
// START 1BitEnableRQ
await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig(
"default",
new Vectorizer.Text2VecTransformers(),
new VectorIndex.HNSW
{
// highlight-start
Quantizer = new VectorIndex.Quantizers.RQ { Bits = 1 }
// highlight-end
}
)
});
// END 1BitEnableRQ
}

// [Fact]
// public async Task TestUncompressed()
// {
// // START Uncompressed
// await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig(
// "default",
// new Vectorizer.Text2VecTransformers(),
// // highlight-start
// // Omitting the Quantizer property results in an uncompressed index.
// new VectorIndex.HNSW()
// // highlight-end
// )
// });
// // END Uncompressed
// }
[Fact]
public async Task TestUncompressed()
{
// START Uncompressed
await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig(
"default",
new Vectorizer.Text2VecTransformers(),
// highlight-start
// Omitting the Quantizer property results in an uncompressed index.
new VectorIndex.HNSW()
// highlight-end
)
});
// END Uncompressed
}

// [Fact]
// public async Task TestRQWithOptions()
// {
// // START RQWithOptions
// await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig(
// "default",
// new Vectorizer.Text2VecTransformers(),
// new VectorIndex.HNSW
// {
// // highlight-start
// Quantizer = new VectorIndex.Quantizers.RQ
// {
// Bits = 8, // Optional: Number of bits
// RescoreLimit = 20 // Optional: Number of candidates to fetch before rescoring
// }
// // highlight-end
// }
// )
// });
// // END RQWithOptions
// }
[Fact]
public async Task TestRQWithOptions()
{
// START RQWithOptions
await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig(
"default",
new Vectorizer.Text2VecTransformers(),
new VectorIndex.HNSW
{
// highlight-start
Quantizer = new VectorIndex.Quantizers.RQ
{
Bits = 8, // Optional: Number of bits
RescoreLimit = 20 // Optional: Number of candidates to fetch before rescoring
}
// highlight-end
}
)
});
// END RQWithOptions
}

// [Fact]
// public async Task TestUpdateSchema()
// {
// // Note: Updating quantization settings on an existing collection is not supported by Weaviate
// // and will result in an error, as noted in the Java test. This test demonstrates the syntax for attempting the update.
// var collection = await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig("default", new Vectorizer.Text2VecTransformers())
// });
[Fact]
public async Task TestUpdateSchema()
{
// Note: Updating quantization settings on an existing collection is not supported by Weaviate
// and will result in an error, as noted in the Java test. This test demonstrates the syntax for attempting the update.
var collection = await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig("default", new Vectorizer.Text2VecTransformers())
});

// // START UpdateSchema
// await collection.Config.Update(c =>
// {
// var vectorConfig = c.VectorConfig["default"];
// vectorConfig.VectorIndexConfig.UpdateHNSW(h => h.Quantizer = new VectorIndex.Quantizers.RQ());
// });
// // END UpdateSchema
// }
// START UpdateSchema
await collection.Config.Update(c =>
{
var vectorConfig = c.VectorConfig["default"];
vectorConfig.VectorIndexConfig.UpdateHNSW(h => h.Quantizer = new VectorIndex.Quantizers.RQ());
});
// END UpdateSchema
}

// [Fact]
// public async Task Test1BitUpdateSchema()
// {
// var collection = await client.Collections.Create(new CollectionConfig
// {
// Name = "MyCollection",
// Properties = [Property.Text("title")],
// VectorConfig = new VectorConfig("default", new Vectorizer.Text2VecTransformers())
// });
[Fact]
public async Task Test1BitUpdateSchema()
{
var collection = await client.Collections.Create(new CollectionConfig
{
Name = "MyCollection",
Properties = [Property.Text("title")],
VectorConfig = new VectorConfig("default", new Vectorizer.Text2VecTransformers())
});

// // START 1BitUpdateSchema
// await collection.Config.Update(c =>
// {
// var vectorConfig = c.VectorConfig["default"];
// vectorConfig.VectorIndexConfig.UpdateHNSW(h => h.Quantizer = new VectorIndex.Quantizers.RQ { Bits = 1 });
// });
// // END 1BitUpdateSchema
// }
// }
// START 1BitUpdateSchema
await collection.Config.Update(c =>
{
var vectorConfig = c.VectorConfig["default"];
vectorConfig.VectorIndexConfig.UpdateHNSW(h => h.Quantizer = new VectorIndex.Quantizers.RQ { Bits = 1 });
});
// END 1BitUpdateSchema
}
}
6 changes: 3 additions & 3 deletions _includes/code/csharp/ConnectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task TestConnectWCDWithApiKey()
string weaviateUrl = Environment.GetEnvironmentVariable("WEAVIATE_URL");
string weaviateApiKey = Environment.GetEnvironmentVariable("WEAVIATE_API_KEY");

WeaviateClient client = Connect.Cloud(
WeaviateClient client = await Connect.Cloud(
weaviateUrl, // Replace with your Weaviate Cloud URL
weaviateApiKey // Replace with your Weaviate Cloud key
);
Expand Down Expand Up @@ -116,7 +116,7 @@ public async Task TestCustomApiKeyConnection()
public async Task TestConnectLocalNoAuth()
{
// START LocalNoAuth
WeaviateClient client = Connect.Local();
WeaviateClient client = await Connect.Local();

var isReady = await client.IsReady();
Console.WriteLine(isReady);
Expand Down Expand Up @@ -172,7 +172,7 @@ public async Task TestConnectWCDWithThirdPartyKeys()
string weaviateApiKey = Environment.GetEnvironmentVariable("WEAVIATE_API_KEY");
string cohereApiKey = Environment.GetEnvironmentVariable("COHERE_API_KEY");

WeaviateClient client = Connect.Cloud(
WeaviateClient client = await Connect.Cloud(
weaviateUrl, // Replace with your Weaviate Cloud URL
weaviateApiKey, // Replace with your Weaviate Cloud key
new Dictionary<string, string>
Expand Down
4 changes: 2 additions & 2 deletions _includes/code/csharp/GetStartedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class GetStartedTests
[Fact]
public async Task GetStarted()
{
var client = Connect.Local();
var client = await Connect.Local();
const string collectionName = "Question";

try
Expand Down Expand Up @@ -87,7 +87,7 @@ public async Task CreateCollectionAndRunNearTextQuery()
string weaviateApiKey = Environment.GetEnvironmentVariable("WEAVIATE_API_KEY");

// 1. Connect to Weaviate
var client = Connect.Cloud(weaviateUrl, weaviateApiKey);
var client = await Connect.Cloud(weaviateUrl, weaviateApiKey);

// 2. Prepare data (same as Python data_objects)
var dataObjects = new List<object>
Expand Down
Loading
Loading