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

fix: tool parameters #168

Merged
merged 7 commits into from
Feb 27, 2025
Merged

fix: tool parameters #168

merged 7 commits into from
Feb 27, 2025

Conversation

maksDev123
Copy link
Contributor

@maksDev123 maksDev123 commented Feb 26, 2025

Important

This PR refines tool parameter handling by updating input schemas, validation, and logging across agents, tools, and prompts.

  • Behavior:
    • Updated AgentInputSchema in base.py to include role in context for validation.
    • Changed role default to empty string in Agent class in base.py.
    • Updated ReActAgent in react.py to use InferenceMode.DEFAULT.
    • Added error logging for JSON parsing in parse_xml_and_extract_info() in react.py.
  • Input Schemas:
    • Added is_accessible_to_agent=False to several fields in ExaInputSchema in exa_search.py and TavilyInputSchema in tavily.py.
  • Functions:
    • Moved parse_bytes_to_base64() to VisionMessage in prompts.py and reused it in parse_image_url_parameters().
  • Misc:
    • Removed redundant code in prompts.py related to parse_bytes_to_base64() and parse_image_url_parameters().
    • Minor logging changes in react.py and exa_search.py.

This description was created by Ellipsis for 8d68160. It will automatically update as commits are pushed.

@maksDev123 maksDev123 requested a review from a team as a code owner February 26, 2025 15:27
@maksDev123 maksDev123 changed the title fix: tools parameters fix: tool parameters Feb 26, 2025
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to a57ec30 in 2 minutes and 20 seconds

More details
  • Looked at 219 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 11 drafted comments based on config settings.
1. dynamiq/nodes/tools/exa_search.py:25
  • Draft comment:
    Ensure 'is_accessible_to_agent=False' is intentional for all added fields. Verify agents shouldn’t access these parameters.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50%
    The comment is asking the PR author to ensure that a specific behavior is intentional, which violates the rule against asking for confirmation of intention. However, it does point out a specific setting ('is_accessible_to_agent=False') that might be critical to the functionality, which could be useful if rephrased to suggest checking or confirming the logic rather than asking for verification.
2. dynamiq/nodes/tools/tavily.py:15
  • Draft comment:
    Confirm that adding 'is_accessible_to_agent=False' to input schema fields (e.g. search_depth, topic) meets intended security/privacy needs.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to confirm their intention regarding a security/privacy change. This violates the rule against asking the author to confirm their intention or ensure behavior is intended.
3. dynamiq/prompts/prompts.py:140
  • Draft comment:
    Good refactor removing duplicate parse_bytes_to_base64 and parse_image_url_parameters; ensure consolidated logic handles all file types as expected.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to ensure that the consolidated logic works as expected after removing duplicate functions. This falls under the category of asking the author to ensure behavior, which is against the rules.
4. dynamiq/prompts/prompts.py:72
  • Draft comment:
    Typo in docstring: 'formated' should be 'formatted'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. dynamiq/nodes/tools/exa_search.py:25
  • Draft comment:
    Added 'is_accessible_to_agent' metadata to multiple fields in ExaInputSchema. Ensure that downstream logic respects these restrictions consistently.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to ensure that downstream logic respects the new metadata restrictions. This falls under the category of asking the author to ensure behavior, which is against the rules.
6. dynamiq/nodes/tools/tavily.py:16
  • Draft comment:
    Input schema fields in TavilyInputSchema now include 'is_accessible_to_agent' metadata. Confirm that access control is applied uniformly throughout.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to confirm that access control is applied uniformly, which violates the rule against asking for confirmation of intention or behavior. It does not provide a specific code suggestion or point out a specific issue that needs addressing.
7. dynamiq/prompts/prompts.py:130
  • Draft comment:
    Refactored VisionMessage by moving parse_bytes_to_base64 and updating parse_image_url_parameters to use it. Verify that image data conversion remains consistent post-refactor.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the PR author to verify that the image data conversion remains consistent after the refactor. This falls under the category of asking the author to ensure the behavior is intended or to double-check things, which is against the rules.
8. dynamiq/nodes/tools/exa_search.py:31
  • Draft comment:
    Typo in the description for 'use_autoprompt': consider changing “a Exa query” to “an Exa query” for correct article usage.
  • Reason this comment was not posted:
    Comment was on unchanged code.
9. dynamiq/nodes/tools/exa_search.py:94
  • Draft comment:
    Typo in the description for 'use_autoprompt': consider changing “a Exa query” to “an Exa query” for correct article usage.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
