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(agents-api): added anthropic call in chat endpoint + typespec changed to include imageurl in ChatInput #835

Open
wants to merge 27 commits into
base: dev
Choose a base branch
from

Conversation

Vedantsahai18
Copy link
Contributor

@Vedantsahai18 Vedantsahai18 commented Nov 14, 2024

Important

Added Anthropic API call in chat endpoint, updated models for image content, and improved tool formatting and error handling.

  • Behavior:
    • Added Anthropic API call in chat.py for tool types computer_20241022, bash_20241022, text_editor_20241022.
    • Updated request_anthropic() to format messages and call Anthropic API.
    • Modified tool formatting logic in chat.py for Anthropic tools.
  • Models:
    • Added ChatMLAnthropicImageContentPart and related models in models.tsp for Anthropic image content.
    • Updated ChatMLContentPart alias to include ChatMLAnthropicImageContentPart.
  • Misc:
    • Updated openapi-1.0.0.yaml to reflect changes in ChatInput and related schemas.
    • Added Source class in Chat.py, Entries.py, and Tasks.py for base64 image data.
    • Improved error handling in execute_integration.py and execute_system.py.
    • Updated Gunicorn configuration in gunicorn_conf.py for testing and debugging.
    • Added GEMINI_API_KEY to .env.example and docker-compose.yml.

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

Copy link
Contributor

@HamadaSalhab HamadaSalhab left a comment

Choose a reason for hiding this comment

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

Left you a comment on the typespec changes.

typespec/entries/models.tsp Show resolved Hide resolved
@Vedantsahai18 Vedantsahai18 marked this pull request as ready for review November 16, 2024 05:12
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. Reviewed everything up to 1bdc875 in 1 minute and 16 seconds

More details
  • Looked at 1606 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. agents-api/agents_api/autogen/Chat.py:165
  • Draft comment:
    There are multiple unused classes like ContentItemModel1, ContentItemModel3, etc. Consider removing them to clean up the code. This applies to other files as well.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code has multiple instances of unused classes like ContentItemModel1, ContentItemModel3, etc. These should be removed to clean up the code.
2. agents-api/agents_api/routers/sessions/chat.py:144
  • Draft comment:
    The filtered_tools variable is defined but not used in the client.beta.messages.create call. Ensure that the correct tools are being passed to the API call.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. integrations-service/integrations/utils/integrations/remote_browser.py:231
  • Draft comment:
    Consider using a dictionary to map key combinations for better readability and maintainability instead of multiple inline conditions.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The press_key function in remote_browser.py has a hardcoded mapping for certain keys. This could be improved by using a dictionary for better readability and maintainability.

Workflow ID: wflow_ole82FLotQgwUiOz


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/autogen/Entries.py Show resolved Hide resolved
agents-api/agents_api/routers/sessions/chat.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.

👍 Looks good to me! Incremental review on 615bd27 in 22 seconds

More details
  • Looked at 90 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/routers/sessions/chat.py:33
  • Draft comment:
    The import for get_handler_with_filtered_params is removed, but it is still used in the commented-out code. If you plan to uncomment this in the future, ensure the import is restored.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_SPDdj3fKhwrSUP1V


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

@creatorrr
Copy link
Contributor

Lgtm. If Hamada’s comments are addressed then merge

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 e4dc3f4 in 25 seconds

More details
  • Looked at 51 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. llm-proxy/litellm-config.yaml:24
  • Draft comment:
    Consider adding api_key: os.environ/GEMINI_API_KEY to ensure the GEMINI_API_KEY is utilized for the gemini-1.5-pro model.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment suggests a change that is already implemented for the new 'gemini-1.5-pro' models added in the diff. The existing 'gemini-1.5-pro' model at line 22 uses 'vertex_credentials', which might be a different configuration. The comment does not provide strong evidence that a change is required, as the configuration might be intentional.
    I might be missing the context of why 'vertex_credentials' is used instead of an API key for the 'gemini-1.5-pro' model at line 22. However, without strong evidence that this is incorrect, the comment seems speculative.
    The use of 'vertex_credentials' instead of an API key could be intentional for a specific environment or setup, and without evidence that this is incorrect, the comment should not be kept.
    The comment should be deleted as it suggests a change that is already implemented for the new models and does not provide strong evidence that the existing configuration is incorrect.

