File size: 1,980 Bytes
e67043b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Image Generation

Contributor: [Sihan Zhao](https://github.com/Sarah816)

# Image Generator Tool

This Markdown document provides an introduction to the `Image Generator` function implemented in the given code. The function is designed to generate an image based on a text description using the Steamship API.

## Function Summary

The `Image Generator` function is a tool that generates an image based on a text description. It utilizes the Steamship API to perform the image generation process.

## Usage

To use the `Image Generator` function, follow the steps below:

1. Set up the required configuration parameters.
2. Ensure that the `STEAMSHIP_API_KEY` environment variable is set.
3. Call the `generate_image` endpoint with a text query to generate an image.
4. The function returns the UUID (Universally Unique Identifier) of the generated image.

## Configuration

The `Image Generator` tool accepts the following configuration parameters:

- **Model Name**: Specifies the model to use for image generation. The default model is DALL-E.
- **Size**: Specifies the desired size of the generated image. The default size is 512x512.
- **Return URLs**: Determines whether to return public URLs for the generated images. By default, this option is disabled.
- **Steamship API Key**: The API key required to authenticate and use the Steamship API. It should be set as the `STEAMSHIP_API_KEY` environment variable.

## Endpoint

The `Image Generator` tool provides the following endpoint:

### `/generate_image`

- **Method**: GET
- **Parameters**:
  - `query`: The detailed text-2-image prompt describing the image to be generated.
- **Returns**:
  - The UUID of the generated image.

## Error Handling

If the `STEAMSHIP_API_KEY` is not provided or is empty, a `RuntimeError` is raised, indicating that the API key should be obtained from the Steamship website and added to the environment variables.

If the tool is unable to generate an image, a `RuntimeError` is raised.