Loading...
Skip to main content

Module: core/image-gen

This module provides components for image generation.

Interfaces

Type Aliases

ImageGenComponent

Ƭ ImageGenComponent<T>: Component<T>

Type parameters

NameType
Textends ImageGenPropsWithChildren

Defined in

ai-jsx/src/core/image-gen.tsx:26


ImageGenPropsWithChildren

Ƭ ImageGenPropsWithChildren: ImageGenProps & { children: Node }

Defined in

ai-jsx/src/core/image-gen.tsx:22

Functions

Image

Image(props): Node

This component represents an image via a single url prop. It is a wrapper for the output of ImageGen to allow for first-class support of images.

The rendering of this component depends on the environment:

  • In terminal-based environments, this component will be rendered as a URL.
  • In browser-based environments, this component will be rendered as an img tag.

Parameters

NameTypeDescription
propsObject-
props.urlstringThe image URL.
props.children?NodeFallback content to be rendered when stringifying.
props.detail?stringThe level of detail required.
props.inputTokens?numberThe number of input tokens required.
props.modelName?stringThe model used for generating the image. Currently only used for debugging.
props.prompt?stringThe prompt used for generating the image. Currently only used for debugging.

Returns

Node

Defined in

ai-jsx/src/core/image-gen.tsx:100


ImageGen

ImageGen(«destructured», «destructured»): Element

This component can be used to perform an image generation.

Example

   <ImageGen size="256x256" numSamples={1}>
An image of a chicken riding a rocket ship
</ImageGen>

Parameters

NameType
«destructured»ImageGenPropsWithChildren
«destructured»RenderContext

Returns

Element

URL(s) to the generated image, wrapped in Image component(s).

Defined in

ai-jsx/src/core/image-gen.tsx:83


ImageGenProvider

ImageGenProvider<T>(«destructured», «destructured»): Element

An ImageGenProvider is used by ImageGen to access an underlying image-generation model.

Type parameters

NameType
Textends ImageGenPropsWithChildren

Parameters

NameType
«destructured»{ component?: ImageGenComponent<T> } & T
«destructured»RenderContext

Returns

Element

Defined in

ai-jsx/src/core/image-gen.tsx:54