Module: lib/openai
This module provides interfaces to OpenAI's various models.
Type Aliases
ValidChatModel
Ƭ ValidChatModel: "gpt-4"
| "gpt-4-0314"
| "gpt-4-0613"
| "gpt-4-32k"
| "gpt-4-32k-0314"
| "gpt-4-32k-0613"
| "gpt-3.5-turbo"
| "gpt-3.5-turbo-0301"
| "gpt-3.5-turbo-0613"
| "gpt-3.5-turbo-16k"
| "gpt-3.5-turbo-16k-0613"
Defined in
packages/ai-jsx/src/lib/openai.tsx:37
ValidCompletionModel
Ƭ ValidCompletionModel: "text-davinci-003"
| "text-davinci-002"
| "text-curie-001"
| "text-babbage-001"
| "text-ada-001"
Defined in
packages/ai-jsx/src/lib/openai.tsx:30
Variables
tokenizer
• Const
tokenizer: Object
Type declaration
Name | Type |
---|---|
decode | (tokens : number []) => string |
encode | (text : string ) => number [] |
Defined in
packages/ai-jsx/src/lib/openai.tsx:137
Functions
DalleImageGen
▸ DalleImageGen(numSamples
, size
): AsyncGenerator
<Element
, Element
[], unknown
>
Generates an image from a prompt using the DALL-E model.
See
https://platform.openai.com/docs/guides/images/introduction
Parameters
Name | Type | Description |
---|---|---|
numSamples | ImageGenPropsWithChildren | The number of images to generate. Defaults to 1. |
size | ComponentContext | The size of the image to generate. Defaults to 512x512 . |
Returns
AsyncGenerator
<Element
, Element
[], unknown
>
URL(s) to the generated image, wrapped in Image component(s).
Defined in
packages/ai-jsx/src/lib/openai.tsx:546
OpenAI
▸ OpenAI(«destructured»
): Node
An AI.JSX component that invokes an OpenAI Large Language Model.
Parameters
Name | Type |
---|---|
«destructured» | { children : Node ; chatModel? : ValidChatModel ; client? : OpenAI ; completionModel? : ValidCompletionModel } & ModelProps |
Returns
Defined in
packages/ai-jsx/src/lib/openai.tsx:98
OpenAIChatModel
▸ OpenAIChatModel(props
, «destructured»
): RenderableStream
Represents an OpenAI text chat model (e.g., gpt-4
).
Parameters
Name | Type |
---|---|
props | Object |
«destructured» | ComponentContext |
Returns
Defined in
packages/ai-jsx/src/lib/openai.tsx:289
OpenAICompletionModel
▸ OpenAICompletionModel(props
, «destructured»
): RenderableStream
Represents an OpenAI text completion model (e.g., text-davinci-003
).
Parameters
Name | Type |
---|---|
props | ModelProps & { children : Node } & { model : ValidCompletionModel ; logitBias? : Record <string , number > } |
«destructured» | ComponentContext |