RagSearchTool.fromCollection constructor
RagSearchTool.fromCollection(})
Like RagSearchTool.fromMobileRag, scoped to the collection
collectionId.
The collection is looked up on MobileRag.instance for every call, because a CollectionRag keeps the engine it was created with.
Implementation
factory RagSearchTool.fromCollection(
String collectionId, {
String name = defaultName,
String description = defaultDescription,
int defaultTopK = 5,
int maxTopK = 10,
int tokenBudget = 1500,
}) => RagSearchTool(
search: (query, topK) => MobileRag.instance
.inCollection(collectionId)
.searchHybridWithContext(query, topK: topK, tokenBudget: tokenBudget),
listSources: () =>
MobileRag.instance.inCollection(collectionId).listSources(),
name: name,
description: description,
defaultTopK: defaultTopK,
maxTopK: maxTopK,
);