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

Feat - Introducing FileInputURL SDK Type for LLM Applications #949

Merged
merged 4 commits into from
Nov 28, 2023

Conversation

aybruhm
Copy link
Member

@aybruhm aybruhm commented Nov 28, 2023

Description

This PR marks the initial implementation stage of integrating file input functionality, such as images and PDFs, into our LLM applications.

To utilize the SDK input, follow these steps:

import agenta as ag
from agenta import TextParam, FloatParam, FileInputURL

..................
# more code here
..................

ag.init(app_name="linkedin_generator", base_name="app")

..................
# more code here
..................

@ag.entrypoint
def generate(
    attachment_url: FileInputURL,
) -> dict:
    # handle attachment_url

Related Issue

Closes first issue in #944

@aybruhm aybruhm requested a review from mmabrouk November 28, 2023 13:39
Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @aybruhm !
Can you please create an example application that uses an image based on openai

from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model="gpt-4-vision-preview",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What’s in this image?"},
                {
                    "type": "image_url",
                    "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
                },
            ],
        }
    ],
    max_tokens=300,
)

print(response.choices[0])

(see https://platform.openai.com/docs/api-reference/chat/create for documentation)

@mmabrouk mmabrouk merged commit cc39449 into feat/file-input-support-playground Nov 28, 2023
2 of 3 checks passed
@aakrem aakrem deleted the gh/file-input-sdk-type branch January 19, 2024 08:12
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