-
Notifications
You must be signed in to change notification settings - Fork 41
feat: add explain command #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b608fc9
to
599a179
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
import { ToolArgs } from "../../tool.js"; | ||
|
||
export const AggregateArgs = { | ||
pipeline: z.array(z.object({}).passthrough()).describe("An array of aggregation stages to execute"), | ||
limit: z.number().optional().default(10).describe("The maximum number of documents to return"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you didn't change this, but I wonder if we should drop limit here? Considering the agg framework has a $limit
stage, I wonder if that could conflict with a pipeline the model generates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern is the toArray()
call then. it's going to try to load all the documents from the aggregation result into memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - just wonder if we might run into trouble if a user asks for give me the top 50 docs and the model generates a stage, but our limit kicks in. Haven't looked into it, but we could check if there's a way to stream the responses to the model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove it and we can revisit with a solution
Co-authored-by: Nikola Irinchev <[email protected]>
4de7d50
to
2a87387
Compare
Uh oh!
There was an error while loading. Please reload this page.