Skip to content

Commit eb1a832

Browse files
cchighmancodebrain
authored andcommitted
Resolve completion failures from an unexpected exception thrown in the Qdrant Connector (microsoft#719)
### Motivation and Context An unexpected exception is being thrown when attempting to find nearest vectors and no vectors exist. This results in the current completion activity to fail. An example of this behavior can be observed in the copilot-sample-app by changing the MemoriesStore type in appsettings from "volatile" to "qdrant". All subsequent chat completions will fail. There are seven other API requests in this same class which all use roughly the same conventions and handling of the HTTP request / response. _FindNearestInCollectionAsync_ is the only one of the eight total which doesn't explicitly check or catch to prevent an exception. For more details and context, see the write-up outlined in the linked issue: microsoft#694 ### Description Align HTTP response behavior in FindNearestInCollectionAsync to match the consistent behavior uniformly observed for HTTP request/response handling. This amounts to simply breaking when the response status code is NotFound.
1 parent 85e5ff9 commit eb1a832

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorDbClient.cs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ public async Task UpsertVectorsAsync(string collectionName, IEnumerable<QdrantVe
300300
.Build();
301301

302302
(HttpResponseMessage response, string responseContent) = await this.ExecuteHttpRequestAsync(request, cancellationToken).ConfigureAwait(false);
303+
304+
if (response.StatusCode == HttpStatusCode.NotFound)
305+
{
306+
this._log.LogWarning("No vectors were found.");
307+
yield break;
308+
}
309+
303310
response.EnsureSuccessStatusCode();
304311

305312
var data = JsonSerializer.Deserialize<SearchVectorsResponse>(responseContent);

0 commit comments

Comments
 (0)