Class: Prompt
Accessors
id
• get
id(): string
Returns
string
name
• get
name(): string
Returns
string
options
• get
options(): Object
Returns
Object
Name | Type |
---|---|
model? | string |
params? | { frequency_penalty? : number ; max_tokens? : number ; presence_penalty? : number ; response_format? : null | { type : "json_object" } ; temperature? : number ; tool_choice? : "auto" | "none" | { function : { name : string } ; type : "function" } ; top_p? : number ; use_cache? : boolean } | { max_tokens : number ; max_tokens_to_sample? : number ; temperature : number ; top_k? : number ; top_p? : number ; use_cache? : boolean } | { maxOutputTokens? : number ; temperature : number ; topK? : number ; topP? : number ; use_cache? : boolean } | { use_cache? : boolean } |
position? | string |
projectId
• get
projectId(): string
Returns
string
prompt
• get
prompt(): undefined
| null
| { content
: string
; type
: "completion"
} | { messages
: ({ content
: string
; name?
: string
; role
: "system"
} | { content
: {} ; name?
: string
; role
: "user"
} | { content
: string
; role
: "tool"
; tool_call_id
: string
} | { content
: string
; name
: string
; role
: "function"
} | { content?
: null
| string
; function_call?
: { arguments
: string
; name
: string
} ; name?
: string
; role
: "assistant"
; tool_calls?
: { function
: { arguments
: string
; name
: string
} ; id
: string
; type
: "function"
}[] })[] ; tools?
: string
; type
: "chat"
}
Returns
undefined
| null
| { content
: string
; type
: "completion"
} | { messages
: ({ content
: string
; name?
: string
; role
: "system"
} | { content
: {} ; name?
: string
; role
: "user"
} | { content
: string
; role
: "tool"
; tool_call_id
: string
} | { content
: string
; name
: string
; role
: "function"
} | { content?
: null
| string
; function_call?
: { arguments
: string
; name
: string
} ; name?
: string
; role
: "assistant"
; tool_calls?
: { function
: { arguments
: string
; name
: string
} ; id
: string
; type
: "function"
}[] })[] ; tools?
: string
; type
: "chat"
}
slug
• get
slug(): string
Returns
string
version
• get
version(): string
Returns
string
Constructors
constructor
• new Prompt(metadata
, defaults
, noTrace
): Prompt
Parameters
Name | Type |
---|---|
metadata | Object |
metadata._xact_id | string |
metadata.created? | null | string |
metadata.description? | null | string |
metadata.id | string |
metadata.log_id | "p" |
metadata.metadata? | null | Record <string , any > |
metadata.name | string |
metadata.org_id | string |
metadata.project_id | string |
metadata.prompt_data? | null | { options? : null | { model? : string ; params? : { frequency_penalty? : number ; max_tokens? : number ; presence_penalty? : number ; response_format? : null | { type : "json_object" } ; temperature? : number ; tool_choice? : "auto" | "none" | { function : { name : string } ; type : "function" } ; top_p? : number ; use_cache? : boolean } | { max_tokens : number ; max_tokens_to_sample? : number ; temperature : number ; top_k? : number ; top_p? : number ; use_cache? : boolean } | { maxOutputTokens? : number ; temperature : number ; topK? : number ; topP? : number ; use_cache? : boolean } | { use_cache? : boolean } ; position? : string } ; origin? : null | { project_id? : string ; prompt_id? : string ; prompt_version? : string } ; prompt? : null | { content : string ; type : "completion" } | { messages : ({ content : string ; name? : string ; role : "system" } | { content : {} ; name? : string ; role : "user" } | { content : string ; role : "tool" ; tool_call_id : string } | { content : string ; name : string ; role : "function" } | { content? : null | string ; function_call? : { arguments : string ; name : string } ; name? : string ; role : "assistant" ; tool_calls? : { function : { arguments : string ; name : string } ; id : string ; type : "function" }[] })[] ; tools? : string ; type : "chat" } } |
metadata.slug | string |
metadata.tags? | null | string [] |
defaults | Partial <Omit <undefined | { frequency_penalty? : number ; max_tokens? : number ; presence_penalty? : number ; response_format? : null | { type : "json_object" } ; temperature? : number ; tool_choice? : "auto" | "none" | { function : { name : string } ; type : "function" } ; top_p? : number ; use_cache? : boolean } | { max_tokens : number ; max_tokens_to_sample? : number ; temperature : number ; top_k? : number ; top_p? : number ; use_cache? : boolean } | { maxOutputTokens? : number ; temperature : number ; topK? : number ; topP? : number ; use_cache? : boolean } | { use_cache? : boolean }, "use_cache" > & { model : string } & { frequency_penalty? : number ; maxOutputTokens? : number ; max_tokens : number ; max_tokens_to_sample? : number ; presence_penalty? : number ; response_format? : null | { type : "json_object" } ; temperature : number ; tool_choice? : "auto" | "none" | { function : { name : string } ; type : "function" } ; topK? : number ; topP? : number ; top_k? : number ; top_p? : number ; use_cache? : boolean } & ChatPrompt & CompletionPrompt > |
noTrace | boolean |
Returns
Methods
build
▸ build<Flavor
>(buildArgs
, options?
): CompiledPrompt
<Flavor
>
Build the prompt with the given formatting options. The args you pass in will
be forwarded to the mustache template that defines the prompt and rendered with
the mustache-js
library.
Type parameters
Name | Type |
---|---|
Flavor | extends "chat" | "completion" = "chat" |
Parameters
Name | Type | Description |
---|---|---|
buildArgs | Record <string , unknown > | Args to forward along to the prompt template. |
options | Object | - |
options.flavor? | Flavor | - |
Returns
CompiledPrompt
<Flavor
>