-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Copy link
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codeenhancementmemorymemory connectormsft.ext.vectordataRelated to Microsoft.Extensions.VectorDataRelated to Microsoft.Extensions.VectorData
Description
Would be nice to be able to filter by the similarity search score on a database level.
For example, If I wanted to return just the records that is greater than or equal to 0.80. I am able to do this in Azure Cosmos Mongo DB instance by adding a match pipeline.
BsonDocument[] pipeline =
[
new BsonDocument
{
{
"$search", new BsonDocument
{
{
"cosmosSearch", new BsonDocument
{
{ "vector", embeddings },
{ "path", indexProperty },
{ "k", 5 }
}
},
{ "returnStoredSource", true },
}
}
},
new BsonDocument
{
{
"$project", new BsonDocument
{
{ "id", 1 },
{ "name", 1 },
{ "text", 1 },
{ "url", 1 },
{ "vector", 1 },
{ "searchScore", new BsonDocument { { "$meta", "searchScore" } } }
}
}
},
new BsonDocument
{
{
"$match", new BsonDocument
{
{ "searchScore", new BsonDocument { { "$gte", 0.80 } } }
}
}
}
];Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
.NETIssue or Pull requests regarding .NET codeIssue or Pull requests regarding .NET codeenhancementmemorymemory connectormsft.ext.vectordataRelated to Microsoft.Extensions.VectorDataRelated to Microsoft.Extensions.VectorData
Type
Projects
Status
Sprint: Done