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

Split out image generation function #75

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Split out image generation function #75

merged 1 commit into from
Aug 22, 2023

Conversation

justinh-rahb
Copy link
Collaborator

Summary

Introduced a new utility function, generate_image, to abstract the OpenAI image generation process.

Description

To enhance code clarity and provide a better abstraction, we've encapsulated the openai.Image.create method in a dedicated function named generate_image. This function simplifies the process of generating images using OpenAI's Image API and can be extended or modified more easily in the future.

Related Issue(s)

#47

Motivation and Context

  • Abstraction: By wrapping the openai.Image.create method, we provide a clearer interface for image generation, abstracting away the specific OpenAI details.
  • Maintainability: In the future, if there are changes or updates to the way we interact with the OpenAI Image API, we'll only need to update our utility function, preventing widespread changes throughout the codebase.
  • Scalability: The function can be extended to include more parameters or functionalities, such as error handling or logging, without affecting its callers.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • New feature (non-breaking change which adds functionality)

Checklist:

Go over all the following points, and put an x in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help!

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.

@justinh-rahb justinh-rahb added the enhancement New feature or request label Aug 22, 2023
@justinh-rahb justinh-rahb self-assigned this Aug 22, 2023
@justinh-rahb justinh-rahb linked an issue Aug 22, 2023 that may be closed by this pull request
@justinh-rahb justinh-rahb merged commit 1d34ffd into master Aug 22, 2023
@justinh-rahb justinh-rahb deleted the generate-image branch August 22, 2023 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Refactor] Modularize main.py
1 participant