llama-index-tools-openai-image-generation


Namellama-index-tools-openai-image-generation JSON
Version 0.4.0 PyPI version JSON
download
home_pageNone
Summaryllama-index tools openai_image_generation integration
upload_time2024-11-17 23:07:08
maintainermanelferreira_
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseMIT
keywords cv gpt-3 image openai vision
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OpenAI Image Generation Tool

This tool allows Agents to generate images using OpenAI's DALL-E model. To see more and get started, visit https://openai.com/blog/dall-e/

## Usage

This tool has a 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-openai/examples/multimodal_openai_image.ipynb).

### Usage with Agent

```python
from llama_index.tools.openai import OpenAIImageGenerationToolSpec

image_generation_tool = OpenAIImageGenerationToolSpec(
    api_key=os.environ["OPENAI_API_KEY"]
)

agent = OpenAIAgent.from_tools(
    [*image_generation_tool.to_tool_list()],
    verbose=True,
)

response = agent.query(
    "A pink and blue llama in a black background with the output"
)

print(response)
```

### Usage directly

```python
from llama_index.tools.openai import OpenAIImageGenerationToolSpec

image_generation_tool = OpenAIImageGenerationToolSpec(
    api_key=os.environ["OPENAI_API_KEY"]
)

image_data = image_generation_tool.image_generation(
    text="A pink and blue llama with a black background",
    response_format="b64_json",
)

image_bytes = base64.b64decode(image_data)

img = Image.open(BytesIO(image_bytes))

display(img)
```

`image_generation`: Takes an text input and generates an image

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-tools-openai-image-generation",
    "maintainer": "manelferreira_",
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "cv, gpt-3, image, openai, vision",
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/3b/47/0a40292f7f9a98bcf959018b9ca4ef6df1aa52c9cb9812dfbd3f7a11c105/llama_index_tools_openai_image_generation-0.4.0.tar.gz",
    "platform": null,
    "description": "# OpenAI Image Generation Tool\n\nThis tool allows Agents to generate images using OpenAI's DALL-E model. To see more and get started, visit https://openai.com/blog/dall-e/\n\n## Usage\n\nThis tool has a 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-openai/examples/multimodal_openai_image.ipynb).\n\n### Usage with Agent\n\n```python\nfrom llama_index.tools.openai import OpenAIImageGenerationToolSpec\n\nimage_generation_tool = OpenAIImageGenerationToolSpec(\n    api_key=os.environ[\"OPENAI_API_KEY\"]\n)\n\nagent = OpenAIAgent.from_tools(\n    [*image_generation_tool.to_tool_list()],\n    verbose=True,\n)\n\nresponse = agent.query(\n    \"A pink and blue llama in a black background with the output\"\n)\n\nprint(response)\n```\n\n### Usage directly\n\n```python\nfrom llama_index.tools.openai import OpenAIImageGenerationToolSpec\n\nimage_generation_tool = OpenAIImageGenerationToolSpec(\n    api_key=os.environ[\"OPENAI_API_KEY\"]\n)\n\nimage_data = image_generation_tool.image_generation(\n    text=\"A pink and blue llama with a black background\",\n    response_format=\"b64_json\",\n)\n\nimage_bytes = base64.b64decode(image_data)\n\nimg = Image.open(BytesIO(image_bytes))\n\ndisplay(img)\n```\n\n`image_generation`: Takes an text input and generates an image\n\nThis loader is designed to be used as a way to load data as a Tool in a Agent.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index tools openai_image_generation integration",
    "version": "0.4.0",
    "project_urls": null,
    "split_keywords": [
        "cv",
        " gpt-3",
        " image",
        " openai",
        " vision"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "48a6de9611742d91ab358093e06d6b14d24e580212bee2063fdbccdd9b969219",
                "md5": "a97179ce6d8b71cdbc20fc84acce49e9",
                "sha256": "cdc14c29c232229673f3898d64ecd23bc7c9e9882858fd2e854f7bf3f0ab2fec"
            },
            "downloads": -1,
            "filename": "llama_index_tools_openai_image_generation-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a97179ce6d8b71cdbc20fc84acce49e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 4207,
            "upload_time": "2024-11-17T23:07:07",
            "upload_time_iso_8601": "2024-11-17T23:07:07.856829Z",
            "url": "https://files.pythonhosted.org/packages/48/a6/de9611742d91ab358093e06d6b14d24e580212bee2063fdbccdd9b969219/llama_index_tools_openai_image_generation-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b470a40292f7f9a98bcf959018b9ca4ef6df1aa52c9cb9812dfbd3f7a11c105",
                "md5": "cbd693ff6fdeb2cabf6883e976e391bc",
                "sha256": "ffb80420e26d55e936eded4ca1bbbc4174216a8fbfad609759833dd6fc17e869"
            },
            "downloads": -1,
            "filename": "llama_index_tools_openai_image_generation-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cbd693ff6fdeb2cabf6883e976e391bc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3697,
            "upload_time": "2024-11-17T23:07:08",
            "upload_time_iso_8601": "2024-11-17T23:07:08.798093Z",
            "url": "https://files.pythonhosted.org/packages/3b/47/0a40292f7f9a98bcf959018b9ca4ef6df1aa52c9cb9812dfbd3f7a11c105/llama_index_tools_openai_image_generation-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-17 23:07:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-tools-openai-image-generation"
}
        
Elapsed time: 0.41397s