Skip to content
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

.Net: Weaviate memory connector http call optimization #7280

Open
wants to merge 38 commits into
base: main
Choose a base branch
from

Conversation

atiq-bs23
Copy link
Contributor

@atiq-bs23 atiq-bs23 commented Jul 16, 2024

Motivation and Context

To improve efficiency and performance by reducing the number of HTTP requests during batch deletions in RemoveBatchAsync.

Description

The updated RemoveBatchAsync method in WeaviateMemoryStore now sends a single HTTP request to delete multiple keys at once, replacing the previous approach of sending individual requests for each key. This change minimizes network overhead and enhances performance.

Doc: Batch delete objects

Contribution Checklist

@atiq-bs23 atiq-bs23 requested a review from a team as a code owner July 16, 2024 08:11
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel memory labels Jul 16, 2024
@github-actions github-actions bot changed the title Weaviate memory connector http call optimization .Net: Weaviate memory connector http call optimization Jul 16, 2024
@atiq-bs23
Copy link
Contributor Author

@westey-m, @RogerBarreto Can you please help me to test this current change?

@atiq-bs23
Copy link
Contributor Author

atiq-bs23 commented Jul 16, 2024

@markwallace-microsoft all hard-coded null checks replaced.

@westey-m
Copy link
Contributor

@westey-m, @RogerBarreto Can you please help me to test this current change?

@atiq-bs23, looks like there is an issue with the batch request model. I'm getting 422 (Unprocessable Entity) when running the integration tests.

To run them yourself, check out https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/IntegrationTests/Connectors/Weaviate/WeaviateMemoryStoreTests.cs

Steps are:

  1. Start up the weaviate docker image, using the instructions here or the docker compose yml that's in the same folder as the tests.
  2. Set the skipReason to null on line 23 of the test file, so that it doesn't skip the tests.

Let me know if you get stuck.

@atiq-bs23
Copy link
Contributor Author

atiq-bs23 commented Jul 17, 2024

@westey-m based on their doc Batch delete objects , it seems the body is okay to me.

Can you please check if there is anything I am missing?

To generate the body please take the attachment Program.txt ->MAKE IT Program.cs -> Run as a console app
Program.txt

JSON BODY
{ "dryRun": false, "match": { "class": "myCollection", "where": { "operator": "ContainsAny", "path": [ "sk_id" ], "valueStringArray": [ "key1", "key2", "key3" ] } } }

In the meantime I will check weaviate docker image.

@atiq-bs23
Copy link
Contributor Author

@westey-m Integration Test Passed
I have got the issue and added a fix. Instead of passing the Weaviate-friendly class name, I was mistakenly passing the user input directly.

dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateMemoryStore.cs#L394

Apologies for the late reply. We experienced an internet outage across Bangladesh for the past few days.

@atiq-bs23
Copy link
Contributor Author

@RogerBarreto could you please review this implementation when you have a chance? unit test and integration test passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel memory .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants