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

Adding Support for Image Generation with AzureOpenAI #3239

Closed
wants to merge 1 commit into from

Conversation

marlenezw
Copy link

This PR adds support for image generation with the AzureOpenAI API and Dalle.
This capability was added to AzureOpenai in a recent release and more information can be found here.

The API should use the following structure that will work with Prompty and Promptflow

client = AzureOpenAI(
    api_version="2024-02-01",  
    api_key=os.environ["AZURE_OPENAI_API_KEY"],  
    azure_endpoint=os.environ['AZURE_OPENAI_ENDPOINT']
)

result = client.images.generate(
    model="dalle3", # the name of your DALL-E 3 deployment
    prompt="a close-up of a bear walking throughthe forest",
    n=1
)

@marlenezw marlenezw requested a review from a team as a code owner May 13, 2024 14:00
@@ -190,6 +190,8 @@ def get_open_ai_client_by_connection(connection, is_async=False):
def send_request_to_llm(client, api, parameters):
if api == "completion":
result = client.completions.create(**parameters)
if api == "images":
Copy link
Contributor

Choose a reason for hiding this comment

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

pls add some e2e test on this

Copy link
Author

Choose a reason for hiding this comment

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

Will do

@@ -190,6 +190,8 @@ def get_open_ai_client_by_connection(connection, is_async=False):
def send_request_to_llm(client, api, parameters):
if api == "completion":
result = client.completions.create(**parameters)
if api == "images":
result = client.images.generate(model=parameters['model'], prompt=parameters['messages'][0]['content'], n=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is it hard coded a n parameter here? How about other parameters?

Copy link
Author

Choose a reason for hiding this comment

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

I hardcoded that in when I was testing. I'll remove that

Copy link
Author

Choose a reason for hiding this comment

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

I haven't added any other parameters because I just wanted something that works for our build demo. These are the 3 main parameters for a quick start. I'll try and in more if I can.

Copy link

Hi, thank you for your interest in helping to improve the prompt flow experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment.

@github-actions github-actions bot added the no-recent-activity There has been no recent activity on this issue/pull request label May 28, 2024
Copy link

github-actions bot commented Jun 4, 2024

Hi, thank you for your contribution. Since there has not been recent engagement, we are going to close this out. Feel free to reopen if you'd like to continue working on these changes. Please be sure to remove the no-recent-activity label; otherwise, this is likely to be closed again with the next cleanup pass.

@github-actions github-actions bot closed this Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external no-recent-activity There has been no recent activity on this issue/pull request promptflow-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants