-
Notifications
You must be signed in to change notification settings - Fork 380
Use Qdrant.Client for QdrantMemory internals #1068
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
base: main
Are you sure you want to change the base?
Conversation
This commit updates QdrantMemory to use the official Qdrant client for QdrantMemory internals. The official client uses gRPC rather than JSON over REST, with gRPC typically offering a significant overall performance improvement.
QdrantPoint<DefaultQdrantPayload>? existingPoint = await this._qdrantClient | ||
.GetVectorByPayloadIdAsync(index, record.Id, cancellationToken: cancellationToken) | ||
IReadOnlyList<RetrievedPoint> existingPoints = await this._qdrantClient | ||
.RetrieveAsync(index, new Guid(record.Id), cancellationToken: cancellationToken) |
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.
Merged qdrant/qdrant-dotnet#93 to make this more ergonomic
this._log.LogTrace("Point ID {0} found, deleting...", existingPoint.Id); | ||
await this._qdrantClient.DeleteVectorsAsync(index, [existingPoint.Id], cancellationToken).ConfigureAwait(false); | ||
await this._qdrantClient.DeleteAsync(index, new Guid(existingPoint.Id.Uuid), cancellationToken: cancellationToken).ConfigureAwait(false); |
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.
Merged qdrant/qdrant-dotnet#93 to make this more ergonomic
{ | ||
[Id] = record.Id, | ||
[Tags] = record.Tags.Pairs.Select(tag => $"{tag.Key}{Constants.ReservedEqualsChar}{tag.Value}").ToArray(), | ||
[Payload] = Value.Parser.ParseJson(JsonSerializer.Serialize(record.Payload, QdrantConfig.JSONOptions)), |
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.
Can implement an IDictionary<string, object>
-> Struct
method over this serialize/deserialize (to later serialize again) approach.
This commit updates QdrantMemory to use the official Qdrant client for QdrantMemory internals.
I wanted to open a PR at this stage to gauge interest in this change. Further work needed to remove the current client implementation and to test adapters between Kernel memory and Qdrant client is needed.
Motivation and Context (Why the change? What's the scenario?)
High level description (Approach, Design)
MemoryRecord
to Qdrant types. There may be opportunities to make this smoother.