Module: lib/openai
This module provides interfaces to OpenAI's various models.
Classes
Type Aliases
ChatCompletionDelta
Ƭ ChatCompletionDelta: Merge
<CreateChatCompletionResponse
, { choices
: { delta
: Partial
<ChatCompletionResponseMessage
> ; finish_reason?
: string
}[] }>
Defined in
packages/ai-jsx/src/lib/openai.tsx:356
Variables
SSE_FINAL_EVENT
• Const
SSE_FINAL_EVENT: "[DONE]"
Defined in
packages/ai-jsx/src/lib/openai.tsx:120
SSE_PREFIX
• Const
SSE_PREFIX: "data: "
Defined in
packages/ai-jsx/src/lib/openai.tsx:118
SSE_TERMINATOR
• Const
SSE_TERMINATOR: "\n\n"
Defined in
packages/ai-jsx/src/lib/openai.tsx:119
openAiClientContext
• Const
openAiClientContext: Context
<OpenAIApi
>
Defined in
packages/ai-jsx/src/lib/openai.tsx:65
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:604
OpenAI
▸ OpenAI(«destructured»
): Node
An AI.JSX component that invokes an OpenAI Large Language Model.
Parameters
Name | Type |
---|---|
«destructured» | Object |
Returns
Defined in
packages/ai-jsx/src/lib/openai.tsx:86
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:369
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 |