Loading...
Skip to main content

Module: core/completion

This module provides the core completion components for AI.JSX.

Interfaces

References

AssistantMessage

Re-exports AssistantMessage


ConversationHistory

Re-exports ConversationHistory


FunctionCall

Re-exports FunctionCall


FunctionResponse

Re-exports FunctionResponse


SystemMessage

Re-exports SystemMessage


UserMessage

Re-exports UserMessage

Type Aliases

ModelComponent

Ƭ ModelComponent<T>: Component<T>

A Component that invokes a Large Language Model.

Type parameters

NameType
Textends ModelPropsWithChildren

Defined in

ai-jsx/src/core/completion.tsx:64


ModelPropsWithChildren

Ƭ ModelPropsWithChildren: ModelProps & { children: Node }

Represents a ModelProps with child @{link Node}s.

Defined in

ai-jsx/src/core/completion.tsx:57

Functions

ChatCompletion

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

Perform a Large Language Model call to do chat completion.

Every child of ChatCompletion must something that renders to a SystemMessage, UserMessage, or AssistantMessage.

Example

   function MyUserMessage() {
return <UserMessage>Hi, I'm a user message.</UserMessage>;
}

<ChatCompletion>
<SystemMessage>You are a nice person.</SystemMessage>
<MyUserMessage />
</ChatCompletion>

Parameters

NameType
«destructured»ModelProps & { children: Node } & Record<string, unknown>
«destructured»RenderContext

Returns

Element

Defined in

ai-jsx/src/core/completion.tsx:225


ChatProvider

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

A ChatProvider is used by ChatCompletion to access an underlying Large Language Model.

Type parameters

NameType
Textends ModelPropsWithChildren

Parameters

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

Returns

Element

Defined in

ai-jsx/src/core/completion.tsx:165


Completion

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

Perform a Large Language Mokdel call to do a completion.

In general, you should prefer to use ChatCompletion instead of Completion, because ChatCompletion uses better models.

Example

   <Completion>
Here's a list of three dog names:
</Completion>

==> 'Dottie, Murphy, Lucy'

Parameters

NameType
«destructured»ModelProps & { children: Node } & Record<string, unknown>
«destructured»RenderContext

Returns

Element

Defined in

ai-jsx/src/core/completion.tsx:196


CompletionProvider

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

A CompletionProvider is used by ChatCompletion to access an underlying Large Language Model.

Type parameters

NameType
Textends ModelPropsWithChildren

Parameters

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

Returns

Element

Defined in

ai-jsx/src/core/completion.tsx:142