Skip to content

Commit

Permalink
Add new functions for image generation with DALL-E 3
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplorerGT92 authored and ExplorerGT92 committed Jan 7, 2024
1 parent 238e637 commit f375b53
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
44 changes: 44 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,13 @@ async def main():

# Define core tools here
tools = [
{
"type": "function",
"function": {
"name": "get_current_date_time",
"description": "Get the current date and time from the local machine.",
},
},
{
"type": "function",
"function": {
Expand Down Expand Up @@ -507,6 +514,43 @@ async def main():
},
},
},
{
"type": "function",
"function": {
"name": "generate_an_image_with_dalle3",
"description": "Generate an image with DALL-E 3.",
"parameters": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "The prompt to use for image generation.",
},
"n": {
"type": "integer",
"description": "The number of images to generate.",
},
"size": {
"type": "string",
"description": "The image size to generate.",
},
"quality": {
"type": "string",
"description": "The image quality to generate.",
},
"style": {
"type": "string",
"description": "The image style to generate.",
},
"response_format": {
"type": "string",
"description": "The response format to use for image generation.",
},
},
"required": ["prompt"],
},
},
},
]

# Use the load_plugins_and_get_tools function to conditionally add tools
Expand Down
2 changes: 1 addition & 1 deletion utils/openai_dalle_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
openai_org_id = OPENAI_ORG_ID

# Create an OpenAI client instance using keyword arguments
client = OpenAI(api_key=api_key, organization=openai_org_id, timeout=10)
client = OpenAI(api_key=api_key, organization=openai_org_id, timeout=60)

# Create an AsyncOpenAI client instance using keyword arguments
client_async = AsyncOpenAI(api_key=api_key, organization=openai_org_id, timeout=60)
Expand Down

0 comments on commit f375b53

Please sign in to comment.