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

Added new Multimodal AI Block utilizing openrouter's API Service. #8290

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

Conversation

ymrohit
Copy link
Contributor

@ymrohit ymrohit commented Oct 10, 2024

This PR introduces the MultimodalAIBlock class, a new block that integrates multimodal AI models via OpenRouter API. It allows users to input a text prompt and an image URL, and select from several multimodal models for analysis. The block processes the inputs and returns a response based on the selected AI model.

ymrohit and others added 29 commits September 29, 2024 07:27
@ymrohit ymrohit requested a review from a team as a code owner October 10, 2024 13:55
Copy link

PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 Security concerns

API Key Exposure:
The OpenRouter API key is being stored in the application's settings and passed directly to the OpenAI client. While it's not directly exposed in the code, there's a risk of it being logged or exposed through error messages. Consider implementing additional safeguards to protect the API key, such as encrypting it in storage and masking it in logs.

⚡ Recommended focus areas for review

Error Handling
The error handling in the run method is very generic. It catches all exceptions and returns them as strings. This might expose sensitive information or internal errors to the user. Consider implementing more specific error handling and providing user-friendly error messages.

Input Validation
There's no validation for the image_url input. The code should check if the URL is valid and accessible before passing it to the API. This could prevent runtime errors and improve user experience.

API Key Security
The API key is being passed directly to the OpenAI client. Consider implementing a more secure method of handling API keys, such as using environment variables or a secrets management system.

Copy link

netlify bot commented Oct 10, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit be1b253
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67220d851c41140008d6dd1b

@github-actions github-actions bot added size/l and removed size/m labels Oct 10, 2024
@aarushik93 aarushik93 changed the base branch from master to dev October 14, 2024 15:27
@aarushik93
Copy link
Contributor

thanks for the PR @ymrohit - just curious there's no speech modality models available via Openrouter as of now right?

@ymrohit
Copy link
Contributor Author

ymrohit commented Oct 17, 2024

@aarushik93 I don't think there is any speech modality models available via openrouter at the moment.

aarushik93
aarushik93 previously approved these changes Oct 17, 2024
@github-actions github-actions bot added the platform/frontend AutoGPT Platform - Front end label Oct 24, 2024
@github-actions github-actions bot removed the platform/frontend AutoGPT Platform - Front end label Oct 25, 2024
@ymrohit ymrohit requested a review from a team as a code owner October 30, 2024 10:42
@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Oct 30, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

DATABASE_URL: "AgAGn36yLuB4z1eh1MuBkUt3EydFYVoFi4v/XC7JgfdVyt5cMI9c59rv1Jztrep/TejpeJVPYKuyR07TH9d96Lc+8ALXSNZKCD8Q57/vqnaMRjPvnSwVaLzdx57F66953y2p6244QXpbLHaVGHG0ZowV0rY4XpU6VcmQZnSbSVyBXS+ZcYjF5AYN31+0TWTG8RRVAJ1WFA6Jq4fUtLokaZTr5+pPy4FGoEdBZJVAgNVBPNe6XIrCTJL7N/zwJxUWkqF1nUTWkr017SAodgicQbogcvOcHclgZLEf60nRPbxYUiLJ1uzcBGMT1Ze8n3TdIi5uMvqQ5fb/rHqyEBGjpcOPhZR5yZTeLVhdxOPoQ2gzMVfASGbfzrueGFq0SGKn1P6Vm1zboVD39/EunEfZ4iXULRVeqIXBZ7jhBIkaYx/NwX7LkaUfv+mpEI6xhYewHT9QH/QXlTjN5XAMERryJrAlOuEe6cv0nz7Up+sLkesPLKDaWXkcoKDhgA3XP1aTTgn2i8nzAOzB9q+Y05amEGl7Z1YYtVD/2pR96sZhaL1YcS32WP03HyZ3+ZRM1cq9AgEE776iMsOAgzbETj+Li6l/Oc2i8Nb9dSwjdz/fAjR9P6v3+JPl0Zl71P8Y7RKDawXyzfaNGOOl1lBeY3CVe+t3duSOdO7PuQOVxbGYIlqgSs5hdLRmTeQ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ImOu8o/pKG0gNzEtyeSEEsegmCiaxs4Wi+/jVodU8CgfrYN3xkgi7QuD2fMs/zz+sv25LDg8LR1mIvkv+W/PkbqoVx3UAUXL7ZM+UvkFqie+69C/kwoH51xPaYi+FajSzql+VdhDc28aFkwrDApenyLbyKAHSnplWqpFDVtcQK4dL7K9EhRkUnWORNHiYT+N0Ras5tw1ief481nDud29nhlQ+5HIHGK5QouKmA1yJIJqavbzsDf7n+nWCwULIWXGi5d8A23e8vZAuF2CInUHAmP8d+xBDRx8aATZigoOM0GpHn5ljxNs0TCZ1HvQ8TjzQOpcgmBZ9l5Eod3y/PRhjGBRrcR550PAxpkjRj9VjfMN5NSiHVsGw7xKQr2+4yghv3VgSZFvOg1qUxmleJ9khwZq2Gel0uvhGStYw50x/C+EDMaJNQUaBDDbo5Bjy6/RNAEgrX0snQAZWCZSg4bsb4+2jRvo50W1wMr9076qOFViNn2YM+exIGXdmgggAKk7foZDZz1KgG+dAhKBXoUhXwHO9P450gq4xxDGSk0ZCe10OiszNkXVtmmE+Ryi5JjnbDsxLJP1tynrljFUb29VePt0zwZAhdnz0MQU1T9IVbjcKYB92h19lhcdgE="
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove

@@ -250,7 +250,7 @@ class Secrets(UpdateTrackingModel["Secrets"], BaseSettings):
replicate_api_key: str = Field(default="", description="Replicate API Key")
unreal_speech_api_key: str = Field(default="", description="Unreal Speech API Key")
ideogram_api_key: str = Field(default="", description="Ideogram API Key")

openrouter_api_key: str = Field(default="", description="OpenRouter API Key")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please migrate to new credentials system

Copy link
Contributor

@aarushik93 aarushik93 left a comment

Choose a reason for hiding this comment

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

Please see comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts platform/backend AutoGPT Platform - Back end platform/blocks size/l
Projects
Status: 🚧 Needs work
Development

Successfully merging this pull request may close these issues.

6 participants