Skip to main content

llama-index tools text_to_image integration

Project description

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

Another example showcases retrieval augmentation over a knowledge corpus with text-to-image. Notebook.

from llama_index.tools.text_to_image import TextToImageToolSpec
from llama_index.agent 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. See here for examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_text_to_image-0.1.4.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page