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

Add support for various tool types #691

Closed
wants to merge 13 commits into from
Closed

Conversation

whiterabbit1983
Copy link
Contributor

@whiterabbit1983 whiterabbit1983 commented Oct 17, 2024

Important

Adds support for api_call, integration, and system tool types, updating workflows and dependencies accordingly.

  • Behavior:
    • Adds support for api_call, integration, and system tool types in prompt_step.py and task_execution/__init__.py.
    • Updates execute_system() in execute_system.py to handle empty arguments.
  • Functions:
    • Introduces make_function_call() in prompt_step.py to format tool calls.
    • Adds run_api_call(), run_integration_call(), and run_system_call() in task_execution/__init__.py to execute respective tool types.
  • Misc:
    • Adds msgpack dependency in pyproject.toml.
    • Minor type casting in tasks.py to handle HTTP errors.

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

Copy link
Contributor

@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 2c8a0af in 28 seconds

More details
  • Looked at 379 lines of code in 5 files
  • Skipped 1 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. agents-api/agents_api/activities/task_steps/prompt_step.py:36
  • Draft comment:
    Ensure ApiCallDef.model_fields.keys() is the correct way to access model fields. If model_fields is not a valid attribute, this could lead to runtime errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The make_function_call function in prompt_step.py is using ApiCallDef.model_fields.keys() which might not be the correct way to access model fields. This could lead to potential issues if the model fields are not accessed correctly.
2. agents-api/agents_api/activities/task_steps/prompt_step.py:35
  • Draft comment:
    Using k.rstrip("_") to modify keys might lead to unexpected behavior if keys do not end with an underscore. Ensure this is the intended behavior.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In prompt_step.py, the make_function_call function is using k.rstrip("_") to modify keys. This could lead to unexpected behavior if keys do not end with an underscore. It's better to ensure that keys are intended to be modified this way.
3. agents-api/agents_api/workflows/task_execution/__init__.py:173
  • Draft comment:
    Ensure tool_call contains a "system" key before accessing it. If not, this could lead to issues when creating SystemDef.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In task_execution/__init__.py, the run_system_call function is using tool_call.get("system"). If tool_call does not have a "system" key, this will return None, which could lead to issues when creating SystemDef.
4. agents-api/agents_api/workflows/task_execution/__init__.py:134
  • Draft comment:
    Replacing json_ with json in arguments could lead to issues if json_ is not intended to be replaced or if json already exists. Ensure this is the intended behavior.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In task_execution/__init__.py, the run_api_call function modifies arguments by replacing json_ with json. This could lead to issues if json_ is not intended to be replaced or if json already exists in arguments.

Workflow ID: wflow_2ru7TQmyB3MVGjSt


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

Copy link
Contributor

@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 44e4c13 in 33 seconds

More details
  • Looked at 304 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. agents-api/agents_api/common/exceptions/tasks.py:125
  • Draft comment:
    Unnecessary use of cast here. The isinstance check already ensures the type, making cast redundant.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The cast function is used for type hinting and does not change the runtime behavior. Since the isinstance check already ensures that error is of type httpx.HTTPStatusError, the cast is indeed redundant for runtime purposes. However, it might be used for static type checking purposes. The comment is technically correct, but it might be useful for static analysis tools.
    I might be overlooking the importance of cast for static type checking, which can be beneficial for code maintainability and readability, even if it seems redundant at runtime.
    While cast might be useful for static type checking, the comment is correct in pointing out that it is not necessary for runtime behavior. The decision to keep or remove the cast should be based on the project's conventions regarding type hinting and static analysis.
    The comment is correct in identifying the redundancy of cast after an isinstance check. However, the decision to keep or remove the cast depends on the project's type hinting practices. The comment should be kept as it highlights a potential simplification in the code.
2. agents-api/agents_api/activities/task_steps/prompt_step.py:153
  • Draft comment:
    Ensure tools_mapping is applied to all tool calls, not just the first one. Consider iterating over choice.message.tool_calls.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_1ZvqpGVze3FiWu9y


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

