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
Name | Type |
---|---|
T | extends ModelPropsWithChildren |
Defined in
ai-jsx/src/core/completion.tsx:52
ModelPropsWithChildren
Ƭ ModelPropsWithChildren: ModelProps
& { children
: Node
}
Represents a ModelProps with child @{link Node}s.
Defined in
ai-jsx/src/core/completion.tsx:45
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
Name | Type |
---|---|
«destructured» | ModelProps & { children : Node } & Record <string , unknown > |
«destructured» | RenderContext |
Returns
Element
Defined in
ai-jsx/src/core/completion.tsx:213
ChatProvider
▸ ChatProvider<T
>(«destructured»
, «destructured»
): Element
A ChatProvider is used by ChatCompletion to access an underlying Large Language Model.
Type parameters
Name | Type |
---|---|
T | extends ModelPropsWithChildren |
Parameters
Name | Type |
---|---|
«destructured» | { component? : ModelComponent <T > } & T |
«destructured» | RenderContext |
Returns
Element
Defined in
ai-jsx/src/core/completion.tsx:153
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
Name | Type |
---|---|
«destructured» | ModelProps & { children : Node } & Record <string , unknown > |
«destructured» | RenderContext |
Returns
Element
Defined in
ai-jsx/src/core/completion.tsx:184
CompletionProvider
▸ CompletionProvider<T
>(«destructured»
, «destructured»
): Element
A CompletionProvider is used by ChatCompletion to access an underlying Large Language Model.
Type parameters
Name | Type |
---|---|
T | extends ModelPropsWithChildren |
Parameters
Name | Type |
---|---|
«destructured» | { component? : ModelComponent <T > } & T |
«destructured» | RenderContext |
Returns
Element