PYTHON-5667: Update prompt.py - #162
Open
Putu Gede Pradana Adnyana (pradanaadn) wants to merge 2 commits into
Open
Putu Gede Pradana Adnyana (pradanaadn) wants to merge 2 commits into
Putu Gede Pradana Adnyana (pradanaadn) wants to merge 2 commits into
Conversation
Steven Silvester (blink1073)
left a comment
Collaborator
There was a problem hiding this comment.
Thank you! I just have one comment
|
|
||
|
|
||
| MONGODB_QUERY_CHECKER = """ | ||
| MONGODB_QUERY_CHECKER = MONGODB_QUERY_CHECKER = """ |
Collaborator
There was a problem hiding this comment.
Was this change unintentional?
Collaborator
|
Thanks Putu Gede Pradana Adnyana (@pradanaadn) for your contribution. I hope that you are still using langchain-mongodb! I have created JIRA ticket to pick up this work: PYTHON-5667 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It keep return query in json:
================================= Tool Message =================================
Name: mongodb_query_checker
content='
json\n{\n aggregate: "sales",\n pipeline: [\n { $unwind: "$items" },\n { $unwind: "$items.tags" },\n {\n $group: {\n _id: "$items.tags",\n totalSales: { $sum: { $multiply: ["$items.price", "$items.quantity"] } }\n }\n },\n { $sort: { totalSales: -1 } },\n { $limit: 5 }\n ]\n}\n\n\n### Explanation:\n1. Unwinding Tags: Thetagsfield withinitemsis likely an array, which requires an additional$unwindstage to flatten the array and properly group by individual tags.\n2. Identifiers and Operators Quoting: The identifiers and operators are quoted correctly in the original query, and there are no syntax errors related to quoting.\n3. JSON Validity: The query is valid JSON format as part of a MongoDB aggregation pipeline.\n\nThe main change is the addition of an extra$unwindstage foritems.tags. This ensures the query groups by each individual tag rather than the array of tags.' additional_kwargs={'refusal': None} response_metadata={'token_usage': {'completion_tokens': 239, 'prompt_tokens': 178, 'total_tokens': 417, 'completion_tokens_details': {'accepted_prediction_tokens': 0, 'audio_tokens': 0, 'reasoning_tokens': 0, 'rejected_prediction_tokens': 0}, 'prompt_tokens_details': {'audio_tokens': 0, 'cached_tokens': 0}}, 'model_name': 'gpt-4o-2024-08-06', 'system_fingerprint': 'fp_a288987b44', 'id': 'chatcmpl-BqWxt1ajfavqmGTBS06BLsuDhCM1D', 'service_tier': 'default', 'finish_reason': 'stop', 'logprobs': None} id='run--75a8df8b-cf4e-4e79-aba0-dcea8b9c8e69-0' usage_metadata={'input_tokens': 178, 'output_tokens': 239, 'total_tokens': 417, 'input_token_details': {'audio': 0, 'cache_read': 0}, 'output_token_details': {'audio': 0, 'reasoning': 0}}