Metadata-Version: 2.1
Name: llama-index-tools-text-to-image
Version: 0.3.0
Summary: llama-index tools text_to_image integration
License: MIT
Author: Your Name
Author-email: you@example.com
Maintainer: ajhofmann
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: llama-index-core (>=0.12.0,<0.13.0)
Requires-Dist: matplotlib (>=3.8.2,<4.0.0)
Requires-Dist: openai (>=1.1.0)
Requires-Dist: pillow (>=10.2.0,<11.0.0)
Description-Content-Type: text/markdown

# Text to Image Tool

This tool allows Agents to use the OpenAI Image endpoint to generate and create variations of images.

## Usage

This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-text-to-image/examples/text_to_image.ipynb)

Another example showcases retrieval augmentation over a knowledge corpus with text-to-image. [Notebook](https://github.com/run-llama/llama_index/blob/main/llama-index-integrations/tools/llama-index-tools-text-to-image/examples/text_to_image-pg.ipynb).

```python
from llama_index.tools.text_to_image import TextToImageToolSpec
from llama_index.agent.openai import OpenAIAgent

openai.api_key = "sk-your-key"
tool_spec = TextToImageToolSpec()
# OR
tool_spec = TextToImageToolSpec(api_key="sk-your-key")

agent = OpenAIAgent.from_tools(tool_spec.to_tool_list())

agent.chat("show 2 images of a beautiful beach with a palm tree at sunset")
agent.chat("make the second image higher quality")
```

`generate_images`: Generate images from a prompt, specifying the number of images and resolution
`show_images`: Show the images using matplot, useful for Jupyter notebooks
`generate_image_variation`: Generate a variation of an image given a URL.

This loader is designed to be used as a way to load data as a Tool in a Agent.

