Skip to content

FindAndRerank support (collections)#193

Open
sl-at-ibm wants to merge 32 commits into
mainfrom
SL-farr
Open

FindAndRerank support (collections)#193
sl-at-ibm wants to merge 32 commits into
mainfrom
SL-farr

Conversation

@sl-at-ibm
Copy link
Copy Markdown
Collaborator

No description provided.

sl-at-ibm added 30 commits May 24, 2026 00:57
@sl-at-ibm sl-at-ibm marked this pull request as ready for review May 23, 2026 22:57
@sl-at-ibm
Copy link
Copy Markdown
Collaborator Author

sl-at-ibm commented May 23, 2026

Ok, @toptobes , this is now ready for a real review. I think we're essentially there.

  • If the class naming scheme I shared with you does convince you;
  • if we're ok to keeping the actual methods in FindAndRerankOptions and not push them down to CollectionFindAndRerankOptions (methods like RerankOn, etc). I mean, table FARR is not a thing yet and we cannot guess the details of that API -- however, even having to move some/all methods down to collections post-GA, albeit technically "breaking", would practically be a quasi-academic concern I think (and now the arrangement of methods is analogous to the regular-find case)
  • A third (minor) point is the choice of calling the three fluent methods of BaseFindAndRerankOptions like this: HybridLimits, VectorLimit/LexicalLimit -- note the plural form for the first only. These names (the latter two) do not appear explicitly in the payload, but I think it makes sense to call them so given the meaning of the short/long forms in the payload. Opinions may vary whether this confuses more/less.

@sl-at-ibm
Copy link
Copy Markdown
Collaborator Author

Also here some minimal guidance (in part. for @skedwards88 and doc updates if/when this gets merged):

(see CollectionFARRCursorTests.cs for full API demonstration)

var farrFindOptions = new CollectionFindAndRerankOptions<FARRCursorTestVectorDocument> {
    Sort = Builders<FARRCursorTestVectorDocument>.CollectionFindAndRerankSort.Hybrid(new float[] {1.0f, 0.0f}, "blabla"),
    ... // see CollectionFARRCursorTests for the full story...
};

var cur = filledCollection.FindAndRerank(theRegularFilter, farrFindOptions); // Also fluent API, see `Test_CollectionVectorFARR_FluentInterface`
var results = await cur.ToListAsync(); // etc etc

//  now: results[0].Document is document, results[0].Scores is Dictionary<string, float?> (or null if not requested)

Also (probably not for docs since it's useful only for dev):

var myColl = database.GetCollection(
    "my_collection",
    new DatabaseCollectionCommandOptions() { RerankingAPIKey = "AstraCS:...dev-token..." }
);

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