Skip to content

fix: updates count tool #254

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

fix: updates count tool #254

wants to merge 4 commits into from

Conversation

blva
Copy link
Collaborator

@blva blva commented May 15, 2025

  • updates count tool to use countDocuments()
  • adds support to query or filter in the tool, since LLMs might get confused about the right argument to use

query: z
.record(z.string(), z.unknown())
.optional()
.describe("Alternative old name for filter. Will be used in db.collection.countDocuments()"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason to keep providing this field?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, since the LLM was already confusing query/filter, I figure that it can get confused the other way around and try to send it as "query" because it thinks we'll use .count() (even though we call out is countDocments, but who knows, it might have outdated data about MDB)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make much sense to me. I think we should tweak the description of filter rather than accept two arguments that are doing the same thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np, I'll remove and update the description

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can try that for now and see if it improves, based on the issue I'm not sure the LLM will stop getting confused

@blva blva marked this pull request as ready for review May 15, 2025 11:29
@blva blva requested a review from a team as a code owner May 15, 2025 11:29
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.

3 participants