10. dynamiq/prompts/prompts.py:73
  • Draft comment:
    Typo in the docstring of the format_message method: 'Returns formated copy of message' should be 'Returns formatted copy of message'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
11. dynamiq/prompts/prompts.py:123
  • Draft comment:
    The docstring for VisionMessage lists the types as 'VisionTextMessage | VisionImageMessage', but the actual types used are VisionMessageTextContent and VisionMessageImageContent. Consider updating the docstring to maintain consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_iZMAGDXVReyPczkF


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

github-actions bot commented Feb 26, 2025

Coverage

Coverage Report •
FileStmtsMissCoverMissing
dynamiq/nodes/agents
   base.py3328474%130, 195, 208, 211–213, 217–219, 241, 245, 249, 271, 273, 306–307, 331, 333, 350–351, 357–358, 361–362, 382–383, 387–388, 414–416, 420–425, 430, 435, 440, 444, 449, 467, 476–477, 481–482, 486–488, 494, 498–500, 502, 508–512, 514–515, 535–540, 546, 551, 583, 588, 618, 652, 654–656, 660, 664–667, 670, 679
   react.py27021620%245, 262, 272–275, 277–280, 282, 286–287, 291–294, 296–300, 317, 319, 323–325, 329, 335–336, 338, 342–343, 348–352, 354–355, 357–360, 371, 374, 398–399, 401, 408, 410, 412–416, 418, 420–421, 429–430, 432–434, 436, 440, 442–447, 455, 457–458, 460–461, 470–472, 474–476, 480–481, 485, 487, 489–494, 501, 503–504, 506, 508–509, 518–520, 522–524, 526–528, 530–534, 541, 543–544, 546–547, 556–558, 560–561, 563–568, 575, 577–578, 580–581, 590, 592–593, 595–597, 599–600, 602–604, 613, 621, 623–625, 627–628, 633, 635–637, 644, 650–653, 655, 659–660, 664–670, 672, 674–675, 677–678, 681, 683, 710, 716–717, 719, 722–724, 726–727, 729–730, 733, 739–740, 744–748, 750, 774, 778, 780, 786–790, 792–800, 802
dynamiq/nodes/tools
   exa_search.py85594%111–112, 209–211
   tavily.py73691%150–152, 165, 172–173
dynamiq/prompts
   prompts.py1472086%142, 149, 169, 181, 197, 213, 216, 234, 277, 290, 325–330, 332, 334, 355, 362
TOTAL11908363069% 

Tests Skipped Failures Errors Time
416 0 💤 0 ❌ 0 🔥 45.927s ⏱️

@maksDev123
Copy link
Contributor Author

What do you think is the best strategy for parameters. It is a tradeoff between scalability and robustness (particularly for smaller models).

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 06666cc in 28 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. dynamiq/prompts/prompts.py:216
  • Draft comment:
    Prefer consistent formatting: remove extra spaces around '=' when passing keyword arguments.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. dynamiq/prompts/prompts.py:216
  • Draft comment:
    Using keyword arguments for Message creation improves clarity and prevents positional misinterpretation. Also, consider removing extra spaces around '=' (i.e., use role=self.role) to align with PEP 8 style.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. dynamiq/prompts/prompts.py:73
  • Draft comment:
    Typographical Error: In the docstring for Message.format_message, 'formated' should be corrected to 'formatted'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_nLMy0cLI9DGrItha


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on bc42425 in 33 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. dynamiq/prompts/prompts.py:215
  • Draft comment:
    Minor formatting change: Removed extra whitespace around '=' for consistency. No logic change.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. dynamiq/prompts/prompts.py:215
  • Draft comment:
    Minor formatting fix: removed extra spaces between keyword arguments for consistency.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply states a minor formatting change that was made, which does not align with the rules provided.
3. dynamiq/prompts/prompts.py:73
  • Draft comment:
    Typographical error: The docstring in Message.format_message says 'Returns formated copy of message'. Please change 'formated' to 'formatted'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_jqQksgFQY3qZCFqf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 2f5fb47 in 38 seconds

