Skip to content

Conversation

russcam
Copy link

@russcam russcam commented May 22, 2025

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?)

  • The official client uses gRPC rather than JSON over REST, with gRPC typically offering a significant overall performance improvement.
  • Official client is maintained by Qdrant, reducing code needing to be maintained in this repository to interface with Qdrant

High level description (Approach, Design)

  • Replace the internal qdrant client implementation with the official Qdrant client, mapping the current client's implementation to methods of the official client.
  • Adapt kernel memory types like MemoryRecord to Qdrant types. There may be opportunities to make this smoother.

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.
@russcam russcam requested a review from dluc as a code owner May 22, 2025 05:45
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)
Copy link
Author

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

RetrievedPoint existingPoint = existingPoints[0];
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);
Copy link
Author

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)),
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant