Skip to content
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

community(query_constructor): add mql_to_structured helper #29719

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ianchi
Copy link
Contributor

@ianchi ianchi commented Feb 11, 2025

Adds a helper function to transform a mql-like dict into a FilterDirective (and be later used with any translator integration).

This can be helpful in many ways:

  • to construct the FilterDirective in code from a much less verbose mql dict.
  • It can also reuse mql expressions that come from other sources, as mql is a popular standard
  • one source can also be from an llm as structured output directly as mql (as it is a well known format for many llm's)

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 11, 2025
Copy link

vercel bot commented Feb 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Feb 11, 2025 3:42am

@dosubot dosubot bot added the community Related to langchain-community label Feb 11, 2025
Copy link
Collaborator

@ccurme ccurme left a comment

Choose a reason for hiding this comment

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

Should this live in the langchain-mongodb package?

@ccurme ccurme self-assigned this Feb 12, 2025
@ianchi
Copy link
Contributor Author

ianchi commented Feb 12, 2025

I'm not sure, but would argue that it should not.
This is more about taking advantage of a well known way of expressing a filter expression as a json.

We are using this json format even if we don't use MongoDB at all (but SQL in fact).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

2 participants