Reference/SDK/TypeScript/Classes

Class: CodePrompt

Constructors

constructor

new CodePrompt(project, prompt, toolFunctions, opts): CodePrompt

Parameters

NameType
projectProject
promptObject
prompt.options?null | { model?: string ; params?: objectOutputType<{ frequency_penalty: ZodOptional<ZodNumber> ; function_call: ZodOptional<ZodUnion<[ZodLiteral<"auto">, ZodLiteral<"none">, ZodObject<{ name: ZodString }, "strip", ZodTypeAny, { name: string }, { name: string }>]>> ; max_tokens: ZodOptional<ZodNumber> ; n: ZodOptional<ZodNumber> ; presence_penalty: ZodOptional<ZodNumber> ; response_format: ZodOptional<ZodNullable<ZodObject<{ type: ZodLiteral<"json_object"> }, "strip", ZodTypeAny, { type: "json_object" }, { type: "json_object" }>>> ; stop: ZodOptional<ZodArray<ZodString, "many">> ; temperature: ZodOptional<ZodNumber> ; tool_choice: ZodOptional<ZodUnion<[ZodLiteral<"auto">, ZodLiteral<"none">, ZodObject<{ function: ZodObject<{ name: ZodString }, "strip", ZodTypeAny, { name: string }, { name: string }> ; type: ZodLiteral<"function"> }, "strip", ZodTypeAny, { function: { name: string } ; type: "function" }, { function: { name: string } ; type: "function" }>]>> ; top_p: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ max_tokens: ZodNumber ; max_tokens_to_sample: ZodOptional<ZodNumber> ; stop_sequences: ZodOptional<ZodArray<ZodString, "many">> ; temperature: ZodNumber ; top_k: ZodOptional<ZodNumber> ; top_p: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ maxOutputTokens: ZodOptional<ZodNumber> ; temperature: ZodOptional<ZodNumber> ; topK: ZodOptional<ZodNumber> ; topP: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ temperature: ZodOptional<ZodNumber> ; topK: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> ; position?: string }
prompt.origin?null | { project_id?: string ; prompt_id?: string ; prompt_version?: string }
prompt.parser?null | { choice_scores: Record<string, number> ; type: "llm_classifier" ; use_cot: boolean }
prompt.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" }[] } | { content?: null | string ; role: "model" })[] ; tools?: string ; type: "chat" }
prompt.tool_functions?null | ({ id: string ; type: "function" } | { name: string ; type: "global" })[]
toolFunctions(GenericCodeFunction | { id: string ; type: "function" } | { name: string ; type: "global" })[]
optsOmit<PromptOpts<false, false>, "name" | "slug"> & { name: string ; slug: string }

Returns

CodePrompt

Properties

description

Optional Readonly description: string


id

Optional Readonly id: string


ifExists

Optional Readonly ifExists: "error" | "replace" | "ignore"


name

Readonly name: string


project

Readonly project: Project


prompt

Readonly prompt: Object

Type declaration

NameType
options?null | { model?: string ; params?: objectOutputType<{ frequency_penalty: ZodOptional<ZodNumber> ; function_call: ZodOptional<ZodUnion<[ZodLiteral<"auto">, ZodLiteral<"none">, ZodObject<{ name: ZodString }, "strip", ZodTypeAny, { name: string }, { name: string }>]>> ; max_tokens: ZodOptional<ZodNumber> ; n: ZodOptional<ZodNumber> ; presence_penalty: ZodOptional<ZodNumber> ; response_format: ZodOptional<ZodNullable<ZodObject<{ type: ZodLiteral<"json_object"> }, "strip", ZodTypeAny, { type: "json_object" }, { type: "json_object" }>>> ; stop: ZodOptional<ZodArray<ZodString, "many">> ; temperature: ZodOptional<ZodNumber> ; tool_choice: ZodOptional<ZodUnion<[ZodLiteral<"auto">, ZodLiteral<"none">, ZodObject<{ function: ZodObject<{ name: ZodString }, "strip", ZodTypeAny, { name: string }, { name: string }> ; type: ZodLiteral<"function"> }, "strip", ZodTypeAny, { function: { name: string } ; type: "function" }, { function: { name: string } ; type: "function" }>]>> ; top_p: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ max_tokens: ZodNumber ; max_tokens_to_sample: ZodOptional<ZodNumber> ; stop_sequences: ZodOptional<ZodArray<ZodString, "many">> ; temperature: ZodNumber ; top_k: ZodOptional<ZodNumber> ; top_p: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ maxOutputTokens: ZodOptional<ZodNumber> ; temperature: ZodOptional<ZodNumber> ; topK: ZodOptional<ZodNumber> ; topP: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ temperature: ZodOptional<ZodNumber> ; topK: ZodOptional<ZodNumber> ; use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> | objectOutputType<{ use_cache: ZodOptional<ZodBoolean> }, ZodTypeAny, "passthrough"> ; position?: string }
origin?null | { project_id?: string ; prompt_id?: string ; prompt_version?: string }
parser?null | { choice_scores: Record<string, number> ; type: "llm_classifier" ; use_cot: boolean }
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" }[] } | { content?: null | string ; role: "model" })[] ; tools?: string ; type: "chat" }
tool_functions?null | ({ id: string ; type: "function" } | { name: string ; type: "global" })[]

slug

Readonly slug: string


toolFunctions

Readonly toolFunctions: (GenericCodeFunction | { id: string ; type: "function" } | { name: string ; type: "global" })[]

On this page