Copy link
Contributor

@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 cbccd3e in 16 seconds

More details
  • Looked at 153 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. agents-api/agents_api/activities/task_steps/prompt_step.py:33
  • Draft comment:
    Consider refactoring the repeated pattern for constructing the parameters dictionary in make_function_call to improve code readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The make_function_call function has a repeated pattern for constructing the parameters dictionary. This can be refactored to improve code readability and maintainability.
2. agents-api/agents_api/activities/task_steps/prompt_step.py:89
  • Draft comment:
    Consider refactoring the repeated pattern for constructing the parameters dictionary in make_function_call to improve code readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The make_function_call function has a repeated pattern for constructing the parameters dictionary. This can be refactored to improve code readability and maintainability.
3. agents-api/agents_api/activities/task_steps/prompt_step.py:125
  • Draft comment:
    Consider refactoring the repeated pattern for constructing the parameters dictionary in make_function_call to improve code readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The make_function_call function has a repeated pattern for constructing the parameters dictionary. This can be refactored to improve code readability and maintainability.

Workflow ID: wflow_JU4Wd3NIEnEzT8Cc


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

Copy link
Contributor

sweep-ai bot commented Oct 28, 2024

Hey @whiterabbit1983, here is an example of how you can ask me to improve this pull request:

@Sweep Add unit tests for the new `make_function_call()` utility in `prompt_step.py` that test formatting of different tool types:
- Test formatting a function tool
- Test formatting an API call tool
- Test formatting an integration tool
- Test formatting a system tool
- Test error case when an unsupported tool type is provided

📖 For more information on how to use Sweep, please read our documentation.

Copy link
Contributor

@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 e3e69c0 in 11 seconds

More details
  • Looked at 153 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/agents_api/activities/task_steps/prompt_step.py:33
  • Draft comment:
    Consider refactoring the repeated code for constructing the parameters dictionary in make_function_call to improve readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 40%
    The make_function_call function has a lot of repeated code for constructing the parameters dictionary. This can be refactored to improve readability and maintainability.

Workflow ID: wflow_0qC3ATDYWRTXcutp


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

Copy link
Contributor

@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.

❌ Changes requested. Incremental review on 4d8a55c in 23 seconds

More details
  • Looked at 153 lines of code in 1 files
  • Skipped 1 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_dRQcbeQmYdYeAb4D


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

agents-api/agents_api/activities/task_steps/prompt_step.py Outdated Show resolved Hide resolved
Copy link
Contributor

@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.

❌ Changes requested. Incremental review on 5fd9757 in 1 minute and 6 seconds

More details
  • Looked at 335 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. README-FR.md:84
  • Draft comment:
    The link for 'Appels directs api_calls' is not correctly formatted. It should be [Appels directs api_calls](#direct-api_calls) to ensure proper navigation.
  • Reason this comment was not posted:
    Marked as duplicate.
2. README-JA.md:84
  • Draft comment:
    The link for '直接の api_calls' is not correctly formatted. It should be [直接の api_calls](#direct-api_calls) to ensure proper navigation.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_x0fQ0NyUQpwO9APn


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

README-CN.md Outdated Show resolved Hide resolved
Copy link
Contributor

@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.

Skipped PR review on cdd1334 because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.

Copy link
Contributor

@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.

Skipped PR review on 7aec8fd because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.

whiterabbit1983 and others added 5 commits October 30, 2024 12:35
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Signed-off-by: Diwank Singh Tomer <[email protected]>
Copy link
Contributor

@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.

Skipped PR review on 3bc9911 because no changed files had a supported extension. If you think this was in error, please contact us and we'll fix it right away.

@creatorrr
Copy link
Contributor

Closing in favor of #789

@creatorrr creatorrr closed this Oct 31, 2024
@creatorrr creatorrr deleted the f/agent-tool-calls branch October 31, 2024 04:04
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.

2 participants