Workflow ID: wflow_n1LPUAFJXADQwxVh


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 c118e9c in 17 seconds

More details
  • Looked at 45 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/agents_api/activities/execute_integration.py:52
  • Draft comment:
    The condition checking for an error in integration_service_response can be simplified to if integration_service_response.get("error"):. This is more concise and Pythonic.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The change in the condition to check for 'error' in the response is correct, but the logic can be simplified.

Workflow ID: wflow_i2wfZVI5qur4J4WS


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 1ea6188 in 28 seconds

More details
  • Looked at 41 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/agents_api/activities/execute_system.py:99
  • Draft comment:
    Ensure handler is called with await if it is an async function to avoid unexpected behavior.
                return await handler(
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The code already has a check for coroutine functions and uses 'await' when necessary. The comment seems to be suggesting something that is already handled by the code logic. The comment is not necessary as the code is correctly structured to handle async functions.
    I might be missing some context about why the comment was made, but based on the code provided, it seems redundant. The code logic appears to be correct in handling async functions.
    The code explicitly checks for coroutine functions and uses 'await' appropriately, so the comment does not add value. The logic is clear and does not require additional comments.
    The comment should be deleted as the code already handles the use of 'await' for async functions correctly, making the comment redundant.

Workflow ID: wflow_LUW5x3rnaFHVnyd0


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/routers/sessions/chat.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 a59934a in 21 seconds

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

Workflow ID: wflow_w5MWfPeL4DQqbdvL


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.

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 1b900d4 in 12 seconds

More details
  • Looked at 56 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/gunicorn_conf.py:8
  • Draft comment:
    The logic for determining the number of workers is duplicated in both agents-api/gunicorn_conf.py and integrations-service/gunicorn_conf.py. Consider refactoring this logic into a shared utility to avoid code duplication.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The logic for determining the number of workers is duplicated in both gunicorn configuration files. This should be refactored to avoid code duplication.

Workflow ID: wflow_0flx7eGJIleMxtp2


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 3c71595 in 11 seconds

More details
  • Looked at 64 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/workflows/task_execution/helpers.py:70
  • Draft comment:
    Consider creating a helper function to append a new workflow to the existing list of workflows. This pattern is repeated in execute_switch_branch, execute_if_else_branch, execute_foreach_step, execute_map_reduce_step, and execute_map_reduce_step_parallel.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code is repeating the pattern of appending a new workflow to the existing list of workflows in multiple functions. This pattern is consistent and seems intentional, but it could be optimized by creating a helper function to avoid repetition and potential errors in future modifications.

Workflow ID: wflow_QgO8Xau45Xb9pW3S


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 8c6329b in 36 seconds

More details
  • Looked at 107 lines of code in 4 files
  • Skipped 1 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. agents-api/agents_api/routers/sessions/chat.py:238
  • Draft comment:
    Consider adding exception handling for the API call to handle potential errors gracefully.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_hgPQt3Bb6boU9hDi


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/routers/sessions/chat.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.

👍 Looks good to me! Incremental review on 057e60b in 31 seconds

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

Workflow ID: wflow_XdvDSpfpBnb8cMw7


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 25aa9a0 in 49 seconds

More details
  • Looked at 373 lines of code in 22 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. agents-api/agents_api/activities/embed_docs.py:16
  • Draft comment:
    The use of deep=True in the auto_blob_store decorator is consistent across multiple files. Ensure this change is necessary and does not introduce unintended side effects. This applies to other files as well.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of deep=True in the auto_blob_store decorator is consistent across multiple files. This change should be verified to ensure it is necessary and does not introduce any unintended side effects.
2. agents-api/agents_api/common/storage_handler.py:44
  • Draft comment:
    The load_from_blob_store_if_remote function now handles RemoteList by converting it to a list. Ensure this change is necessary and does not introduce unintended side effects.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The load_from_blob_store_if_remote function now handles RemoteList by converting it to a list. This change should be verified to ensure it is necessary and does not introduce any unintended side effects.

Workflow ID: wflow_yHNgvxFJNcH7H0xI


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.

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.

4 participants