More details
  • Looked at 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. dynamiq/nodes/agents/base.py:121
  • Draft comment:
    Formatting update only; no functional changes. Consider verifying that context values are not None for better safety.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. dynamiq/nodes/agents/base.py:121
  • Draft comment:
    Improved list formatting enhances readability. Consider adding checks for None values from context (e.g. for 'input_message' or 'role') to avoid potential issues.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. dynamiq/nodes/agents/base.py:563
  • Draft comment:
    Typo: The variable 'formated_prompt_blocks' is misspelled. Consider renaming it to 'formatted_prompt_blocks' for clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_TnLA63jz4lhZfXjq


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 1424df0 in 1 minute and 30 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. dynamiq/nodes/agents/react.py:166
  • Draft comment:
    Ensure removal of the phrase 'Simply give a clear and concise answer.' from REACT_BLOCK_OUTPUT_FORMAT is intentional. Verify corresponding documentation.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
    This comment violates several rules:
  1. It asks to "verify" and "ensure" something is intentional, which is explicitly called out as not useful
  2. It asks to verify documentation, which is speculative
  3. The change is very simple - just removing a line from a string constant
  4. There's no evidence that removing this line would cause any issues
    Could removing this instruction to "give a clear and concise answer" make the LLM's responses worse? Should we be more cautious about modifying LLM prompts?
    While prompt changes can affect LLM behavior, this particular line was redundant with the general goal of clear communication. The remaining instruction to "avoid phrases like 'based on...'" still guides the LLM toward direct answers.
    Delete this comment. It asks for verification without providing evidence of any actual issues, and the change is simple enough that we can assume it was intentional.
2. dynamiq/nodes/agents/react.py:166
  • Draft comment:
    Removed the phrase 'Simply give a clear and concise answer.' from REACT_BLOCK_OUTPUT_FORMAT. Confirm that this change is intentional and that it doesn't lead to inconsistent guidance in your tool prompt instructions.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
    The comment asks the author to confirm their intention, which directly violates the rule "Do NOT ask the PR author to confirm their intention, to explain, to double-check things, to ensure the behavior is intended...". The comment doesn't point out any actual issue - it just asks for confirmation.
    Could this change have unintended consequences that should be pointed out? Could removing guidance about being concise lead to worse output?
    Even if there could be consequences, the comment doesn't point them out - it just asks for confirmation. If there are specific issues, they should be stated directly rather than asking the author to think about them.
    Delete this comment. It violates the rule about asking for confirmation and doesn't provide any concrete value or point out specific issues.
3. dynamiq/nodes/agents/react.py:84
  • Draft comment:
    Typo: Please change 'strickly' to 'strictly' in the instructions (line 84) to improve readability.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. dynamiq/nodes/agents/react.py:198
  • Draft comment:
    Typo in final_answer_function_schema: In the description for 'provide_final_answer', please remove the extra 'if' so that it reads 'Function should be called when you can answer the initial request'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_zeuw9DlCBnyN8V8d


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Collaborator

@acoola acoola left a comment

Choose a reason for hiding this comment

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

LGTM +1

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 8d68160 in 1 minute and 13 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. dynamiq/nodes/agents/react.py:227
  • Draft comment:
    Changing default inference_mode from XML to DEFAULT may affect behavior in XML mode-specific branches. Ensure tests and documentation reflect this change.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    The comment is asking the author to ensure that tests and documentation reflect a change in default behavior. This is a request for confirmation and testing, which violates the rules. The comment does not provide a specific code suggestion or point out a specific issue with the code itself.
2. dynamiq/nodes/agents/react.py:227
  • Draft comment:
    Changed default inference_mode from XML to DEFAULT. Ensure this change is intentional, as it may alter the agent's behavior (e.g., prompt instructions and output parsing).
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
    This comment violates the rule "Do NOT ask the PR author to confirm their intention, to explain, to double-check things, to ensure the behavior is intended". The comment is just asking the author to verify their change, without providing evidence that the change is problematic. If there was a specific issue with using DEFAULT mode, the comment should point that out directly.
    Maybe this is actually a breaking change that could affect downstream users? Maybe there's a good reason to be cautious about changing defaults?
    While changing defaults can be impactful, the comment doesn't provide any evidence of problems. If there are specific compatibility or functionality concerns, those should be stated directly rather than just asking the author to "ensure" the change is intentional.
    Delete this comment. It violates the rule against asking authors to verify their intentions. If there are specific issues with using DEFAULT mode, those should be called out directly.
3. dynamiq/nodes/agents/react.py:80
  • Draft comment:
    Typographical error: In the REACT_BLOCK_INSTRUCTIONS string, please replace 'strickly' with 'strictly' to improve readability and consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_2K1YX214x8RoNdj6


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@maksDev123 maksDev123 merged commit 2fd7947 into main Feb 27, 2025
8 checks passed
@maksDev123 maksDev123 deleted the fix/tools_parameters branch February 27, 2025 11:43
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.

5 participants