Skip to content

Commit

Permalink
Update readme. (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet authored Oct 14, 2024
1 parent 3a3f383 commit ab35b3b
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 21 deletions.
19 changes: 0 additions & 19 deletions .github/workflows/autodocs.yml

This file was deleted.

42 changes: 40 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,46 @@ With _ChromaDB.Client_, you can easily connect to a Chroma instance, create and

## Example

<!-- MARKDOWN-AUTO-DOCS:START (CODE:src=./Samples/ChromaDB.Client.Sample/Program.cs) -->
<!-- MARKDOWN-AUTO-DOCS:END -->
```csharp
using System.Diagnostics;
using ChromaDB.Client;

var configOptions = new ConfigurationOptions(uri: "http://localhost:8000/api/v1/");
using var httpClient = new ChromaDBHttpClient(configOptions);
var client = new ChromaDBClient(configOptions, httpClient);

Console.WriteLine((await client.GetVersion()).Data);

var getOrCreateResponse = await client.GetOrCreateCollection("string5");
Trace.Assert(getOrCreateResponse.Success);

var string5Client = new ChromaDBCollectionClient(getOrCreateResponse.Data, httpClient);

var addResponse = await string5Client.Add(["340a36ad-c38a-406c-be38-250174aee5a4"], embeddings: [[1f, 0.5f, 0f, -0.5f, -1f]]);
Trace.Assert(addResponse.Success);

var getResponse = await string5Client.Get(["340a36ad-c38a-406c-be38-250174aee5a4"], include: ["metadatas", "documents", "embeddings"]);
if (getResponse.Success)
{
foreach (var entry in getResponse.Data)
{
Console.WriteLine($"ID: {entry.Id}");
}
}

var queryResponse = await string5Client.Query([[1f, 0.5f, 0f, -0.5f, -1f], [1.5f, 0f, 2f, -1f, -1.5f]],
include: ["metadatas", "distances"]);
if (queryResponse.Success)
{
foreach (var item in queryResponse.Data)
{
foreach (var entry in item)
{
Console.WriteLine($"ID: {entry.Id} | Distance: {entry.Distance}");
}
}
}
```

## Status

Expand Down

0 comments on commit ab35b3b

Please sign in to comment.