-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chroma memory store - C# implementation #1634
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ic-kernel into chroma-dotnet
SergeyMenshykh
previously approved these changes
Jun 22, 2023
lemillermicrosoft
previously approved these changes
Jun 22, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
lemillermicrosoft
approved these changes
Jun 26, 2023
@dmytrostruk awesome! 🎉 |
shawncal
pushed a commit
to shawncal/semantic-kernel
that referenced
this pull request
Jul 6, 2023
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> This PR contains changes for Chroma C# memory store. For more information about Chroma, see: https://docs.trychroma.com/getting-started. To run integration tests, local Chroma server should be up and running. To start local Chroma server for testing (this information is also included in [README](https://github.com/microsoft/semantic-kernel/blob/0fb77e0c0f347e3f22d79b3c99e7f84d35340462/dotnet/src/Connectors/Connectors.Memory.Chroma/README.md)): 1. Clone Chroma: ```bash git clone https://github.com/chroma-core/chroma.git cd chroma ``` 2. Run local Chroma server with Docker within Chroma repository root: ```bash docker-compose up -d --build ``` 3. Use Semantic Kernel with Chroma, using server local endpoint `http://localhost:8000`: ```csharp const string endpoint = "http://localhost:8000"; ChromaMemoryStore memoryStore = new(endpoint); IKernel kernel = Kernel.Builder .WithLogger(logger) .WithOpenAITextEmbeddingGenerationService("text-embedding-ada-002", "OPENAI_API_KEY") .WithMemoryStorage(memoryStore) //.WithChromaMemoryStore(endpoint) // This method offers an alternative approach to registering Chroma memory store. .Build(); ``` ### Description <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> Main public classes: 1. `ChromaMemoryStore` - implementation of `IMemoryStore` interface. Uses `ChromaClient` to communicate with Chroma API. Throws `ChromaMemoryStoreException` in case of issues. 2. `ChromaClient` - responsible for communication with Chroma API. Throws `ChromaClientException` in case of issues. Chroma entity models: 1. `ChromaCollectionModel` - defines Chroma collection. 2. `ChromaEmbeddingsModel` - defines Chroma embeddings, constructed from `MemoryRecord`. 3. `ChromaQueryResultModel` - defines Chroma search result set. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) - [x] The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with `dotnet format` - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ai connector
Anything related to AI connectors
kernel
Issues or pull requests impacting the core kernel
memory connector
.NET
Issue or Pull requests regarding .NET code
PR: ready for review
All feedback addressed, ready for reviews
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR contains changes for Chroma C# memory store.
For more information about Chroma, see: https://docs.trychroma.com/getting-started.
To run integration tests, local Chroma server should be up and running.
To start local Chroma server for testing (this information is also included in README):
git clone https://github.com/chroma-core/chroma.git cd chroma
http://localhost:8000
:Description
Main public classes:
ChromaMemoryStore
- implementation ofIMemoryStore
interface. UsesChromaClient
to communicate with Chroma API. ThrowsChromaMemoryStoreException
in case of issues.ChromaClient
- responsible for communication with Chroma API. ThrowsChromaClientException
in case of issues.Chroma entity models:
ChromaCollectionModel
- defines Chroma collection.ChromaEmbeddingsModel
- defines Chroma embeddings, constructed fromMemoryRecord
.ChromaQueryResultModel
- defines Chroma search result set.Contribution Checklist
dotnet format