AxPromptTemplate
Defined in: https://github.com/ax-llm/ax/blob/b50783a160295ce34ac10dcaf3bd8fff4a01d535/src/ax/dsp/prompt.ts#L45
Constructors
Constructor
new AxPromptTemplate(
sig: Readonly<AxSignature>,
options?: Readonly<AxPromptTemplateOptions>,
fieldTemplates?: Record<string, AxFieldTemplateFn>): AxPromptTemplate;
Defined in: https://github.com/ax-llm/ax/blob/b50783a160295ce34ac10dcaf3bd8fff4a01d535/src/ax/dsp/prompt.ts#L57
Parameters
| Parameter | Type |
|---|---|
sig | Readonly<AxSignature> |
options? | Readonly<AxPromptTemplateOptions> |
fieldTemplates? | Record<string, AxFieldTemplateFn> |
Returns
AxPromptTemplate
Methods
render()
render<T>(values: T | readonly AxMessage<T>[], __namedParameters: Readonly<{
demos?: Record<string, AxFieldValue>[];
examples?: Record<string, AxFieldValue>[];
skipSystemPrompt?: boolean;
}>): (
| {
cache?: boolean;
content: string;
role: "system";
}
| {
content: | string
| (
| {
cache?: boolean;
text: string;
type: "text";
}
| {
altText?: string;
cache?: boolean;
details?: "high" | "low" | "auto";
image: string;
mimeType: string;
optimize?: "auto" | "quality" | "size";
type: "image";
}
| {
cache?: boolean;
data: string;
duration?: number;
format?: "wav" | "mp3" | "ogg";
transcription?: string;
type: "audio";
}
| {
cache?: boolean;
data: string;
extractedText?: string;
filename?: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
extractedText?: string;
filename?: string;
fileUri: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
cachedContent?: string;
description?: string;
title?: string;
type: "url";
url: string;
})[];
name?: string;
role: "user";
}
| {
cache?: boolean;
content?: string;
functionCalls?: object[];
name?: string;
role: "assistant";
thoughtBlock?: {
data: string;
encrypted?: boolean;
signature?: string;
};
})[];
Defined in: https://github.com/ax-llm/ax/blob/b50783a160295ce34ac10dcaf3bd8fff4a01d535/src/ax/dsp/prompt.ts#L275
Type Parameters
| Type Parameter | Default type |
|---|---|
T | any |
Parameters
| Parameter | Type |
|---|---|
values | T | readonly AxMessage<T>[] |
__namedParameters | Readonly<{ demos?: Record<string, AxFieldValue>[]; examples?: Record<string, AxFieldValue>[]; skipSystemPrompt?: boolean; }> |
Returns
(
| {
cache?: boolean;
content: string;
role: "system";
}
| {
content: | string
| (
| {
cache?: boolean;
text: string;
type: "text";
}
| {
altText?: string;
cache?: boolean;
details?: "high" | "low" | "auto";
image: string;
mimeType: string;
optimize?: "auto" | "quality" | "size";
type: "image";
}
| {
cache?: boolean;
data: string;
duration?: number;
format?: "wav" | "mp3" | "ogg";
transcription?: string;
type: "audio";
}
| {
cache?: boolean;
data: string;
extractedText?: string;
filename?: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
extractedText?: string;
filename?: string;
fileUri: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
cachedContent?: string;
description?: string;
title?: string;
type: "url";
url: string;
})[];
name?: string;
role: "user";
}
| {
cache?: boolean;
content?: string;
functionCalls?: object[];
name?: string;
role: "assistant";
thoughtBlock?: {
data: string;
encrypted?: boolean;
signature?: string;
};
})[]
renderExtraFields()
renderExtraFields(extraFields: readonly AxIField[]): (
| {
cache?: boolean;
text: string;
type: "text";
}
| {
altText?: string;
cache?: boolean;
details?: "high" | "low" | "auto";
image: string;
mimeType: string;
optimize?: "auto" | "quality" | "size";
type: "image";
}
| {
cache?: boolean;
data: string;
duration?: number;
format?: "wav" | "mp3" | "ogg";
transcription?: string;
type: "audio";
}
| {
cache?: boolean;
data: string;
extractedText?: string;
filename?: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
extractedText?: string;
filename?: string;
fileUri: string;
mimeType: string;
type: "file";
}
| {
cache?: boolean;
cachedContent?: string;
description?: string;
title?: string;
type: "url";
url: string;
})[];
Defined in: https://github.com/ax-llm/ax/blob/b50783a160295ce34ac10dcaf3bd8fff4a01d535/src/ax/dsp/prompt.ts#L385
Parameters
| Parameter | Type |
|---|---|
extraFields | readonly AxIField[] |
Returns
setInstruction()
setInstruction(instruction: string): void;
Defined in: https://github.com/ax-llm/ax/blob/b50783a160295ce34ac10dcaf3bd8fff4a01d535/src/ax/dsp/prompt.ts#L50
Parameters
| Parameter | Type |
|---|---|
instruction | string |
Returns
void