Skip to main content

Dall-E Tool

Description

DALL-E by OpenAI is an advanced AI model that generates images from textual descriptions. This tool allows you to integrate DALL-E's capabilities into your applications, enabling the creation of unique and creative visual content based on specified prompts.

Enhance your agents with:

  • AI-Generated Imagery: Create custom images based on textual input using state-of-the-art AI technology.
  • Creative Flexibility: Use specific prompts to guide the generation of visuals, tailored to your needs.
Try it Out in the Playground!

Before diving into the installation and coding, why not experiment directly with our interactive playground? Try it now!

Installation

Before using the tool, ensure you have created an API Key at OpenAI to enable image generation functionality.

Example

Utilize the DallEAPIWrapper tool as follows to enable your agent to generate images based on specific prompts:

import { DallEAPIWrapper } from "@langchain/openai";

const dallE = new DallEAPIWrapper({
n: 1, // If it is not 1 it gives an error
model: "dall-e-3", // Default
apiKey: 'ENV_OPENAI_API_KEY',
});

const creativeDesigner = new Agent({
name: 'Mary',
role: 'Creative Designer',
goal: 'Generate unique and creative visual content based on specific prompts and concepts.',
background: 'Digital Artist',
tools: [dallE]
});

Parameters

  • n Required. Number of images to generate. Must be set to 1 to avoid errors.
  • model Required. The model version to use. Default is "dall-e-3".
  • apiKey Required. The API key generated from OpenAI. Set 'ENV_OPENAI_API_KEY' as an environment variable or replace it directly with your API key.
We Love Feedback!

Is there something unclear or quirky in the docs? Maybe you have a suggestion or spotted an issue? Help us refine and enhance our documentation by submitting an issue on GitHub. We’re all ears!