diff --git a/pdl-live-react/src/helpers.ts b/pdl-live-react/src/helpers.ts index 10edab5df..b63cfa1ef 100644 --- a/pdl-live-react/src/helpers.ts +++ b/pdl-live-react/src/helpers.ts @@ -6,7 +6,7 @@ import type { TextBlock, ArgsBlock, CodeBlock, - PdlModelInput, + ModelInput, LocalizedExpression, } from "./pdl_ast" import { match, P } from "ts-pattern" @@ -232,10 +232,10 @@ export function hasMessage(block: PdlBlock): block is MessageBearing { export function hasInput(block: PdlBlock): block is | (Omit & { - pdl__model_input: NonNullable + pdl__model_input: NonNullable }) | (Omit & { - pdl__model_input: NonNullable + pdl__model_input: NonNullable }) { const mb = block as ModelBlock return Array.isArray(mb.pdl__model_input) && mb.pdl__model_input.length > 0 diff --git a/pdl-live-react/src/pdl_ast.d.ts b/pdl-live-react/src/pdl_ast.d.ts index 4fb0710ee..8c203db9b 100644 --- a/pdl-live-react/src/pdl_ast.d.ts +++ b/pdl-live-react/src/pdl_ast.d.ts @@ -36,11 +36,6 @@ export type Program = | ErrorBlock | EmptyBlock | null -/** - * Documentation associated to the block. - * - */ -export type Description = string | null export type Enum = unknown[] export type PdlTypeType = | ( @@ -68,2717 +63,459 @@ export type PdlTypeType = } | null export type Type = string | string[] +export type BlockType = + | boolean + | number + | string + | FunctionBlock + | CallBlock + | LitellmModelBlock + | GraniteioModelBlock + | CodeBlock + | ArgsBlock + | GetBlock + | DataBlock + | IfBlock + | MatchBlock + | RepeatBlock + | MapBlock + | TextBlock + | LastOfBlock + | ArrayBlock + | ObjectBlock + | MessageBlock + | ReadBlock + | IncludeBlock + | ImportBlock + | ErrorBlock + | EmptyBlock + | null /** - * Documentation associated to the block. - * - */ -export type Description1 = string | null -/** - * Documentation associated to the block. - * - */ -export type Description2 = string | null -/** - * Documentation associated to the block. - * + * Values allowed in the `contribute` field. */ -export type Description3 = string | null +export type ContributeTarget = "result" | "context" +export type Value = LocalizedExpression | unknown[] | string +export type Path = string[] +export type File = string /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description4 = string | null +export type ContributeType = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type ParserType = ("json" | "jsonl" | "yaml") | PdlParser | RegexParser +export type Regex = string +export type Mode = "search" | "match" | "fullmatch" | "split" | "findall" +export type ModelInput = { + [k: string]: unknown +}[] +export type PdlIsLeaf = true +export type Kind = "call" /** - * Documentation associated to the block. + * Function to call. * */ -export type Description5 = string | null +export type Call = LocalizedExpression | FunctionBlock | string /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description6 = string | null +export type ContributeType1 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf1 = true +export type Kind1 = "model" /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description7 = string | null +export type ContributeType2 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf2 = true +export type Kind2 = "model" /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description8 = string | null +export type ContributeType3 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf3 = true +export type Kind3 = "code" /** - * Documentation associated to the block. + * Programming language of the code. * */ -export type Description9 = string | null +export type Lang = "python" | "command" | "jinja" | "pdl" | "ipython" /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description10 = string | null +export type ContributeType4 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf4 = true +export type Kind4 = "code" +export type Lang1 = "command" +export type ExpressionStr = LocalizedExpression | string /** - * Documentation associated to the block. + * The argument vector to spawn. * */ -export type Description11 = string | null +export type Args1 = ExpressionStr[] /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description12 = string | null +export type ContributeType5 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf5 = true +export type Kind5 = "get" /** - * Documentation associated to the block. - * + * Name of the variable to access. */ -export type Description13 = string | null +export type Get = string /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description14 = string | null +export type ContributeType6 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf6 = true +export type Kind6 = "data" /** - * Documentation associated to the block. - * + * Do not evaluate expressions inside strings. */ -export type Description15 = string | null +export type Raw = boolean /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description16 = string | null +export type ContributeType7 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf7 = false +export type IndependentEnum = "independent" | "dependent" +export type Kind7 = "if" /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description17 = string | null +export type ContributeType8 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf8 = false +export type IndependentEnum1 = "independent" | "dependent" +export type Kind8 = "match" +export type PatternType = + | boolean + | number + | string + | OrPattern + | ArrayPattern + | ObjectPattern + | AnyPattern + | null +export type Anyof = PatternType[] +export type Array = PatternType[] +export type Any = null +export type ExpressionBool = LocalizedExpression | boolean | string +export type PdlCaseResult = boolean | null +export type PdlIfResult = boolean | null +export type PdlMatched = boolean | null /** - * Documentation associated to the block. + * List of cases to match. * */ -export type Description18 = string | null +export type With = MatchCase[] /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description19 = string | null +export type ContributeType9 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf9 = false +export type IndependentEnum2 = "independent" | "dependent" +export type Kind9 = "repeat" /** - * Documentation associated to the block. + * Arrays to iterate over. * */ -export type Description20 = string | null +export type For = { + [k: string]: LocalizedExpression | unknown[] | string +} | null /** - * Documentation associated to the block. + * Indicate if the block contributes to the result and background context. * */ -export type Description21 = string | null +export type ContributeType10 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf10 = false +export type IndependentEnum3 = "independent" | "dependent" +export type Kind10 = "map" /** - * Name of the variable used to store the result of the execution of the block. + * Arrays to iterate over. * */ -export type Def = string | null -/** - * Values allowed in the `contribute` field. - */ -export type ContributeTarget = "result" | "context" -export type Value = LocalizedExpression | unknown[] | string -export type Path = string[] -export type File = string +export type For1 = { + [k: string]: LocalizedExpression | unknown[] | string +} | null /** * Indicate if the block contributes to the result and background context. * */ -export type Contribute = ( +export type ContributeType11 = ( | ContributeTarget | { [k: string]: ContributeValue } )[] +export type PdlIsLeaf11 = false +export type IndependentEnum4 = "independent" | "dependent" +export type Kind11 = "text" /** - * Parser to use to construct a value out of a string result. - */ -export type Parser = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -export type Description22 = string | null -export type Pdl = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -export type Description23 = string | null -export type Regex = string -export type Mode = "search" | "match" | "fullmatch" | "split" | "findall" -/** - * Block to execute in case of error. - * - */ -export type Fallback = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. + * Body of the text. * */ -export type Retry = number | null +export type Text = BlockType | BlockType[] /** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * Indicate if the block contributes to the result and background context. * */ -export type TraceErrorOnRetry = boolean | string | null +export type ContributeType12 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf12 = false +export type IndependentEnum5 = "independent" | "dependent" +export type Kind12 = "lastOf" /** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. + * Sequence of blocks to execute. */ -export type Role = string | null +export type Lastof = BlockType[] /** - * Current context + * Indicate if the block contributes to the result and background context. * */ -export type PdlContext = +export type ContributeType13 = ( + | ContributeTarget | { - [k: string]: unknown - }[] - | null + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf13 = false +export type IndependentEnum6 = "independent" | "dependent" +export type Kind13 = "array" /** - * Unique identifier for this block - * + * Elements of the array. */ -export type PdlId = string | null -export type StartNanos = number | null -export type EndNanos = number | null -export type FirstUseNanos = number | null -export type Timezone = string | null -export type PdlIsLeaf = true -export type Kind = "empty" +export type Array1 = BlockType[] /** - * Name of the variable used to store the result of the execution of the block. + * Indicate if the block contributes to the result and background context. * */ -export type Def1 = string | null +export type ContributeType14 = ( + | ContributeTarget + | { + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf14 = false +export type IndependentEnum7 = "independent" | "dependent" +export type Kind14 = "object" +export type Object2 = + | { + [k: string]: BlockType + } + | BlockType[] /** * Indicate if the block contributes to the result and background context. * */ -export type Contribute1 = ( +export type ContributeType15 = ( | ContributeTarget | { [k: string]: ContributeValue } )[] +export type PdlIsLeaf15 = true +export type Kind15 = "message" /** - * Parser to use to construct a value out of a string result. - */ -export type Parser1 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback1 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry1 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry1 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role1 = string | null -/** - * Current context - * - */ -export type PdlContext1 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId1 = string | null -export type PdlIsLeaf1 = true -export type Kind1 = "error" -/** - * Error message. - * - */ -export type Msg = string -/** - * Block that raised the error. - * - */ -export type Program1 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def2 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute2 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser2 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback2 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry2 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry2 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role2 = string | null -/** - * Current context - * - */ -export type PdlContext2 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId2 = string | null -export type PdlIsLeaf2 = true -export type Kind2 = "import" -/** - * Name of the file to import. - * - */ -export type Import = string -export type PdlTrace = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def3 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute3 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser3 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback3 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry3 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry3 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role3 = string | null -/** - * Current context - * - */ -export type PdlContext3 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId3 = string | null -export type PdlIsLeaf3 = false -export type IndependentEnum = "independent" | "dependent" -export type Kind3 = "include" -/** - * Name of the file to include. - * - */ -export type Include = string -export type PdlTrace1 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def4 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute4 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser4 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback4 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry4 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry4 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role4 = string | null -/** - * Current context - * - */ -export type PdlContext4 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId4 = string | null -export type PdlIsLeaf4 = true -export type Kind4 = "read" -/** - * Name of the file to read. If `None`, read the standard input. - * - */ -export type Read = LocalizedExpression | string | null -/** - * Message to prompt the user to enter a value. - * - */ -export type Message = string | null -/** - * Indicate if one or multiple lines should be read. - * - */ -export type Multiline = boolean -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def5 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute5 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser5 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback5 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry5 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry5 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role5 = string | null -/** - * Current context - * - */ -export type PdlContext5 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId5 = string | null -export type PdlIsLeaf5 = true -export type Kind5 = "message" -/** - * Content of the message. - */ -export type Content = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * For example, the name of the tool that was invoked, for which this message is the tool response. - */ -export type Name = LocalizedExpression | string | null -/** - * The id of the tool invocation for which this message is the tool response. - */ -export type ToolCallId = LocalizedExpression | string | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def6 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute6 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser6 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback6 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry6 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry6 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role6 = string | null -/** - * Current context - * - */ -export type PdlContext6 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId6 = string | null -export type PdlIsLeaf6 = false -export type IndependentEnum1 = "independent" | "dependent" -export type Kind6 = "object" -export type Object1 = - | { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null - } - | ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null - )[] -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def7 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute7 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser7 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback7 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry7 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry7 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role7 = string | null -/** - * Current context - * - */ -export type PdlContext7 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId7 = string | null -export type PdlIsLeaf7 = false -export type IndependentEnum2 = "independent" | "dependent" -export type Kind7 = "array" -/** - * Elements of the array. - */ -export type Array = ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -)[] -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def8 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute8 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser8 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback8 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry8 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry8 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role8 = string | null -/** - * Current context - * - */ -export type PdlContext8 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId8 = string | null -export type PdlIsLeaf8 = false -export type IndependentEnum3 = "independent" | "dependent" -export type Kind8 = "lastOf" -/** - * Sequence of blocks to execute. - */ -export type Lastof = ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -)[] -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def9 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute9 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser9 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback9 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry9 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry9 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role9 = string | null -/** - * Current context - * - */ -export type PdlContext9 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId9 = string | null -export type PdlIsLeaf9 = false -export type IndependentEnum4 = "independent" | "dependent" -export type Kind9 = "text" -/** - * Body of the text. - * - */ -export type Text = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null - )[] - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def10 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute10 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser10 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback10 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry10 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry10 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role10 = string | null -/** - * Current context - * - */ -export type PdlContext10 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId10 = string | null -export type PdlIsLeaf10 = false -export type IndependentEnum5 = "independent" | "dependent" -export type Kind10 = "map" -/** - * Arrays to iterate over. - * - */ -export type For = { - [k: string]: LocalizedExpression | unknown[] | string -} | null -/** - * Name of the variable containing the loop iteration. - * - */ -export type Index = string | null -/** - * Body of the iterator. - * - */ -export type Map = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Maximal number of iterations to perform. - * - */ -export type Maxiterations = LocalizedExpression | number | string | null -/** - * Define how to combine the result of each iteration. - * - */ -export type Join = JoinText | JoinArray | JoinObject | JoinLastOf | JoinReduce -/** - * String concatenation of the result of each iteration. - * - */ -export type As = "text" -/** - * String used to concatenate each iteration of the loop. - * - */ -export type With = string -/** - * Return the result of each iteration as an array. - * - */ -export type As1 = "array" -/** - * Return the union of the objects created at each iteration. - * - */ -export type As2 = "object" -/** - * Return the result of the last iteration. - * - */ -export type As3 = "lastOf" -export type As4 = "reduce" -/** - * Function used to combine the results. - */ -export type Reduce = LocalizedExpression | string -export type PdlTrace2 = - | ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null - )[] - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def11 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute11 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser11 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback11 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry11 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry11 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role11 = string | null -/** - * Current context - * - */ -export type PdlContext11 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId11 = string | null -export type PdlIsLeaf11 = false -export type IndependentEnum6 = "independent" | "dependent" -export type Kind11 = "repeat" -/** - * Arrays to iterate over. - * - */ -export type For1 = { - [k: string]: LocalizedExpression | unknown[] | string -} | null -/** - * Name of the variable containing the loop iteration. - * - */ -export type Index1 = string | null -/** - * Condition to stay at the beginning of the loop. - * - */ -export type While = LocalizedExpression | boolean | string -/** - * Body of the loop. - * - */ -export type Repeat = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Condition to exit at the end of the loop. - * - */ -export type Until = LocalizedExpression | boolean | string -/** - * Maximal number of iterations to perform. - * - */ -export type Maxiterations1 = LocalizedExpression | number | string | null -/** - * Define how to combine the result of each iteration. - * - */ -export type Join1 = JoinText | JoinArray | JoinObject | JoinLastOf | JoinReduce -export type PdlTrace3 = - | ( - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null - )[] - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def12 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute12 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser12 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback12 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry12 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry12 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role12 = string | null -/** - * Current context - * - */ -export type PdlContext12 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId12 = string | null -export type PdlIsLeaf12 = false -export type IndependentEnum7 = "independent" | "dependent" -export type Kind12 = "match" -export type Case = - | boolean - | number - | string - | OrPattern - | ArrayPattern - | ObjectPattern - | AnyPattern - | null -export type Def13 = string | null -export type Def14 = string | null -export type Def15 = string | null -export type Def16 = string | null -export type Any = null -export type Array1 = ( - | boolean - | number - | string - | OrPattern - | ArrayPattern - | ObjectPattern - | AnyPattern - | null -)[] -export type Anyof = ( - | boolean - | number - | string - | OrPattern - | ArrayPattern - | ObjectPattern - | AnyPattern - | null -)[] -export type If = LocalizedExpression | boolean | string | null -export type Then = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -export type PdlCaseResult = boolean | null -export type PdlIfResult = boolean | null -export type PdlMatched = boolean | null -/** - * List of cases to match. - * - */ -export type With1 = MatchCase[] -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def17 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute13 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser13 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback13 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry13 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry13 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role13 = string | null -/** - * Current context - * - */ -export type PdlContext13 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId13 = string | null -export type PdlIsLeaf13 = false -export type IndependentEnum8 = "independent" | "dependent" -export type Kind13 = "if" -/** - * Condition. - * - */ -export type If1 = LocalizedExpression | boolean | string -/** - * Branch to execute if the condition is true. - * - */ -export type Then1 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Branch to execute if the condition is false. - * - */ -export type Else = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def18 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute14 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser14 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback14 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry14 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry14 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role14 = string | null -/** - * Current context - * - */ -export type PdlContext14 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId14 = string | null -export type PdlIsLeaf14 = true -export type Kind14 = "data" -/** - * Do not evaluate expressions inside strings. - */ -export type Raw = boolean -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def19 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute15 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser15 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback15 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry15 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry15 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role15 = string | null -/** - * Current context - * - */ -export type PdlContext15 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId15 = string | null -export type PdlIsLeaf15 = true -export type Kind15 = "get" -/** - * Name of the variable to access. - */ -export type Get = string -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def20 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute16 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser16 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback16 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry16 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry16 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role16 = string | null -/** - * Current context - * - */ -export type PdlContext16 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId16 = string | null -export type PdlIsLeaf16 = true -export type Kind16 = "code" -export type Lang = "command" -/** - * The argument vector to spawn. - * - */ -export type Args = (LocalizedExpression | string)[] -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def21 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute17 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser17 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback17 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry17 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry17 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role17 = string | null -/** - * Current context + * Indicate if the block contributes to the result and background context. * */ -export type PdlContext17 = +export type ContributeType16 = ( + | ContributeTarget | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId17 = string | null -export type PdlIsLeaf17 = true -export type Kind17 = "code" -/** - * Programming language of the code. - * - */ -export type Lang1 = "python" | "command" | "jinja" | "pdl" | "ipython" -/** - * Code to execute. - * - */ -export type Code = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: ContributeValue + } +)[] +export type PdlIsLeaf16 = true +export type Kind16 = "read" /** - * Name of the variable used to store the result of the execution of the block. + * Indicate if one or multiple lines should be read. * */ -export type Def22 = string | null +export type Multiline = boolean /** * Indicate if the block contributes to the result and background context. * */ -export type Contribute18 = ( +export type ContributeType17 = ( | ContributeTarget | { [k: string]: ContributeValue } )[] +export type PdlIsLeaf17 = false +export type IndependentEnum8 = "independent" | "dependent" +export type Kind17 = "include" /** - * Parser to use to construct a value out of a string result. - */ -export type Parser18 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback18 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry18 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * Name of the file to include. * */ -export type TraceErrorOnRetry18 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role18 = string | null +export type Include = string /** - * Current context + * Indicate if the block contributes to the result and background context. * */ -export type PdlContext18 = +export type ContributeType18 = ( + | ContributeTarget | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId18 = string | null + [k: string]: ContributeValue + } +)[] export type PdlIsLeaf18 = true -export type Kind18 = "model" -/** - * Messages to send to the model. - * - */ -export type Input = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Variable where to store the raw response of the model. - * - */ -export type Modelresponse = string | null -export type CompletionTokens = number | null -export type PromptTokens = number | null -export type PdlModelInput = - | { - [k: string]: unknown - }[] - | null +export type Kind18 = "import" /** - * Optional field to ensure that the block is using granite-io. + * Name of the file to import. * */ -export type Platform = "granite-io" +export type Import = string /** - * Parameters sent to the model. + * Indicate if the block contributes to the result and background context. * */ -export type Parameters = - | LocalizedExpression +export type ContributeType19 = ( + | ContributeTarget | { - [k: string]: unknown + [k: string]: ContributeValue } - | string - | null +)[] +export type PdlIsLeaf19 = true +export type Kind19 = "error" /** - * Name of the variable used to store the result of the execution of the block. + * Error message. * */ -export type Def23 = string | null +export type Msg = string /** * Indicate if the block contributes to the result and background context. * */ -export type Contribute19 = ( +export type ContributeType20 = ( | ContributeTarget | { [k: string]: ContributeValue } )[] +export type PdlIsLeaf20 = true +export type Kind20 = "empty" +export type ExpressionInt = LocalizedExpression | number | string /** - * Parser to use to construct a value out of a string result. - */ -export type Parser19 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback19 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry19 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * String concatenation of the result of each iteration. * */ -export type TraceErrorOnRetry19 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role19 = string | null +export type As = "text" /** - * Current context + * String used to concatenate each iteration of the loop. * */ -export type PdlContext19 = - | { - [k: string]: unknown - }[] - | null +export type With1 = string /** - * Unique identifier for this block + * Return the result of each iteration as an array. * */ -export type PdlId19 = string | null -export type PdlIsLeaf19 = true -export type Kind19 = "model" +export type As1 = "array" /** - * Messages to send to the model. + * Return the union of the objects created at each iteration. * */ -export type Input1 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null +export type As2 = "object" +/** + * Return the result of the last iteration. + * + */ +export type As3 = "lastOf" +export type As4 = "reduce" +/** + * Function used to combine the results. + */ +export type Reduce = LocalizedExpression | string +export type PdlTrace = BlockType[] | null +export type PdlTrace1 = BlockType[] | null +/** + * Optional field to ensure that the block is using granite-io. + * + */ +export type Platform = "granite-io" /** - * Variable where to store the raw response of the model. + * Parameters sent to the model. * */ -export type Modelresponse1 = string | null -export type PdlModelInput1 = +export type Parameters = + | LocalizedExpression | { [k: string]: unknown - }[] + } + | string | null /** * Optional field to ensure that the block is using LiteLLM. * */ export type Platform1 = "litellm" -/** - * Name of the model following the LiteLLM convention. - * - */ -export type Model1 = LocalizedExpression | string /** * Parameters to send to the model. * @@ -2838,208 +575,16 @@ export type ModelList = unknown[] | string | null export type MockResponse = string | null export type CustomLlmProvider = string | null export type MaxRetries = number | string | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def24 = string | null -/** - * Indicate if the block contributes to the result and background context. - * - */ -export type Contribute20 = ( - | ContributeTarget - | { - [k: string]: ContributeValue - } -)[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser20 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback20 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry20 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry20 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role20 = string | null -/** - * Current context - * - */ -export type PdlContext20 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId20 = string | null -export type PdlIsLeaf20 = true -export type Kind20 = "call" -/** - * Function to call. - * - */ -export type Call = LocalizedExpression | FunctionBlock | string -export type PdlTrace4 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * Name of the variable used to store the result of the execution of the block. - * - */ -export type Def25 = string | null /** * Indicate if the block contributes to the result and background context. * */ -export type Contribute21 = ( +export type ContributeType21 = ( | ContributeTarget | { [k: string]: ContributeValue } )[] -/** - * Parser to use to construct a value out of a string result. - */ -export type Parser21 = - | ("json" | "jsonl" | "yaml") - | PdlParser - | RegexParser - | null -/** - * Block to execute in case of error. - * - */ -export type Fallback21 = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -/** - * The maximum number of times to retry when an error occurs within a block. - * - */ -export type Retry21 = number | null -/** - * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. - * - */ -export type TraceErrorOnRetry21 = boolean | string | null -/** - * Role associated to the block and sub-blocks. - * Typical roles are `system`, `user`, and `assistant`, - * but there may be other roles such as `available_tools`. - */ -export type Role21 = string | null -/** - * Current context - * - */ -export type PdlContext21 = - | { - [k: string]: unknown - }[] - | null -/** - * Unique identifier for this block - * - */ -export type PdlId21 = string | null export type PdlIsLeaf21 = true export type Kind21 = "function" /** @@ -3049,37 +594,6 @@ export type Kind21 = "function" export type Function = { [k: string]: PdlTypeType } | null -/** - * Body of the function. - * - */ -export type Return = - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null /** * Function signature computed from the function definition. * @@ -3117,7 +631,11 @@ export type PdlBlock = * Function declaration. */ export interface FunctionBlock { - description?: Description + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3147,23 +665,87 @@ export interface FunctionBlock { [k: string]: PdlTypeType } | null - defs?: Defs - def?: Def25 - contribute?: Contribute21 - parser?: Parser21 - fallback?: Fallback21 - retry?: Retry21 - trace_error_on_retry?: TraceErrorOnRetry21 - role?: Role21 - pdl__context?: PdlContext21 - pdl__id?: PdlId21 - pdl__result?: unknown - pdl__location?: PdlLocationType | null - pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf21 - kind?: Kind21 - function: Function - return: Return + defs?: Defs + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType21 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null + pdl__result?: unknown + pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ + pdl__timing?: PdlTiming | null + pdl__is_leaf?: PdlIsLeaf21 + kind?: Kind21 + function: Function + /** + * Body of the function. + * + */ + return: + | boolean + | number + | number + | string + | FunctionBlock + | CallBlock + | LitellmModelBlock + | GraniteioModelBlock + | CodeBlock + | ArgsBlock + | GetBlock + | DataBlock + | IfBlock + | MatchBlock + | RepeatBlock + | MapBlock + | TextBlock + | LastOfBlock + | ArrayBlock + | ObjectBlock + | MessageBlock + | ReadBlock + | IncludeBlock + | ImportBlock + | ErrorBlock + | EmptyBlock + | null signature?: Signature } /** @@ -3200,39 +782,17 @@ export interface Object { * */ export interface Defs { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Calling a function. */ export interface CallBlock { - description?: Description1 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3263,56 +823,162 @@ export interface CallBlock { } | null defs?: Defs1 - def?: Def24 - contribute?: Contribute20 - parser?: Parser20 - fallback?: Fallback20 - retry?: Retry20 - trace_error_on_retry?: TraceErrorOnRetry20 - role?: Role20 - pdl__context?: PdlContext20 - pdl__id?: PdlId20 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf20 - kind?: Kind20 + pdl__is_leaf?: PdlIsLeaf + kind?: Kind call: Call args?: unknown - pdl__trace?: PdlTrace4 + pdl__trace?: BlockType | null } /** * Set of definitions executed before the execution of the block. * */ export interface Defs1 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock + [k: string]: BlockType +} +/** + * Contribution of a specific value instead of the default one. + */ +export interface ContributeValue { + value: Value +} +export interface LocalizedExpression { + pdl__expr: PdlExpr + pdl__result?: unknown + pdl__location?: PdlLocationType | null +} +export interface PdlExpr { + [k: string]: unknown +} +/** + * Internal data structure to keep track of the source location information. + */ +export interface PdlLocationType { + path: Path + file: File + table: Table +} +export interface Table { + [k: string]: number +} +/** + * Use a PDL program as a parser specification (experimental). + */ +export interface PdlParser { + description?: string | null + spec?: + | ( + | "null" + | "boolean" + | "string" + | "number" + | "integer" + | "array" + | "object" + | "bool" + | "str" + | "float" + | "int" + | "list" + | "obj" + ) + | EnumPdlType + | PdlTypeType[] + | OptionalPdlType + | JsonSchemaTypePdlType + | ObjectPdlType + | { + [k: string]: PdlTypeType + } + | null + pdl: BlockType +} +/** + * A regular expression parser. + */ +export interface RegexParser { + description?: string | null + spec?: + | ( + | "null" + | "boolean" + | "string" + | "number" + | "integer" + | "array" + | "object" + | "bool" + | "str" + | "float" + | "int" + | "list" + | "obj" + ) + | EnumPdlType + | PdlTypeType[] + | OptionalPdlType + | JsonSchemaTypePdlType + | ObjectPdlType + | { + [k: string]: PdlTypeType + } | null + regex: Regex + mode?: Mode +} +/** + * Internal data structure to record timing information in the trace. + */ +export interface PdlTiming { + start_nanos?: number | null + end_nanos?: number | null + first_use_nanos?: number | null + timezone?: string | null } /** * Call an LLM through [the LiteLLM API](https://docs.litellm.ai/). @@ -3325,7 +991,11 @@ export interface Defs1 { * ``` */ export interface LitellmModelBlock { - description?: Description2 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3356,38 +1026,58 @@ export interface LitellmModelBlock { } | null defs?: Defs2 - def?: Def23 - contribute?: Contribute19 - parser?: Parser19 - fallback?: Fallback19 - retry?: Retry19 - trace_error_on_retry?: TraceErrorOnRetry19 - role?: Role19 - pdl__context?: PdlContext19 - pdl__id?: PdlId19 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType1 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf19 - kind?: Kind19 - input?: Input1 - modelResponse?: Modelresponse1 + pdl__is_leaf?: PdlIsLeaf1 + kind?: Kind1 /** - * Tokens consumed during model call + * Messages to send to the model. * */ - pdl__usage?: PdlUsage | null - pdl__model_input?: PdlModelInput1 - platform?: Platform1 - model: Model1 - parameters?: Parameters1 -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs2 { - [k: string]: + input?: | boolean | number | string @@ -3414,12 +1104,41 @@ export interface Defs2 { | ErrorBlock | EmptyBlock | null + /** + * Variable where to store the raw response of the model. + * + */ + modelResponse?: string | null + /** + * Tokens consumed during model call + * + */ + pdl__usage?: PdlUsage | null + pdl__model_input?: ModelInput | null + platform?: Platform1 + /** + * Name of the model following the LiteLLM convention. + * + */ + model: LocalizedExpression | string + parameters?: Parameters1 +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs2 { + [k: string]: BlockType } /** * Call an LLM through the granite-io API. */ export interface GraniteioModelBlock { - description?: Description3 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3450,38 +1169,58 @@ export interface GraniteioModelBlock { } | null defs?: Defs3 - def?: Def22 - contribute?: Contribute18 - parser?: Parser18 - fallback?: Fallback18 - retry?: Retry18 - trace_error_on_retry?: TraceErrorOnRetry18 - role?: Role18 - pdl__context?: PdlContext18 - pdl__id?: PdlId18 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType2 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf18 - kind?: Kind18 - input?: Input - modelResponse?: Modelresponse + pdl__is_leaf?: PdlIsLeaf2 + kind?: Kind2 /** - * Tokens consumed during model call + * Messages to send to the model. * */ - pdl__usage?: PdlUsage | null - pdl__model_input?: PdlModelInput - platform?: Platform - processor: unknown - parameters?: Parameters -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs3 { - [k: string]: + input?: | boolean | number | string @@ -3508,6 +1247,27 @@ export interface Defs3 { | ErrorBlock | EmptyBlock | null + /** + * Variable where to store the raw response of the model. + * + */ + modelResponse?: string | null + /** + * Tokens consumed during model call + * + */ + pdl__usage?: PdlUsage | null + pdl__model_input?: ModelInput | null + platform?: Platform + processor: unknown + parameters?: Parameters +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs3 { + [k: string]: BlockType } /** * Execute a piece of code. @@ -3522,7 +1282,11 @@ export interface Defs3 { * ``` */ export interface CodeBlock { - description?: Description4 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3553,29 +1317,59 @@ export interface CodeBlock { } | null defs?: Defs4 - def?: Def21 - contribute?: Contribute17 - parser?: Parser17 - fallback?: Fallback17 - retry?: Retry17 - trace_error_on_retry?: TraceErrorOnRetry17 - role?: Role17 - pdl__context?: PdlContext17 - pdl__id?: PdlId17 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType3 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf17 - kind?: Kind17 - lang: Lang1 - code: Code -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs4 { - [k: string]: + pdl__is_leaf?: PdlIsLeaf3 + kind?: Kind3 + lang: Lang + /** + * Code to execute. + * + */ + code: | boolean | number | string @@ -3603,6 +1397,13 @@ export interface Defs4 { | EmptyBlock | null } +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs4 { + [k: string]: BlockType +} /** * Execute a command line, which will spawn a subprocess with the given argument vector. Note: if you need a shell script execution, you must wrap your command line in /bin/sh or some shell of your choosing. * @@ -3615,7 +1416,11 @@ export interface Defs4 { * ``` */ export interface ArgsBlock { - description?: Description5 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3646,55 +1451,62 @@ export interface ArgsBlock { } | null defs?: Defs5 - def?: Def20 - contribute?: Contribute16 - parser?: Parser16 - fallback?: Fallback16 - retry?: Retry16 - trace_error_on_retry?: TraceErrorOnRetry16 - role?: Role16 - pdl__context?: PdlContext16 - pdl__id?: PdlId16 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType4 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf16 - kind?: Kind16 - lang?: Lang - args: Args + pdl__is_leaf?: PdlIsLeaf4 + kind?: Kind4 + lang?: Lang1 + args: Args1 } /** * Set of definitions executed before the execution of the block. * */ export interface Defs5 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Get the value of a variable. @@ -3702,7 +1514,11 @@ export interface Defs5 { * The GetBlock is deprecated. Use DataBlock instead. */ export interface GetBlock { - description?: Description6 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3733,20 +1549,53 @@ export interface GetBlock { } | null defs?: Defs6 - def?: Def19 - contribute?: Contribute15 - parser?: Parser15 - fallback?: Fallback15 - retry?: Retry15 - trace_error_on_retry?: TraceErrorOnRetry15 - role?: Role15 - pdl__context?: PdlContext15 - pdl__id?: PdlId15 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType5 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf15 - kind?: Kind15 + pdl__is_leaf?: PdlIsLeaf5 + kind?: Kind5 get: Get } /** @@ -3754,33 +1603,7 @@ export interface GetBlock { * */ export interface Defs6 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Arbitrary value, equivalent to JSON. @@ -3807,7 +1630,11 @@ export interface Defs6 { * ``` */ export interface DataBlock { - description?: Description7 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3838,55 +1665,62 @@ export interface DataBlock { } | null defs?: Defs7 - def?: Def18 - contribute?: Contribute14 - parser?: Parser14 - fallback?: Fallback14 - retry?: Retry14 - trace_error_on_retry?: TraceErrorOnRetry14 - role?: Role14 - pdl__context?: PdlContext14 - pdl__id?: PdlId14 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType6 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown - pdl__location?: PdlLocationType | null - pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf14 - kind?: Kind14 - data: unknown - raw?: Raw -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs7 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ + pdl__timing?: PdlTiming | null + pdl__is_leaf?: PdlIsLeaf6 + kind?: Kind6 + data: unknown + raw?: Raw +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs7 { + [k: string]: BlockType } /** * Conditional control structure. @@ -3902,7 +1736,11 @@ export interface Defs7 { * ``` */ export interface IfBlock { - description?: Description8 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -3933,31 +1771,64 @@ export interface IfBlock { } | null defs?: Defs8 - def?: Def17 - contribute?: Contribute13 - parser?: Parser13 - fallback?: Fallback13 - retry?: Retry13 - trace_error_on_retry?: TraceErrorOnRetry13 - role?: Role13 - pdl__context?: PdlContext13 - pdl__id?: PdlId13 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType7 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf13 - context?: IndependentEnum8 - kind?: Kind13 - if: If1 - then: Then1 - else?: Else -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs8 { - [k: string]: + pdl__is_leaf?: PdlIsLeaf7 + context?: IndependentEnum + kind?: Kind7 + /** + * Condition. + * + */ + if: LocalizedExpression | boolean | string + /** + * Branch to execute if the condition is true. + * + */ + then: | boolean | number | string @@ -3984,6 +1855,18 @@ export interface Defs8 { | ErrorBlock | EmptyBlock | null + /** + * Branch to execute if the condition is false. + * + */ + else?: BlockType | null +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs8 { + [k: string]: BlockType } /** * Match control structure. @@ -4006,7 +1889,11 @@ export interface Defs8 { * - then: Too low */ export interface MatchBlock { - description?: Description9 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4037,56 +1924,105 @@ export interface MatchBlock { } | null defs?: Defs9 - def?: Def12 - contribute?: Contribute12 - parser?: Parser12 - fallback?: Fallback12 - retry?: Retry12 - trace_error_on_retry?: TraceErrorOnRetry12 - role?: Role12 - pdl__context?: PdlContext12 - pdl__id?: PdlId12 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType8 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf12 - context?: IndependentEnum7 - kind?: Kind12 + pdl__is_leaf?: PdlIsLeaf8 + context?: IndependentEnum1 + kind?: Kind8 match: unknown - with: With1 + with: With } /** * Set of definitions executed before the execution of the block. * */ export interface Defs9 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType +} +/** + * Case of a match. + */ +export interface MatchCase { + case?: PatternType | null + if?: ExpressionBool | null + then: BlockType + pdl__case_result?: PdlCaseResult + pdl__if_result?: PdlIfResult + pdl__matched?: PdlMatched +} +/** + * Match any of the patterns. + */ +export interface OrPattern { + def?: string | null + anyOf: Anyof +} +/** + * Match an array. + */ +export interface ArrayPattern { + def?: string | null + array: Array +} +/** + * Match an object. + */ +export interface ObjectPattern { + def?: string | null + object: Object1 +} +export interface Object1 { + [k: string]: PatternType +} +/** + * Match any value. + */ +export interface AnyPattern { + def?: string | null + any: Any } /** * Repeat the execution of a block sequentially. @@ -4115,7 +2051,11 @@ export interface Defs9 { * ``` */ export interface RepeatBlock { - description?: Description10 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4146,36 +2086,70 @@ export interface RepeatBlock { } | null defs?: Defs10 - def?: Def11 - contribute?: Contribute11 - parser?: Parser11 - fallback?: Fallback11 - retry?: Retry11 - trace_error_on_retry?: TraceErrorOnRetry11 - role?: Role11 - pdl__context?: PdlContext11 - pdl__id?: PdlId11 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType9 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf11 - context?: IndependentEnum6 - kind?: Kind11 - for?: For1 - index?: Index1 - while?: While - repeat: Repeat - until?: Until - maxIterations?: Maxiterations1 - join?: Join1 - pdl__trace?: PdlTrace3 -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs10 { - [k: string]: + pdl__is_leaf?: PdlIsLeaf9 + context?: IndependentEnum2 + kind?: Kind9 + for?: For + /** + * Name of the variable containing the loop iteration. + * + */ + index?: string | null + /** + * Condition to stay at the beginning of the loop. + * + */ + while?: LocalizedExpression | boolean | string + /** + * Body of the loop. + * + */ + repeat: | boolean | number | string @@ -4202,6 +2176,29 @@ export interface Defs10 { | ErrorBlock | EmptyBlock | null + /** + * Condition to exit at the end of the loop. + * + */ + until?: LocalizedExpression | boolean | string + /** + * Maximal number of iterations to perform. + * + */ + maxIterations?: ExpressionInt | null + /** + * Define how to combine the result of each iteration. + * + */ + join?: JoinText | JoinArray | JoinObject | JoinLastOf | JoinReduce + pdl__trace?: PdlTrace1 +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs10 { + [k: string]: BlockType } /** * Independent executions of a block. @@ -4228,7 +2225,11 @@ export interface Defs10 { * ``` */ export interface MapBlock { - description?: Description11 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4259,34 +2260,65 @@ export interface MapBlock { } | null defs?: Defs11 - def?: Def10 - contribute?: Contribute10 - parser?: Parser10 - fallback?: Fallback10 - retry?: Retry10 - trace_error_on_retry?: TraceErrorOnRetry10 - role?: Role10 - pdl__context?: PdlContext10 - pdl__id?: PdlId10 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType10 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null - pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf10 - context?: IndependentEnum5 - kind?: Kind10 - for?: For - index?: Index - map: Map - maxIterations?: Maxiterations - join?: Join - pdl__trace?: PdlTrace2 -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs11 { - [k: string]: + /** + * Execution timing information. + */ + pdl__timing?: PdlTiming | null + pdl__is_leaf?: PdlIsLeaf10 + context?: IndependentEnum3 + kind?: Kind10 + for?: For1 + /** + * Name of the variable containing the loop iteration. + * + */ + index?: string | null + /** + * Body of the iterator. + * + */ + map: | boolean | number | string @@ -4313,12 +2345,34 @@ export interface Defs11 { | ErrorBlock | EmptyBlock | null + /** + * Maximal number of iterations to perform. + * + */ + maxIterations?: ExpressionInt | null + /** + * Define how to combine the result of each iteration. + * + */ + join?: JoinText | JoinArray | JoinObject | JoinLastOf | JoinReduce + pdl__trace?: PdlTrace +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs11 { + [k: string]: BlockType } /** * Create the concatenation of the stringify version of the result of each block of the list of blocks. */ export interface TextBlock { - description?: Description12 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4349,21 +2403,54 @@ export interface TextBlock { } | null defs?: Defs12 - def?: Def9 - contribute?: Contribute9 - parser?: Parser9 - fallback?: Fallback9 - retry?: Retry9 - trace_error_on_retry?: TraceErrorOnRetry9 - role?: Role9 - pdl__context?: PdlContext9 - pdl__id?: PdlId9 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType11 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf9 + pdl__is_leaf?: PdlIsLeaf11 context?: IndependentEnum4 - kind?: Kind9 + kind?: Kind11 text: Text } /** @@ -4371,39 +2458,17 @@ export interface TextBlock { * */ export interface Defs12 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Return the value of the last block if the list of blocks. */ export interface LastOfBlock { - description?: Description13 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4434,21 +2499,54 @@ export interface LastOfBlock { } | null defs?: Defs13 - def?: Def8 - contribute?: Contribute8 - parser?: Parser8 - fallback?: Fallback8 - retry?: Retry8 - trace_error_on_retry?: TraceErrorOnRetry8 - role?: Role8 - pdl__context?: PdlContext8 - pdl__id?: PdlId8 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType12 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf8 - context?: IndependentEnum3 - kind?: Kind8 + pdl__is_leaf?: PdlIsLeaf12 + context?: IndependentEnum5 + kind?: Kind12 lastOf: Lastof } /** @@ -4456,39 +2554,17 @@ export interface LastOfBlock { * */ export interface Defs13 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Return the array of values computed by each block of the list of blocks. */ export interface ArrayBlock { - description?: Description14 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4519,61 +2595,72 @@ export interface ArrayBlock { } | null defs?: Defs14 - def?: Def7 - contribute?: Contribute7 - parser?: Parser7 - fallback?: Fallback7 - retry?: Retry7 - trace_error_on_retry?: TraceErrorOnRetry7 - role?: Role7 - pdl__context?: PdlContext7 - pdl__id?: PdlId7 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType13 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf7 - context?: IndependentEnum2 - kind?: Kind7 - array: Array + pdl__is_leaf?: PdlIsLeaf13 + context?: IndependentEnum6 + kind?: Kind13 + array: Array1 } /** * Set of definitions executed before the execution of the block. * */ export interface Defs14 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Return the object where the value of each field is defined by a block. If the body of the object is an array, the resulting object is the union of the objects computed by each element of the array. */ export interface ObjectBlock { - description?: Description15 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4604,61 +2691,72 @@ export interface ObjectBlock { } | null defs?: Defs15 - def?: Def6 - contribute?: Contribute6 - parser?: Parser6 - fallback?: Fallback6 - retry?: Retry6 - trace_error_on_retry?: TraceErrorOnRetry6 - role?: Role6 - pdl__context?: PdlContext6 - pdl__id?: PdlId6 - pdl__result?: unknown - pdl__location?: PdlLocationType | null - pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf6 - context?: IndependentEnum1 - kind?: Kind6 - object: Object1 -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs15 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType14 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null + pdl__result?: unknown + pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ + pdl__timing?: PdlTiming | null + pdl__is_leaf?: PdlIsLeaf14 + context?: IndependentEnum7 + kind?: Kind14 + object: Object2 +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs15 { + [k: string]: BlockType } /** * Create a message. */ export interface MessageBlock { - description?: Description16 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4689,30 +2787,57 @@ export interface MessageBlock { } | null defs?: Defs16 - def?: Def5 - contribute?: Contribute5 - parser?: Parser5 - fallback?: Fallback5 - retry?: Retry5 - trace_error_on_retry?: TraceErrorOnRetry5 - role?: Role5 - pdl__context?: PdlContext5 - pdl__id?: PdlId5 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType15 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf5 - kind?: Kind5 - content: Content - name?: Name - tool_call_id?: ToolCallId -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs16 { - [k: string]: + pdl__is_leaf?: PdlIsLeaf15 + kind?: Kind15 + /** + * Content of the message. + */ + content: | boolean | number | string @@ -4739,6 +2864,21 @@ export interface Defs16 { | ErrorBlock | EmptyBlock | null + /** + * For example, the name of the tool that was invoked, for which this message is the tool response. + */ + name?: ExpressionStr | null + /** + * The id of the tool invocation for which this message is the tool response. + */ + tool_call_id?: ExpressionStr | null +} +/** + * Set of definitions executed before the execution of the block. + * + */ +export interface Defs16 { + [k: string]: BlockType } /** * Read from a file or standard input. @@ -4756,7 +2896,11 @@ export interface Defs16 { * ``` */ export interface ReadBlock { - description?: Description17 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4787,22 +2931,63 @@ export interface ReadBlock { } | null defs?: Defs17 - def?: Def4 - contribute?: Contribute4 - parser?: Parser4 - fallback?: Fallback4 - retry?: Retry4 - trace_error_on_retry?: TraceErrorOnRetry4 - role?: Role4 - pdl__context?: PdlContext4 - pdl__id?: PdlId4 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType16 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf4 - kind?: Kind4 - read: Read - message?: Message + pdl__is_leaf?: PdlIsLeaf16 + kind?: Kind16 + /** + * Name of the file to read. If `None`, read the standard input. + * + */ + read: ExpressionStr | null + /** + * Message to prompt the user to enter a value. + * + */ + message?: string | null multiline?: Multiline } /** @@ -4810,39 +2995,17 @@ export interface ReadBlock { * */ export interface Defs17 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + [k: string]: BlockType } /** * Include a PDL file. */ export interface IncludeBlock { - description?: Description18 + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -4873,147 +3036,73 @@ export interface IncludeBlock { } | null defs?: Defs18 - def?: Def3 - contribute?: Contribute3 - parser?: Parser3 - fallback?: Fallback3 - retry?: Retry3 - trace_error_on_retry?: TraceErrorOnRetry3 - role?: Role3 - pdl__context?: PdlContext3 - pdl__id?: PdlId3 - pdl__result?: unknown - pdl__location?: PdlLocationType | null - pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf3 - context?: IndependentEnum - kind?: Kind3 - include: Include - pdl__trace?: PdlTrace1 -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs18 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null -} -/** - * Import a PDL file. - */ -export interface ImportBlock { - description?: Description19 /** - * Type specification of the result of the block. + * Name of the variable used to store the result of the execution of the block. * */ - spec?: - | ( - | "null" - | "boolean" - | "string" - | "number" - | "integer" - | "array" - | "object" - | "bool" - | "str" - | "float" - | "int" - | "list" - | "obj" - ) - | EnumPdlType - | PdlTypeType[] - | OptionalPdlType - | JsonSchemaTypePdlType - | ObjectPdlType - | { - [k: string]: PdlTypeType - } - | null - defs?: Defs19 - def?: Def2 - contribute?: Contribute2 - parser?: Parser2 - fallback?: Fallback2 - retry?: Retry2 - trace_error_on_retry?: TraceErrorOnRetry2 - role?: Role2 - pdl__context?: PdlContext2 - pdl__id?: PdlId2 + def?: string | null + contribute?: ContributeType17 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf2 - kind?: Kind2 - import: Import - pdl__trace?: PdlTrace -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs19 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null + pdl__is_leaf?: PdlIsLeaf17 + context?: IndependentEnum8 + kind?: Kind17 + include: Include + pdl__trace?: BlockType | null } /** - * Block representing an error generated at runtime. + * Set of definitions executed before the execution of the block. + * */ -export interface ErrorBlock { - description?: Description20 +export interface Defs18 { + [k: string]: BlockType +} +/** + * Import a PDL file. + */ +export interface ImportBlock { + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -5043,62 +3132,73 @@ export interface ErrorBlock { [k: string]: PdlTypeType } | null - defs?: Defs20 - def?: Def1 - contribute?: Contribute1 - parser?: Parser1 - fallback?: Fallback1 - retry?: Retry1 - trace_error_on_retry?: TraceErrorOnRetry1 - role?: Role1 - pdl__context?: PdlContext1 - pdl__id?: PdlId1 + defs?: Defs19 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType18 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf1 - kind?: Kind1 - msg: Msg - program: Program1 + pdl__is_leaf?: PdlIsLeaf18 + kind?: Kind18 + import: Import + pdl__trace?: BlockType | null } /** * Set of definitions executed before the execution of the block. * */ -export interface Defs20 { - [k: string]: - | boolean - | number - | string - | FunctionBlock - | CallBlock - | LitellmModelBlock - | GraniteioModelBlock - | CodeBlock - | ArgsBlock - | GetBlock - | DataBlock - | IfBlock - | MatchBlock - | RepeatBlock - | MapBlock - | TextBlock - | LastOfBlock - | ArrayBlock - | ObjectBlock - | MessageBlock - | ReadBlock - | IncludeBlock - | ImportBlock - | ErrorBlock - | EmptyBlock - | null +export interface Defs19 { + [k: string]: BlockType } /** - * Block without an action. It can contain definitions. + * Block representing an error generated at runtime. */ -export interface EmptyBlock { - description?: Description21 +export interface ErrorBlock { + /** + * Documentation associated to the block. + * + */ + description?: string | null /** * Type specification of the result of the block. * @@ -5128,28 +3228,60 @@ export interface EmptyBlock { [k: string]: PdlTypeType } | null - defs?: Defs21 - def?: Def - contribute?: Contribute - parser?: Parser - fallback?: Fallback - retry?: Retry - trace_error_on_retry?: TraceErrorOnRetry - role?: Role - pdl__context?: PdlContext - pdl__id?: PdlId + defs?: Defs20 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType19 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null pdl__result?: unknown pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ pdl__timing?: PdlTiming | null - pdl__is_leaf?: PdlIsLeaf - kind?: Kind -} -/** - * Set of definitions executed before the execution of the block. - * - */ -export interface Defs21 { - [k: string]: + pdl__is_leaf?: PdlIsLeaf19 + kind?: Kind19 + msg: Msg + /** + * Block that raised the error. + * + */ + program: | boolean | number | string @@ -5178,67 +3310,25 @@ export interface Defs21 { | null } /** - * Contribution of a specific value instead of the default one. - */ -export interface ContributeValue { - value: Value -} -export interface LocalizedExpression { - pdl__expr: PdlExpr - pdl__result?: unknown - pdl__location?: PdlLocationType | null -} -export interface PdlExpr { - [k: string]: unknown -} -/** - * Internal data structure to keep track of the source location information. - */ -export interface PdlLocationType { - path: Path - file: File - table: Table -} -export interface Table { - [k: string]: number -} -/** - * Use a PDL program as a parser specification (experimental). + * Set of definitions executed before the execution of the block. + * */ -export interface PdlParser { - description?: Description22 - spec?: - | ( - | "null" - | "boolean" - | "string" - | "number" - | "integer" - | "array" - | "object" - | "bool" - | "str" - | "float" - | "int" - | "list" - | "obj" - ) - | EnumPdlType - | PdlTypeType[] - | OptionalPdlType - | JsonSchemaTypePdlType - | ObjectPdlType - | { - [k: string]: PdlTypeType - } - | null - pdl: Pdl +export interface Defs20 { + [k: string]: BlockType } /** - * A regular expression parser. + * Block without an action. It can contain definitions. */ -export interface RegexParser { - description?: Description23 +export interface EmptyBlock { + /** + * Documentation associated to the block. + * + */ + description?: string | null + /** + * Type specification of the result of the block. + * + */ spec?: | ( | "null" @@ -5264,24 +3354,68 @@ export interface RegexParser { [k: string]: PdlTypeType } | null - regex: Regex - mode?: Mode + defs?: Defs21 + /** + * Name of the variable used to store the result of the execution of the block. + * + */ + def?: string | null + contribute?: ContributeType20 + /** + * Parser to use to construct a value out of a string result. + */ + parser?: ParserType | null + /** + * Block to execute in case of error. + * + */ + fallback?: BlockType | null + /** + * The maximum number of times to retry when an error occurs within a block. + * + */ + retry?: number | null + /** + * Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. + * + */ + trace_error_on_retry?: boolean | string | null + /** + * Role associated to the block and sub-blocks. + * Typical roles are `system`, `user`, and `assistant`, + * but there may be other roles such as `available_tools`. + */ + role?: string | null + /** + * Current context. + */ + pdl__context?: ModelInput | null + /** + * Unique identifier for this block. + */ + pdl__id?: string | null + pdl__result?: unknown + pdl__location?: PdlLocationType | null + /** + * Execution timing information. + */ + pdl__timing?: PdlTiming | null + pdl__is_leaf?: PdlIsLeaf20 + kind?: Kind20 } /** - * Internal data structure to record timing information in the trace. + * Set of definitions executed before the execution of the block. + * */ -export interface PdlTiming { - start_nanos?: StartNanos - end_nanos?: EndNanos - first_use_nanos?: FirstUseNanos - timezone?: Timezone +export interface Defs21 { + [k: string]: BlockType } /** * Join loop iterations as a string. */ export interface JoinText { as?: As - with?: With + with?: With1 } /** * Join loop iterations as an array. @@ -5308,62 +3442,12 @@ export interface JoinReduce { as?: As4 reduce: Reduce } -/** - * Case of a match. - */ -export interface MatchCase { - case?: Case - if?: If - then: Then - pdl__case_result?: PdlCaseResult - pdl__if_result?: PdlIfResult - pdl__matched?: PdlMatched -} -/** - * Match any of the patterns. - */ -export interface OrPattern { - def?: Def13 - anyOf: Anyof -} -/** - * Match an array. - */ -export interface ArrayPattern { - def?: Def14 - array: Array1 -} -/** - * Match an object. - */ -export interface ObjectPattern { - def?: Def15 - object: Object2 -} -export interface Object2 { - [k: string]: - | boolean - | number - | string - | OrPattern - | ArrayPattern - | ObjectPattern - | AnyPattern - | null -} -/** - * Match any value. - */ -export interface AnyPattern { - def?: Def16 - any: Any -} /** * Internal data structure to record token consumption usage information. */ export interface PdlUsage { - completion_tokens?: CompletionTokens - prompt_tokens?: PromptTokens + completion_tokens?: number | null + prompt_tokens?: number | null [k: string]: unknown } /** diff --git a/src/pdl/pdl-schema.json b/src/pdl/pdl-schema.json index 3d9575364..230ad79bd 100644 --- a/src/pdl/pdl-schema.json +++ b/src/pdl/pdl-schema.json @@ -5,16 +5,8 @@ "description": "Match any value.", "properties": { "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Def" + "$ref": "#/$defs/OptionalStr", + "default": null }, "any": { "const": null, @@ -33,17 +25,9 @@ "description": "Execute a command line, which will spawn a subprocess with the given argument vector. Note: if you need a shell script execution, you must wrap your command line in /bin/sh or some shell of your choosing.\n\nExample:\n```PDL\nargs:\n- /bin/sh\n- \"-c\"\n- \"if [[ $x = 1 ]]; then echo y; else echo n; fi\"\n```", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -52,89 +36,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -142,256 +44,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -414,14 +126,7 @@ "args": { "description": "The argument vector to spawn.\n ", "items": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - } - ] + "$ref": "#/$defs/ExpressionStr" }, "title": "Args", "type": "array" @@ -438,17 +143,9 @@ "description": "Return the array of values computed by each block of the list of blocks.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -457,89 +154,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -547,256 +162,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": false, @@ -817,89 +242,7 @@ "array": { "description": "Elements of the array.", "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "title": "Array", "type": "array" @@ -916,48 +259,12 @@ "description": "Match an array.", "properties": { "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Def" + "$ref": "#/$defs/OptionalStr", + "default": null }, "array": { "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/OrPattern" - }, - { - "$ref": "#/$defs/ArrayPattern" - }, - { - "$ref": "#/$defs/ObjectPattern" - }, - { - "$ref": "#/$defs/AnyPattern" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/PatternType" }, "title": "Array", "type": "array" @@ -969,370 +276,175 @@ "title": "ArrayPattern", "type": "object" }, - "CallBlock": { - "additionalProperties": false, - "description": "Calling a function.", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "BlockType": { + "anyOf": [ + { + "type": "boolean" }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " + { + "type": "integer" }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" + { + "type": "number" }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + { + "type": "string" }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] + { + "$ref": "#/$defs/FunctionBlock" + }, + { + "$ref": "#/$defs/CallBlock" + }, + { + "$ref": "#/$defs/LitellmModelBlock" + }, + { + "$ref": "#/$defs/GraniteioModelBlock" + }, + { + "$ref": "#/$defs/CodeBlock" + }, + { + "$ref": "#/$defs/ArgsBlock" + }, + { + "$ref": "#/$defs/GetBlock" + }, + { + "$ref": "#/$defs/DataBlock" + }, + { + "$ref": "#/$defs/IfBlock" + }, + { + "$ref": "#/$defs/MatchBlock" + }, + { + "$ref": "#/$defs/RepeatBlock" + }, + { + "$ref": "#/$defs/MapBlock" + }, + { + "$ref": "#/$defs/TextBlock" + }, + { + "$ref": "#/$defs/LastOfBlock" + }, + { + "$ref": "#/$defs/ArrayBlock" + }, + { + "$ref": "#/$defs/ObjectBlock" + }, + { + "$ref": "#/$defs/MessageBlock" + }, + { + "$ref": "#/$defs/ReadBlock" + }, + { + "$ref": "#/$defs/IncludeBlock" + }, + { + "$ref": "#/$defs/ImportBlock" + }, + { + "$ref": "#/$defs/ErrorBlock" + }, + { + "$ref": "#/$defs/EmptyBlock" + }, + { + "type": "null" + } + ] + }, + "CallBlock": { + "additionalProperties": false, + "description": "Calling a function.", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" }, - "title": "Contribute", - "type": "array" + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -1376,91 +488,8 @@ "title": "Args" }, "pdl__trace": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Trace" + "$ref": "#/$defs/OptionalBlockType", + "default": null } }, "required": [ @@ -1474,17 +503,9 @@ "description": "Execute a piece of code.\n\nExample:\n```PDL\nlang: python\ncode: |\n import random\n # (In PDL, set `result` to the output you wish for your code block.)\n result = random.randint(1, 20)\n```", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -1493,89 +514,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -1583,256 +522,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -1859,91 +608,8 @@ "type": "string" }, "code": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Code to execute.\n ", - "title": "Code" + "$ref": "#/$defs/BlockType", + "description": "Code to execute.\n " } }, "required": [ @@ -1962,6 +628,22 @@ "title": "ContributeTarget", "type": "string" }, + "ContributeType": { + "items": { + "anyOf": [ + { + "$ref": "#/$defs/ContributeTarget" + }, + { + "additionalProperties": { + "$ref": "#/$defs/ContributeValue" + }, + "type": "object" + } + ] + }, + "type": "array" + }, "ContributeValue": { "additionalProperties": false, "description": "Contribution of a specific value instead of the default one.", @@ -1993,17 +675,9 @@ "description": "Arbitrary value, equivalent to JSON.\n\nExample. As part of a `defs` section, set `numbers` to the list `[1, 2, 3, 4]`:\n```PDL\ndefs:\n numbers:\n data: [1, 2, 3, 4]\n```\n\nExample. Evaluate `${ TEST.answer }` in\n[Jinja](https://jinja.palletsprojects.com/en/stable/), passing\nthe result to a regex parser with capture groups. Set\n`EXTRACTED_GROUND_TRUTH` to an object with attribute `answer`,\na string, containing the value of the capture group.\n```PDL\n- data: ${ TEST.answer }\n parser:\n regex: \"(.|\\n)*#### (?P([0-9])*)\\n*\"\n spec:\n answer: string\n def: EXTRACTED_GROUND_TRUTH\n```", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -2012,89 +686,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -2102,256 +694,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -2396,17 +798,9 @@ "description": "Block without an action. It can contain definitions.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -2415,89 +809,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -2505,256 +817,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -2793,17 +915,9 @@ "description": "Block representing an error generated at runtime.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -2812,89 +926,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -2902,256 +934,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -3171,91 +1013,8 @@ "type": "string" }, "program": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Block that raised the error.\n ", - "title": "Program" + "$ref": "#/$defs/BlockType", + "description": "Block that raised the error.\n " } }, "required": [ @@ -3265,22 +1024,50 @@ "title": "ErrorBlock", "type": "object" }, + "ExpressionBool": { + "anyOf": [ + { + "$ref": "#/$defs/LocalizedExpression_TypeVar_" + }, + { + "type": "boolean" + }, + { + "type": "string" + } + ] + }, + "ExpressionInt": { + "anyOf": [ + { + "$ref": "#/$defs/LocalizedExpression_TypeVar_" + }, + { + "type": "integer" + }, + { + "type": "string" + } + ] + }, + "ExpressionStr": { + "anyOf": [ + { + "$ref": "#/$defs/LocalizedExpression_TypeVar_" + }, + { + "type": "string" + } + ] + }, "FunctionBlock": { "additionalProperties": false, "description": "Function declaration.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -3289,89 +1076,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -3379,256 +1084,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -3658,91 +1173,8 @@ "title": "Function" }, "return": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Body of the function.\n ", - "title": "Return" + "$ref": "#/$defs/BlockType", + "description": "Body of the function.\n " }, "signature": { "anyOf": [ @@ -3772,17 +1204,9 @@ "description": "Get the value of a variable.\n\nThe GetBlock is deprecated. Use DataBlock instead.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -3791,89 +1215,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -3881,256 +1223,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": true, @@ -4161,17 +1313,9 @@ "description": "Call an LLM through the granite-io API.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -4180,89 +1324,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -4270,519 +1332,424 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": true, + "default": true, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "kind": { + "const": "model", + "default": "model", + "title": "Kind", + "type": "string" + }, + "input": { + "$ref": "#/$defs/BlockType", + "default": "${ pdl_context }", + "description": "Messages to send to the model.\n " + }, + "modelResponse": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Variable where to store the raw response of the model.\n " + }, + "pdl__usage": { + "$ref": "#/$defs/OptionalPdlUsage", + "default": null, + "description": "Tokens consumed during model call\n " + }, + "pdl__model_input": { + "$ref": "#/$defs/OptionalModelInput", + "default": null + }, + "platform": { + "const": "granite-io", + "default": "granite-io", + "description": "Optional field to ensure that the block is using granite-io.\n ", + "title": "Platform", + "type": "string" + }, + "processor": { "anyOf": [ { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" + "$ref": "#/$defs/GraniteioProcessor" }, { - "$ref": "#/$defs/RegexParser" + "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, + {}, { - "type": "null" + "type": "string" } ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "IO Processor configuration or object.\n ", + "title": "Processor" }, - "fallback": { + "parameters": { "anyOf": [ { - "type": "boolean" - }, - { - "type": "integer" + "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, { - "type": "number" + "additionalProperties": true, + "type": "object" }, { "type": "string" }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, { "type": "null" } ], "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Parameters sent to the model.\n ", + "title": "Parameters" + } + }, + "required": [ + "processor" + ], + "title": "GraniteioModelBlock", + "type": "object" + }, + "GraniteioProcessor": { + "properties": { + "type": { + "$ref": "#/$defs/OptionalExpressionStr", + "default": null }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "model": { + "$ref": "#/$defs/OptionalExpressionStr", + "default": null }, - "trace_error_on_retry": { + "backend": { "anyOf": [ { - "type": "boolean" + "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, { "type": "string" }, { - "type": "null" - } + "additionalProperties": true, + "type": "object" + }, + {} ], + "title": "Backend" + } + }, + "required": [ + "backend" + ], + "title": "GraniteioProcessor", + "type": "object" + }, + "IfBlock": { + "additionalProperties": false, + "description": "Conditional control structure.\n\nExample:\n```PDL\ndefs:\n answer:\n read:\n message: \"Enter a number? \"\nif: ${ (answer | int) == 42 }\nthen: You won!\n```", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Documentation associated to the block.\n " }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { - "const": true, - "default": true, + "const": false, + "default": false, "title": "Pdl Is Leaf", "type": "boolean" }, + "context": { + "$ref": "#/$defs/IndependentEnum", + "default": "dependent" + }, "kind": { - "const": "model", - "default": "model", + "const": "if", + "default": "if", "title": "Kind", "type": "string" }, - "input": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": "${ pdl_context }", - "description": "Messages to send to the model.\n ", - "title": "Input" + "if": { + "$ref": "#/$defs/ExpressionBool", + "description": "Condition.\n " }, - "modelResponse": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Variable where to store the raw response of the model.\n ", - "title": "Modelresponse" - }, - "pdl__usage": { - "anyOf": [ - { - "$ref": "#/$defs/PdlUsage" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Tokens consumed during model call\n " - }, - "pdl__model_input": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Model Input" - }, - "platform": { - "const": "granite-io", - "default": "granite-io", - "description": "Optional field to ensure that the block is using granite-io.\n ", - "title": "Platform", - "type": "string" - }, - "processor": { - "anyOf": [ - { - "$ref": "#/$defs/GraniteioProcessor" - }, - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - {}, - { - "type": "string" - } - ], - "description": "IO Processor configuration or object.\n ", - "title": "Processor" + "then": { + "$ref": "#/$defs/BlockType", + "description": "Branch to execute if the condition is true.\n " }, - "parameters": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "else": { + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Parameters sent to the model.\n ", - "title": "Parameters" + "description": "Branch to execute if the condition is false.\n " } }, "required": [ - "processor" + "if", + "then" ], - "title": "GraniteioModelBlock", + "title": "IfBlock", "type": "object" }, - "GraniteioProcessor": { + "ImportBlock": { + "additionalProperties": false, + "description": "Import a PDL file.", "properties": { - "type": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "description": { + "$ref": "#/$defs/OptionalStr", "default": null, - "title": "Type" + "description": "Documentation associated to the block.\n " }, - "model": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "spec": { + "$ref": "#/$defs/PdlTypeType", "default": null, - "title": "Model" + "description": "Type specification of the result of the block.\n " }, - "backend": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "additionalProperties": true, - "type": "object" - }, - {} + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], - "title": "Backend" + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": true, + "default": true, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "kind": { + "const": "import", + "default": "import", + "title": "Kind", + "type": "string" + }, + "import": { + "description": "Name of the file to import.\n ", + "title": "Import", + "type": "string" + }, + "pdl__trace": { + "$ref": "#/$defs/OptionalBlockType", + "default": null } }, "required": [ - "backend" + "import" ], - "title": "GraniteioProcessor", + "title": "ImportBlock", "type": "object" }, - "IfBlock": { + "IncludeBlock": { "additionalProperties": false, - "description": "Conditional control structure.\n\nExample:\n```PDL\ndefs:\n answer:\n read:\n message: \"Enter a number? \"\nif: ${ (answer | int) == 42 }\nthen: You won!\n```", + "description": "Include a PDL file.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -4791,89 +1758,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -4881,256 +1766,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": false, @@ -5143,225 +1838,188 @@ "default": "dependent" }, "kind": { - "const": "if", - "default": "if", + "const": "include", + "default": "include", "title": "Kind", "type": "string" }, - "if": { + "include": { + "description": "Name of the file to include.\n ", + "title": "Include", + "type": "string" + }, + "pdl__trace": { + "$ref": "#/$defs/OptionalBlockType", + "default": null + } + }, + "required": [ + "include" + ], + "title": "IncludeBlock", + "type": "object" + }, + "IndependentEnum": { + "enum": [ + "independent", + "dependent" + ], + "title": "IndependentEnum", + "type": "string" + }, + "JoinArray": { + "additionalProperties": false, + "description": "Join loop iterations as an array.", + "properties": { + "as": { + "const": "array", + "description": "Return the result of each iteration as an array.\n ", + "title": "As", + "type": "string" + } + }, + "required": [ + "as" + ], + "title": "JoinArray", + "type": "object" + }, + "JoinLastOf": { + "additionalProperties": false, + "description": "Join loop iterations as the value of the last iteration.", + "properties": { + "as": { + "const": "lastOf", + "description": "Return the result of the last iteration.\n ", + "title": "As", + "type": "string" + } + }, + "required": [ + "as" + ], + "title": "JoinLastOf", + "type": "object" + }, + "JoinObject": { + "additionalProperties": false, + "description": "Join loop iterations as an object.", + "properties": { + "as": { + "const": "object", + "description": "Return the union of the objects created at each iteration.\n ", + "title": "As", + "type": "string" + } + }, + "required": [ + "as" + ], + "title": "JoinObject", + "type": "object" + }, + "JoinReduce": { + "additionalProperties": false, + "description": "Join loop iterations as the value of the last iteration.", + "properties": { + "as": { + "const": "reduce", + "default": "reduce", + "title": "As", + "type": "string" + }, + "reduce": { "anyOf": [ { "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, - { - "type": "boolean" - }, { "type": "string" } ], - "description": "Condition.\n ", - "title": "If" + "description": "Function used to combine the results.", + "title": "Reduce" + } + }, + "required": [ + "reduce" + ], + "title": "JoinReduce", + "type": "object" + }, + "JoinText": { + "additionalProperties": false, + "description": "Join loop iterations as a string.", + "properties": { + "as": { + "const": "text", + "default": "text", + "description": "String concatenation of the result of each iteration.\n ", + "title": "As", + "type": "string" }, - "then": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Branch to execute if the condition is true.\n ", - "title": "Then" + "with": { + "default": "", + "description": "String used to concatenate each iteration of the loop.\n ", + "title": "With", + "type": "string" + } + }, + "title": "JoinText", + "type": "object" + }, + "JoinType": { + "anyOf": [ + { + "$ref": "#/$defs/JoinText" }, - "else": { + { + "$ref": "#/$defs/JoinArray" + }, + { + "$ref": "#/$defs/JoinObject" + }, + { + "$ref": "#/$defs/JoinLastOf" + }, + { + "$ref": "#/$defs/JoinReduce" + } + ] + }, + "JsonSchemaTypePdlType": { + "additionalProperties": true, + "description": "Json Schema with a type field.", + "properties": { + "type": { "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, { "type": "string" }, { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" + "items": { + "type": "string" + }, + "type": "array" } ], - "default": null, - "description": "Branch to execute if the condition is false.\n ", - "title": "Else" + "title": "Type" } }, "required": [ - "if", - "then" + "type" ], - "title": "IfBlock", + "title": "JsonSchemaTypePdlType", "type": "object" }, - "ImportBlock": { + "LastOfBlock": { "additionalProperties": false, - "description": "Import a PDL file.", + "description": "Return the value of the last block if the list of blocks.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -5370,89 +2028,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -5460,169 +2036,293 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": false, + "default": false, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "context": { + "$ref": "#/$defs/IndependentEnum", + "default": "dependent" + }, + "kind": { + "const": "lastOf", + "default": "lastOf", + "title": "Kind", + "type": "string" + }, + "lastOf": { + "description": "Sequence of blocks to execute.", + "items": { + "$ref": "#/$defs/BlockType" + }, + "title": "Lastof", + "type": "array" + } + }, + "required": [ + "lastOf" + ], + "title": "LastOfBlock", + "type": "object" + }, + "LitellmModelBlock": { + "additionalProperties": false, + "description": "Call an LLM through [the LiteLLM API](https://docs.litellm.ai/).\n\nExample:\n```PDL\nmodel: ollama/granite-code:8b\nparameters:\n stop: ['!']\n```", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" + ], + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": true, + "default": true, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "kind": { + "const": "model", + "default": "model", + "title": "Kind", + "type": "string" + }, + "input": { + "$ref": "#/$defs/BlockType", + "default": "${ pdl_context }", + "description": "Messages to send to the model.\n " + }, + "modelResponse": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Variable where to store the raw response of the model.\n " + }, + "pdl__usage": { + "$ref": "#/$defs/OptionalPdlUsage", + "default": null, + "description": "Tokens consumed during model call\n " + }, + "pdl__model_input": { + "$ref": "#/$defs/OptionalModelInput", + "default": null + }, + "platform": { + "const": "litellm", + "default": "litellm", + "description": "Optional field to ensure that the block is using LiteLLM.\n ", + "title": "Platform", + "type": "string" + }, + "model": { + "$ref": "#/$defs/ExpressionStr", + "description": "Name of the model following the LiteLLM convention.\n " + }, + "parameters": { + "anyOf": [ { - "$ref": "#/$defs/MessageBlock" + "$ref": "#/$defs/LitellmParameters" }, { - "$ref": "#/$defs/ReadBlock" + "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, { - "$ref": "#/$defs/IncludeBlock" + "additionalProperties": true, + "type": "object" }, { - "$ref": "#/$defs/ImportBlock" + "type": "string" }, { - "$ref": "#/$defs/ErrorBlock" + "type": "null" + } + ], + "default": null, + "description": "Parameters to send to the model.\n ", + "title": "Parameters" + } + }, + "required": [ + "model" + ], + "title": "LitellmModelBlock", + "type": "object" + }, + "LitellmParameters": { + "additionalProperties": true, + "description": "Parameters passed to LiteLLM. More details at [https://docs.litellm.ai/docs/completion/input](https://docs.litellm.ai/docs/completion/input).\n\nNote that not all models and platforms accept all parameters.", + "properties": { + "timeout": { + "anyOf": [ + { + "type": "number" }, { - "$ref": "#/$defs/EmptyBlock" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "title": "Timeout" }, - "retry": { + "temperature": { "anyOf": [ { - "type": "integer" + "type": "number" + }, + { + "type": "string" }, { "type": "null" } ], "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "title": "Temperature" }, - "trace_error_on_retry": { + "top_p": { "anyOf": [ { - "type": "boolean" + "type": "number" }, { "type": "string" @@ -5632,11 +2332,13 @@ } ], "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "title": "Top P" }, - "role": { + "n": { "anyOf": [ + { + "type": "integer" + }, { "type": "string" }, @@ -5645,15 +2347,16 @@ } ], "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "title": "N" }, - "pdl__context": { + "stop": { "anyOf": [ + { + "type": "string" + }, { "items": { - "additionalProperties": true, - "type": "object" + "type": "string" }, "type": "array" }, @@ -5661,12 +2364,14 @@ "type": "null" } ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "default": null, + "title": "Stop" }, - "pdl__id": { + "max_tokens": { "anyOf": [ + { + "type": "integer" + }, { "type": "string" }, @@ -5674,160 +2379,88 @@ "type": "null" } ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "default": null, + "title": "Max Tokens" }, - "pdl__result": { + "presence_penalty": { "anyOf": [ - {}, + { + "type": "number" + }, + { + "type": "string" + }, { "type": "null" } ], "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "title": "Presence Penalty" }, - "pdl__location": { + "frequency_penalty": { "anyOf": [ { - "$ref": "#/$defs/PdlLocationType" + "type": "number" + }, + { + "type": "string" }, { "type": "null" } ], - "default": null + "default": null, + "title": "Frequency Penalty" }, - "pdl__timing": { + "logit_bias": { "anyOf": [ { - "$ref": "#/$defs/PdlTiming" + "additionalProperties": true, + "type": "object" + }, + { + "type": "string" }, { "type": "null" } ], - "default": null - }, - "pdl__is_leaf": { - "const": true, - "default": true, - "title": "Pdl Is Leaf", - "type": "boolean" + "default": null, + "title": "Logit Bias" }, - "kind": { - "const": "import", - "default": "import", - "title": "Kind", - "type": "string" - }, - "import": { - "description": "Name of the file to import.\n ", - "title": "Import", - "type": "string" - }, - "pdl__trace": { + "user": { "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, { "type": "string" }, { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, + "type": "null" + } + ], + "default": null, + "title": "User" + }, + "response_format": { + "anyOf": [ { - "$ref": "#/$defs/ErrorBlock" + "additionalProperties": true, + "type": "object" }, { - "$ref": "#/$defs/EmptyBlock" + "type": "string" }, { "type": "null" } ], "default": null, - "title": "Pdl Trace" - } - }, - "required": [ - "import" - ], - "title": "ImportBlock", - "type": "object" - }, - "IncludeBlock": { - "additionalProperties": false, - "description": "Include a PDL file.", - "properties": { - "description": { + "title": "Response Format" + }, + "seed": { "anyOf": [ + { + "type": "integer" + }, { "type": "string" }, @@ -5836,107 +2469,14 @@ } ], "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" + "title": "Seed" }, - "def": { + "tools": { "anyOf": [ + { + "items": {}, + "type": "array" + }, { "type": "string" }, @@ -5945,157 +2485,55 @@ } ], "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" - }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "title": "Tools" }, - "parser": { + "tool_choice": { "anyOf": [ { - "enum": [ - "json", - "jsonl", - "yaml" - ], "type": "string" }, { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" + "additionalProperties": true, + "type": "object" }, { "type": "null" } ], "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "title": "Tool Choice" }, - "fallback": { + "logprobs": { "anyOf": [ { "type": "boolean" }, - { - "type": "integer" - }, - { - "type": "number" - }, { "type": "string" }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, { "type": "null" } ], "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "title": "Logprobs" }, - "retry": { + "top_logprobs": { "anyOf": [ { "type": "integer" }, + { + "type": "string" + }, { "type": "null" } ], "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "title": "Top Logprobs" }, - "trace_error_on_retry": { + "parallel_tool_calls": { "anyOf": [ { "type": "boolean" @@ -6108,11 +2546,14 @@ } ], "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "title": "Parallel Tool Calls" }, - "role": { + "extra_headers": { "anyOf": [ + { + "additionalProperties": true, + "type": "object" + }, { "type": "string" }, @@ -6121,27 +2562,25 @@ } ], "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "title": "Extra Headers" }, - "pdl__context": { + "functions": { "anyOf": [ { - "items": { - "additionalProperties": true, - "type": "object" - }, + "items": {}, "type": "array" }, + { + "type": "string" + }, { "type": "null" } ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "default": null, + "title": "Functions" }, - "pdl__id": { + "function_call": { "anyOf": [ { "type": "string" @@ -6150,308 +2589,139 @@ "type": "null" } ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "default": null, + "title": "Function Call" }, - "pdl__result": { + "base_url": { "anyOf": [ - {}, + { + "type": "string" + }, { "type": "null" } ], "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "title": "Base Url" }, - "pdl__location": { + "api_version": { "anyOf": [ { - "$ref": "#/$defs/PdlLocationType" + "type": "string" }, { "type": "null" } ], - "default": null + "default": null, + "title": "Api Version" }, - "pdl__timing": { + "api_key": { "anyOf": [ { - "$ref": "#/$defs/PdlTiming" + "type": "string" }, { "type": "null" } ], - "default": null - }, - "pdl__is_leaf": { - "const": false, - "default": false, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "context": { - "$ref": "#/$defs/IndependentEnum", - "default": "dependent" - }, - "kind": { - "const": "include", - "default": "include", - "title": "Kind", - "type": "string" - }, - "include": { - "description": "Name of the file to include.\n ", - "title": "Include", - "type": "string" + "default": null, + "title": "Api Key" }, - "pdl__trace": { + "model_list": { "anyOf": [ { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" + "items": {}, + "type": "array" }, { "type": "string" }, { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, + "type": "null" + } + ], + "default": null, + "title": "Model List" + }, + "mock_response": { + "anyOf": [ { - "$ref": "#/$defs/ImportBlock" + "type": "string" }, { - "$ref": "#/$defs/ErrorBlock" - }, + "type": "null" + } + ], + "default": null, + "title": "Mock Response" + }, + "custom_llm_provider": { + "anyOf": [ { - "$ref": "#/$defs/EmptyBlock" + "type": "string" }, { "type": "null" } ], "default": null, - "title": "Pdl Trace" - } - }, - "required": [ - "include" - ], - "title": "IncludeBlock", - "type": "object" - }, - "IndependentEnum": { - "enum": [ - "independent", - "dependent" - ], - "title": "IndependentEnum", - "type": "string" - }, - "JoinArray": { - "additionalProperties": false, - "description": "Join loop iterations as an array.", - "properties": { - "as": { - "const": "array", - "description": "Return the result of each iteration as an array.\n ", - "title": "As", - "type": "string" - } - }, - "required": [ - "as" - ], - "title": "JoinArray", - "type": "object" - }, - "JoinLastOf": { - "additionalProperties": false, - "description": "Join loop iterations as the value of the last iteration.", - "properties": { - "as": { - "const": "lastOf", - "description": "Return the result of the last iteration.\n ", - "title": "As", - "type": "string" - } - }, - "required": [ - "as" - ], - "title": "JoinLastOf", - "type": "object" - }, - "JoinObject": { - "additionalProperties": false, - "description": "Join loop iterations as an object.", - "properties": { - "as": { - "const": "object", - "description": "Return the union of the objects created at each iteration.\n ", - "title": "As", - "type": "string" - } - }, - "required": [ - "as" - ], - "title": "JoinObject", - "type": "object" - }, - "JoinReduce": { - "additionalProperties": false, - "description": "Join loop iterations as the value of the last iteration.", - "properties": { - "as": { - "const": "reduce", - "default": "reduce", - "title": "As", - "type": "string" + "title": "Custom Llm Provider" }, - "reduce": { + "max_retries": { "anyOf": [ { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" + "type": "integer" }, { "type": "string" + }, + { + "type": "null" } ], - "description": "Function used to combine the results.", - "title": "Reduce" + "default": null, + "title": "Max Retries" } }, - "required": [ - "reduce" - ], - "title": "JoinReduce", + "title": "LitellmParameters", "type": "object" }, - "JoinText": { + "LocalizedExpression_TypeVar_": { "additionalProperties": false, - "description": "Join loop iterations as a string.", "properties": { - "as": { - "const": "text", - "default": "text", - "description": "String concatenation of the result of each iteration.\n ", - "title": "As", - "type": "string" + "pdl__expr": { + "title": "Pdl Expr" }, - "with": { - "default": "", - "description": "String used to concatenate each iteration of the loop.\n ", - "title": "With", - "type": "string" - } - }, - "title": "JoinText", - "type": "object" - }, - "JsonSchemaTypePdlType": { - "additionalProperties": true, - "description": "Json Schema with a type field.", - "properties": { - "type": { + "pdl__result": { "anyOf": [ + {}, { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" + "type": "null" } ], - "title": "Type" + "default": null, + "title": "Pdl Result" + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null } }, "required": [ - "type" + "pdl__expr" ], - "title": "JsonSchemaTypePdlType", + "title": "LocalizedExpression", "type": "object" }, - "LastOfBlock": { + "MapBlock": { "additionalProperties": false, - "description": "Return the value of the last block if the list of blocks.", + "description": "Independent executions of a block.\nRepeat the execution of a block starting from the initial scope\nand `pdl_context`.\n\nFor loop example:\n```PDL\nfor:\n number: [1, 2, 3, 4]\n name: [\"Bob\", \"Carol\", \"David\", \"Ernest\"]\nmap:\n \"${ name }'s number is ${ number }\\n\"\n```\n\nBounded loop:\n```PDL\nindex: i\nmaxIterations: 5\nmap:\n ${ i }\njoin:\n as: array\n```", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -6460,89 +2730,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -6550,256 +2738,66 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": false, @@ -6812,473 +2810,362 @@ "default": "dependent" }, "kind": { - "const": "lastOf", - "default": "lastOf", + "const": "map", + "default": "map", "title": "Kind", "type": "string" }, - "lastOf": { - "description": "Sequence of blocks to execute.", - "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "title": "Lastof", - "type": "array" - } - }, - "required": [ - "lastOf" - ], - "title": "LastOfBlock", - "type": "object" - }, - "LitellmModelBlock": { - "additionalProperties": false, - "description": "Call an LLM through [the LiteLLM API](https://docs.litellm.ai/).\n\nExample:\n```PDL\nmodel: ollama/granite-code:8b\nparameters:\n stop: ['!']\n```", - "properties": { - "description": { + "for": { "anyOf": [ { - "type": "string" + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/LocalizedExpression_TypeVar_" + }, + { + "items": {}, + "type": "array" + }, + { + "type": "string" + } + ] + }, + "type": "object" }, { "type": "null" } ], "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Arrays to iterate over.\n ", + "title": "For" }, - "spec": { - "$ref": "#/$defs/PdlTypeType", + "index": { + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Type specification of the result of the block.\n " + "description": "Name of the variable containing the loop iteration.\n " }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "map": { + "$ref": "#/$defs/BlockType", + "description": "Body of the iterator.\n " + }, + "maxIterations": { + "$ref": "#/$defs/OptionalExpressionInt", + "default": null, + "description": "Maximal number of iterations to perform.\n " + }, + "join": { + "$ref": "#/$defs/JoinType", + "default": { + "as": "text", + "with": "" }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" + "description": "Define how to combine the result of each iteration.\n " }, - "def": { + "pdl__trace": { "anyOf": [ { - "type": "string" + "items": { + "$ref": "#/$defs/BlockType" + }, + "type": "array" }, { "type": "null" } ], "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "title": "Pdl Trace" + } + }, + "required": [ + "map" + ], + "title": "MapBlock", + "type": "object" + }, + "MatchBlock": { + "additionalProperties": false, + "description": "Match control structure.\n\nExample:\n```PDL\ndefs:\n answer:\n read:\n message: \"Enter a number? \"\nmatch: ${ (answer | int) }\nwith:\n- case: 42\n then: You won!\n- case:\n any:\n def: x\n if: ${ x > 42 }\n then: Too high\n- then: Too low", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBlockType", "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Block to execute in case of error.\n " }, "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalInt", "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": false, + "default": false, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "context": { + "$ref": "#/$defs/IndependentEnum", + "default": "dependent" + }, + "kind": { + "const": "match", + "default": "match", + "title": "Kind", + "type": "string" + }, + "match": { "anyOf": [ { - "type": "string" + "$ref": "#/$defs/LocalizedExpression_TypeVar_" }, + {}, { - "type": "null" + "type": "string" } ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Matched expression.\n ", + "title": "Match" }, - "pdl__context": { + "with": { + "description": "List of cases to match.\n ", + "items": { + "$ref": "#/$defs/MatchCase" + }, + "title": "With", + "type": "array" + } + }, + "required": [ + "match", + "with" + ], + "title": "MatchBlock", + "type": "object" + }, + "MatchCase": { + "additionalProperties": false, + "description": "Case of a match.", + "properties": { + "case": { "anyOf": [ { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" + "$ref": "#/$defs/PatternType" }, { "type": "null" } ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "default": null }, - "pdl__id": { + "if": { + "$ref": "#/$defs/OptionalExpressionBool", + "default": null + }, + "then": { + "$ref": "#/$defs/BlockType" + }, + "pdl__case_result": { "anyOf": [ { - "type": "string" + "type": "boolean" }, { "type": "null" } ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "default": null, + "title": "Pdl Case Result" }, - "pdl__result": { + "pdl__if_result": { "anyOf": [ - {}, + { + "type": "boolean" + }, { "type": "null" } ], "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "title": "Pdl If Result" }, - "pdl__location": { + "pdl__matched": { "anyOf": [ { - "$ref": "#/$defs/PdlLocationType" + "type": "boolean" }, { "type": "null" } ], - "default": null + "default": null, + "title": "Pdl Matched" + } + }, + "required": [ + "then" + ], + "title": "MatchCase", + "type": "object" + }, + "MessageBlock": { + "additionalProperties": false, + "description": "Create a message.", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, "pdl__is_leaf": { "const": true, "default": true, @@ -7286,1388 +3173,587 @@ "type": "boolean" }, "kind": { - "const": "model", - "default": "model", + "const": "message", + "default": "message", "title": "Kind", "type": "string" }, - "input": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": "${ pdl_context }", - "description": "Messages to send to the model.\n ", - "title": "Input" - }, - "modelResponse": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Variable where to store the raw response of the model.\n ", - "title": "Modelresponse" - }, - "pdl__usage": { - "anyOf": [ - { - "$ref": "#/$defs/PdlUsage" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Tokens consumed during model call\n " + "content": { + "$ref": "#/$defs/BlockType", + "description": "Content of the message." }, - "pdl__model_input": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "name": { + "$ref": "#/$defs/OptionalExpressionStr", "default": null, - "title": "Pdl Model Input" - }, - "platform": { - "const": "litellm", - "default": "litellm", - "description": "Optional field to ensure that the block is using LiteLLM.\n ", - "title": "Platform", - "type": "string" - }, - "model": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - } - ], - "description": "Name of the model following the LiteLLM convention.\n ", - "title": "Model" + "description": "For example, the name of the tool that was invoked, for which this message is the tool response." }, - "parameters": { - "anyOf": [ - { - "$ref": "#/$defs/LitellmParameters" - }, - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "tool_call_id": { + "$ref": "#/$defs/OptionalExpressionStr", "default": null, - "description": "Parameters to send to the model.\n ", - "title": "Parameters" + "description": "The id of the tool invocation for which this message is the tool response." } }, "required": [ - "model" + "content" ], - "title": "LitellmModelBlock", + "title": "MessageBlock", "type": "object" }, - "LitellmParameters": { - "additionalProperties": true, - "description": "Parameters passed to LiteLLM. More details at [https://docs.litellm.ai/docs/completion/input](https://docs.litellm.ai/docs/completion/input).\n\nNote that not all models and platforms accept all parameters.", + "ModelInput": { + "items": { + "additionalProperties": true, + "type": "object" + }, + "type": "array" + }, + "ObjectBlock": { + "additionalProperties": false, + "description": "Return the object where the value of each field is defined by a block. If the body of the object is an array, the resulting object is the union of the objects computed by each element of the array.", "properties": { - "timeout": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "description": { + "$ref": "#/$defs/OptionalStr", "default": null, - "title": "Timeout" + "description": "Documentation associated to the block.\n " }, - "temperature": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "spec": { + "$ref": "#/$defs/PdlTypeType", "default": null, - "title": "Temperature" + "description": "Type specification of the result of the block.\n " }, - "top_p": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Top P" + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" }, - "n": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "def": { + "$ref": "#/$defs/OptionalStr", "default": null, - "title": "N" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, - "stop": { - "anyOf": [ - { - "type": "string" - }, - { - "items": { - "type": "string" - }, - "type": "array" - }, - { - "type": "null" - } + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], - "default": null, - "title": "Stop" + "description": "Indicate if the block contributes to the result and background context.\n " }, - "max_tokens": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "parser": { + "$ref": "#/$defs/OptionalParserType", "default": null, - "title": "Max Tokens" + "description": "Parser to use to construct a value out of a string result." }, - "presence_penalty": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "fallback": { + "$ref": "#/$defs/OptionalBlockType", "default": null, - "title": "Presence Penalty" + "description": "Block to execute in case of error.\n " }, - "frequency_penalty": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "retry": { + "$ref": "#/$defs/OptionalInt", "default": null, - "title": "Frequency Penalty" + "description": "The maximum number of times to retry when an error occurs within a block.\n " }, - "logit_bias": { - "anyOf": [ - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "title": "Logit Bias" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, - "user": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "role": { + "$ref": "#/$defs/OptionalStr", "default": null, - "title": "User" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, - "response_format": { - "anyOf": [ - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Response Format" + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." }, - "seed": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Seed" + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." }, - "tools": { - "anyOf": [ - { - "items": {}, - "type": "array" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "pdl__result": { + "$ref": "#/$defs/OptionalAny", "default": null, - "title": "Tools" + "description": "Result of the execution of the block." }, - "tool_choice": { - "anyOf": [ - { - "type": "string" - }, - { - "additionalProperties": true, - "type": "object" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Tool Choice" + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null }, - "logprobs": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", "default": null, - "title": "Logprobs" + "description": "Execution timing information." }, - "top_logprobs": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Top Logprobs" + "pdl__is_leaf": { + "const": false, + "default": false, + "title": "Pdl Is Leaf", + "type": "boolean" }, - "parallel_tool_calls": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Parallel Tool Calls" + "context": { + "$ref": "#/$defs/IndependentEnum", + "default": "dependent" }, - "extra_headers": { + "kind": { + "const": "object", + "default": "object", + "title": "Kind", + "type": "string" + }, + "object": { "anyOf": [ { - "additionalProperties": true, + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, "type": "object" }, { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Extra Headers" - }, - "functions": { - "anyOf": [ - { - "items": {}, - "type": "array" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Functions" - }, - "function_call": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Function Call" - }, - "base_url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Base Url" - }, - "api_version": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Api Version" - }, - "api_key": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Api Key" - }, - "model_list": { - "anyOf": [ - { - "items": {}, + "items": { + "$ref": "#/$defs/BlockType" + }, "type": "array" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Model List" - }, - "mock_response": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Mock Response" - }, - "custom_llm_provider": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Custom Llm Provider" - }, - "max_retries": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" } ], - "default": null, - "title": "Max Retries" + "title": "Object" } }, - "title": "LitellmParameters", + "required": [ + "object" + ], + "title": "ObjectBlock", "type": "object" }, - "LocalizedExpression_TypeVar_": { + "ObjectPattern": { "additionalProperties": false, + "description": "Match an object.", "properties": { - "pdl__expr": { - "title": "Pdl Expr" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "def": { + "$ref": "#/$defs/OptionalStr", "default": null + }, + "object": { + "additionalProperties": { + "$ref": "#/$defs/PatternType" + }, + "title": "Object", + "type": "object" } }, "required": [ - "pdl__expr" + "object" ], - "title": "LocalizedExpression", + "title": "ObjectPattern", "type": "object" }, - "MapBlock": { + "ObjectPdlType": { "additionalProperties": false, - "description": "Independent executions of a block.\nRepeat the execution of a block starting from the initial scope\nand `pdl_context`.\n\nFor loop example:\n```PDL\nfor:\n number: [1, 2, 3, 4]\n name: [\"Bob\", \"Carol\", \"David\", \"Ernest\"]\nmap:\n \"${ name }'s number is ${ number }\\n\"\n```\n\nBounded loop:\n```PDL\nindex: i\nmaxIterations: 5\nmap:\n ${ i }\njoin:\n as: array\n```", + "description": "Object type.", "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { + "object": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/PdlTypeType" }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", + "title": "Object", "type": "object" + } + }, + "required": [ + "object" + ], + "title": "ObjectPdlType", + "type": "object" + }, + "OptionalAny": { + "anyOf": [ + {}, + { + "type": "null" + } + ] + }, + "OptionalBlockType": { + "anyOf": [ + { + "$ref": "#/$defs/BlockType" }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + { + "type": "null" + } + ] + }, + "OptionalBoolOrStr": { + "anyOf": [ + { + "type": "boolean" }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" - }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + { + "type": "string" }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + { + "type": "null" + } + ] + }, + "OptionalExpressionBool": { + "anyOf": [ + { + "$ref": "#/$defs/ExpressionBool" }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + { + "type": "null" + } + ] + }, + "OptionalExpressionInt": { + "anyOf": [ + { + "$ref": "#/$defs/ExpressionInt" }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + { + "type": "null" + } + ] + }, + "OptionalExpressionStr": { + "anyOf": [ + { + "$ref": "#/$defs/ExpressionStr" }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + { + "type": "null" + } + ] + }, + "OptionalInt": { + "anyOf": [ + { + "type": "integer" }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + { + "type": "null" + } + ] + }, + "OptionalModelInput": { + "anyOf": [ + { + "$ref": "#/$defs/ModelInput" }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + { + "type": "null" + } + ] + }, + "OptionalParserType": { + "anyOf": [ + { + "$ref": "#/$defs/ParserType" }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + { + "type": "null" + } + ] + }, + "OptionalPdlLocationType": { + "anyOf": [ + { + "$ref": "#/$defs/PdlLocationType" }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null + { + "type": "null" + } + ] + }, + "OptionalPdlTiming": { + "anyOf": [ + { + "$ref": "#/$defs/PdlTiming" }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + { + "type": "null" + } + ] + }, + "OptionalPdlType": { + "additionalProperties": false, + "description": "Optional type.", + "properties": { + "optional": { + "$ref": "#/$defs/PdlTypeType" + } + }, + "required": [ + "optional" + ], + "title": "OptionalPdlType", + "type": "object" + }, + "OptionalPdlUsage": { + "anyOf": [ + { + "$ref": "#/$defs/PdlUsage" }, - "pdl__is_leaf": { - "const": false, - "default": false, - "title": "Pdl Is Leaf", - "type": "boolean" + { + "type": "null" + } + ] + }, + "OptionalStr": { + "anyOf": [ + { + "type": "string" }, - "context": { - "$ref": "#/$defs/IndependentEnum", - "default": "dependent" - }, - "kind": { - "const": "map", - "default": "map", - "title": "Kind", - "type": "string" - }, - "for": { - "anyOf": [ - { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "items": {}, - "type": "array" - }, - { - "type": "string" - } - ] - }, - "type": "object" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Arrays to iterate over.\n ", - "title": "For" - }, - "index": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable containing the loop iteration.\n ", - "title": "Index" - }, - "map": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Body of the iterator.\n ", - "title": "Map" - }, - "maxIterations": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Maximal number of iterations to perform.\n ", - "title": "Maxiterations" + { + "type": "null" + } + ] + }, + "OrPattern": { + "additionalProperties": false, + "description": "Match any of the patterns.", + "properties": { + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null }, - "join": { - "anyOf": [ - { - "$ref": "#/$defs/JoinText" - }, - { - "$ref": "#/$defs/JoinArray" - }, - { - "$ref": "#/$defs/JoinObject" - }, - { - "$ref": "#/$defs/JoinLastOf" - }, - { - "$ref": "#/$defs/JoinReduce" - } - ], - "default": { - "as": "text", - "with": "" + "anyOf": { + "items": { + "$ref": "#/$defs/PatternType" }, - "description": "Define how to combine the result of each iteration.\n ", - "title": "Join" - }, - "pdl__trace": { - "anyOf": [ - { - "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Trace" + "title": "Anyof", + "type": "array" } }, "required": [ - "map" + "anyOf" ], - "title": "MapBlock", + "title": "OrPattern", "type": "object" }, - "MatchBlock": { - "additionalProperties": false, - "description": "Match control structure.\n\nExample:\n```PDL\ndefs:\n answer:\n read:\n message: \"Enter a number? \"\nmatch: ${ (answer | int) }\nwith:\n- case: 42\n then: You won!\n- case:\n any:\n def: x\n if: ${ x > 42 }\n then: Too high\n- then: Too low", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "ParserType": { + "anyOf": [ + { + "enum": [ + "json", + "jsonl", + "yaml" ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "type": "string" }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " + { + "$ref": "#/$defs/PdlParser" + }, + { + "$ref": "#/$defs/RegexParser" + } + ] + }, + "PatternType": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "integer" + }, + { + "type": "number" + }, + { + "type": "string" + }, + { + "$ref": "#/$defs/OrPattern" + }, + { + "$ref": "#/$defs/ArrayPattern" + }, + { + "$ref": "#/$defs/ObjectPattern" + }, + { + "$ref": "#/$defs/AnyPattern" + }, + { + "type": "null" + } + ] + }, + "PdlBlock": { + "$ref": "#/$defs/BlockType", + "title": "PdlBlock" + }, + "PdlLocationType": { + "additionalProperties": false, + "description": "Internal data structure to keep track of the source location information.", + "properties": { + "path": { + "items": { + "type": "string" + }, + "title": "Path", + "type": "array" + }, + "file": { + "title": "File", + "type": "string" + }, + "table": { + "additionalProperties": { + "type": "integer" + }, + "title": "Table", + "type": "object" + } + }, + "required": [ + "path", + "file", + "table" + ], + "title": "PdlLocationType", + "type": "object" + }, + "PdlParser": { + "additionalProperties": false, + "description": "Use a PDL program as a parser specification (experimental).", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null + }, + "pdl": { + "$ref": "#/$defs/BlockType" + } + }, + "required": [ + "pdl" + ], + "title": "PdlParser", + "type": "object" + }, + "PdlTiming": { + "additionalProperties": false, + "description": "Internal data structure to record timing information in the trace.", + "properties": { + "start_nanos": { + "$ref": "#/$defs/OptionalInt", + "default": 0 + }, + "end_nanos": { + "$ref": "#/$defs/OptionalInt", + "default": 0 + }, + "first_use_nanos": { + "$ref": "#/$defs/OptionalInt", + "default": 0 + }, + "timezone": { + "$ref": "#/$defs/OptionalStr", + "default": "" + } + }, + "title": "PdlTiming", + "type": "object" + }, + "PdlTypeType": { + "anyOf": [ + { + "enum": [ + "null", + "boolean", + "string", + "number", + "integer", + "array", + "object", + "bool", + "str", + "float", + "int", + "list", + "obj" + ], + "type": "string" + }, + { + "$ref": "#/$defs/EnumPdlType" + }, + { + "items": { + "$ref": "#/$defs/PdlTypeType" + }, + "type": "array" + }, + { + "$ref": "#/$defs/OptionalPdlType" + }, + { + "$ref": "#/$defs/JsonSchemaTypePdlType" + }, + { + "$ref": "#/$defs/ObjectPdlType" + }, + { + "additionalProperties": { + "$ref": "#/$defs/PdlTypeType" + }, + "type": "object" + }, + { + "type": "null" + } + ] + }, + "PdlUsage": { + "description": "Internal data structure to record token consumption usage information.", + "properties": { + "completion_tokens": { + "$ref": "#/$defs/OptionalInt", + "default": 0 + }, + "prompt_tokens": { + "$ref": "#/$defs/OptionalInt", + "default": 0 + } + }, + "title": "PdlUsage", + "type": "object" + }, + "Program": { + "$ref": "#/$defs/BlockType", + "description": "Prompt Declaration Language program (PDL)", + "title": "Program" + }, + "ReadBlock": { + "additionalProperties": false, + "description": "Read from a file or standard input.\n\nExample. Read from the standard input with a prompt starting with `> `.\n```PDL\nread:\nmessage: \"> \"\n```\n\nExample. Read the file `./data.yaml` in the same directory of the PDL file containing the block and parse it into YAML.\n```PDL\nread: ./data.yaml\nparser: yaml\n```", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -8675,3324 +3761,144 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" - }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" - }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" - }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" - }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" - }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__is_leaf": { - "const": false, - "default": false, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "context": { - "$ref": "#/$defs/IndependentEnum", - "default": "dependent" - }, - "kind": { - "const": "match", - "default": "match", - "title": "Kind", - "type": "string" - }, - "match": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - {}, - { - "type": "string" - } - ], - "description": "Matched expression.\n ", - "title": "Match" - }, - "with": { - "description": "List of cases to match.\n ", - "items": { - "$ref": "#/$defs/MatchCase" - }, - "title": "With", - "type": "array" - } - }, - "required": [ - "match", - "with" - ], - "title": "MatchBlock", - "type": "object" - }, - "MatchCase": { - "additionalProperties": false, - "description": "Case of a match.", - "properties": { - "case": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/OrPattern" - }, - { - "$ref": "#/$defs/ArrayPattern" - }, - { - "$ref": "#/$defs/ObjectPattern" - }, - { - "$ref": "#/$defs/AnyPattern" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Case" - }, - "if": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "If" - }, - "then": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "title": "Then" - }, - "pdl__case_result": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Case Result" - }, - "pdl__if_result": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl If Result" - }, - "pdl__matched": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Pdl Matched" - } - }, - "required": [ - "then" - ], - "title": "MatchCase", - "type": "object" - }, - "MessageBlock": { - "additionalProperties": false, - "description": "Create a message.", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" - }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" - }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" - }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" - }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" - }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" - }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" - }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" - }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__is_leaf": { - "const": true, - "default": true, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "kind": { - "const": "message", - "default": "message", - "title": "Kind", - "type": "string" - }, - "content": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Content of the message.", - "title": "Content" - }, - "name": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "For example, the name of the tool that was invoked, for which this message is the tool response.", - "title": "Name" - }, - "tool_call_id": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The id of the tool invocation for which this message is the tool response.", - "title": "Tool Call Id" - } - }, - "required": [ - "content" - ], - "title": "MessageBlock", - "type": "object" - }, - "ObjectBlock": { - "additionalProperties": false, - "description": "Return the object where the value of each field is defined by a block. If the body of the object is an array, the resulting object is the union of the objects computed by each element of the array.", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" - }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" - }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" - }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" - }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" - }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" - }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" - }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" - }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__is_leaf": { - "const": false, - "default": false, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "context": { - "$ref": "#/$defs/IndependentEnum", - "default": "dependent" - }, - "kind": { - "const": "object", - "default": "object", - "title": "Kind", - "type": "string" - }, - "object": { - "anyOf": [ - { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "type": "object" - }, - { - "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "type": "array" - } - ], - "title": "Object" - } - }, - "required": [ - "object" - ], - "title": "ObjectBlock", - "type": "object" - }, - "ObjectPattern": { - "additionalProperties": false, - "description": "Match an object.", - "properties": { - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Def" - }, - "object": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/OrPattern" - }, - { - "$ref": "#/$defs/ArrayPattern" - }, - { - "$ref": "#/$defs/ObjectPattern" - }, - { - "$ref": "#/$defs/AnyPattern" - }, - { - "type": "null" - } - ] - }, - "title": "Object", - "type": "object" - } - }, - "required": [ - "object" - ], - "title": "ObjectPattern", - "type": "object" - }, - "ObjectPdlType": { - "additionalProperties": false, - "description": "Object type.", - "properties": { - "object": { - "additionalProperties": { - "$ref": "#/$defs/PdlTypeType" - }, - "title": "Object", - "type": "object" - } - }, - "required": [ - "object" - ], - "title": "ObjectPdlType", - "type": "object" - }, - "OptionalPdlType": { - "additionalProperties": false, - "description": "Optional type.", - "properties": { - "optional": { - "$ref": "#/$defs/PdlTypeType" - } - }, - "required": [ - "optional" - ], - "title": "OptionalPdlType", - "type": "object" - }, - "OrPattern": { - "additionalProperties": false, - "description": "Match any of the patterns.", - "properties": { - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Def" - }, - "anyOf": { - "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/OrPattern" - }, - { - "$ref": "#/$defs/ArrayPattern" - }, - { - "$ref": "#/$defs/ObjectPattern" - }, - { - "$ref": "#/$defs/AnyPattern" - }, - { - "type": "null" - } - ] - }, - "title": "Anyof", - "type": "array" - } - }, - "required": [ - "anyOf" - ], - "title": "OrPattern", - "type": "object" - }, - "PdlBlock": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "title": "PdlBlock" - }, - "PdlLocationType": { - "additionalProperties": false, - "description": "Internal data structure to keep track of the source location information.", - "properties": { - "path": { - "items": { - "type": "string" - }, - "title": "Path", - "type": "array" - }, - "file": { - "title": "File", - "type": "string" - }, - "table": { - "additionalProperties": { - "type": "integer" - }, - "title": "Table", - "type": "object" - } - }, - "required": [ - "path", - "file", - "table" - ], - "title": "PdlLocationType", - "type": "object" - }, - "PdlParser": { - "additionalProperties": false, - "description": "Use a PDL program as a parser specification (experimental).", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null - }, - "pdl": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "title": "Pdl" - } - }, - "required": [ - "pdl" - ], - "title": "PdlParser", - "type": "object" - }, - "PdlTiming": { - "additionalProperties": false, - "description": "Internal data structure to record timing information in the trace.", - "properties": { - "start_nanos": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 0, - "title": "Start Nanos" - }, - "end_nanos": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 0, - "title": "End Nanos" - }, - "first_use_nanos": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 0, - "title": "First Use Nanos" - }, - "timezone": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "title": "Timezone" - } - }, - "title": "PdlTiming", - "type": "object" - }, - "PdlTypeType": { - "anyOf": [ - { - "enum": [ - "null", - "boolean", - "string", - "number", - "integer", - "array", - "object", - "bool", - "str", - "float", - "int", - "list", - "obj" - ], - "type": "string" - }, - { - "$ref": "#/$defs/EnumPdlType" - }, - { - "items": { - "$ref": "#/$defs/PdlTypeType" - }, - "type": "array" - }, - { - "$ref": "#/$defs/OptionalPdlType" - }, - { - "$ref": "#/$defs/JsonSchemaTypePdlType" - }, - { - "$ref": "#/$defs/ObjectPdlType" - }, - { - "additionalProperties": { - "$ref": "#/$defs/PdlTypeType" - }, - "type": "object" - }, - { - "type": "null" - } - ] - }, - "PdlUsage": { - "description": "Internal data structure to record token consumption usage information.", - "properties": { - "completion_tokens": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 0, - "title": "Completion Tokens" - }, - "prompt_tokens": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": 0, - "title": "Prompt Tokens" - } - }, - "title": "PdlUsage", - "type": "object" - }, - "Program": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Prompt Declaration Language program (PDL)", - "title": "Program" - }, - "ReadBlock": { - "additionalProperties": false, - "description": "Read from a file or standard input.\n\nExample. Read from the standard input with a prompt starting with `> `.\n```PDL\nread:\nmessage: \"> \"\n```\n\nExample. Read the file `./data.yaml` in the same directory of the PDL file containing the block and parse it into YAML.\n```PDL\nread: ./data.yaml\nparser: yaml\n```", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" - }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" - }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" - }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" - }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" - }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" - }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" - }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" - }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__is_leaf": { - "const": true, - "default": true, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "kind": { - "const": "read", - "default": "read", - "title": "Kind", - "type": "string" - }, - "read": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Name of the file to read. If `None`, read the standard input.\n ", - "title": "Read" - }, - "message": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Message to prompt the user to enter a value.\n ", - "title": "Message" - }, - "multiline": { - "default": false, - "description": "Indicate if one or multiple lines should be read.\n ", - "title": "Multiline", - "type": "boolean" - } - }, - "required": [ - "read" - ], - "title": "ReadBlock", - "type": "object" - }, - "RegexParser": { - "additionalProperties": false, - "description": "A regular expression parser.", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null - }, - "regex": { - "title": "Regex", - "type": "string" - }, - "mode": { - "default": "fullmatch", - "enum": [ - "search", - "match", - "fullmatch", - "split", - "findall" - ], - "title": "Mode", - "type": "string" - } - }, - "required": [ - "regex" - ], - "title": "RegexParser", - "type": "object" - }, - "RepeatBlock": { - "additionalProperties": false, - "description": "Repeat the execution of a block sequentially.\nThe scope and `pdl_context` are accumulated in between iterations.\n\nFor loop example:\n```PDL\nfor:\n number: [1, 2, 3, 4]\n name: [\"Bob\", \"Carol\", \"David\", \"Ernest\"]\nrepeat:\n \"${ name }'s number is ${ number }\\n\"\n```\n\nWhile loop:\n```PDL\ndefs:\n i: 0\nwhile: ${i < 5}\nrepeat:\n defs:\n i: ${ i + 1}\n data: ${ i }\njoin:\n as: array\n```", - "properties": { - "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" - }, - "spec": { - "$ref": "#/$defs/PdlTypeType", - "default": null, - "description": "Type specification of the result of the block.\n " - }, - "defs": { - "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "default": {}, - "description": "Set of definitions executed before the execution of the block.\n ", - "title": "Defs", - "type": "object" - }, - "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" - }, - "contribute": { - "default": [ - "result", - "context" - ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" - }, - "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" - }, - "fallback": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" - }, - "retry": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" - }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" - }, - "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" - }, - "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], - "default": [], - "description": "Current context\n ", - "title": "Pdl Context" - }, - "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" - }, - "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], - "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" - }, - "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null - }, - "pdl__is_leaf": { - "const": false, - "default": false, - "title": "Pdl Is Leaf", - "type": "boolean" - }, - "context": { - "$ref": "#/$defs/IndependentEnum", - "default": "dependent" - }, - "kind": { - "const": "repeat", - "default": "repeat", - "title": "Kind", - "type": "string" - }, - "for": { - "anyOf": [ - { - "additionalProperties": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "items": {}, - "type": "array" - }, - { - "type": "string" - } - ] - }, - "type": "object" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Arrays to iterate over.\n ", - "title": "For" - }, - "index": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Name of the variable containing the loop iteration.\n ", - "title": "Index" - }, - "while": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "boolean" - }, - { - "type": "string" - } - ], - "default": true, - "description": "Condition to stay at the beginning of the loop.\n ", - "title": "While" - }, - "repeat": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ], - "description": "Body of the loop.\n ", - "title": "Repeat" - }, - "until": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "boolean" - }, - { - "type": "string" - } - ], - "default": false, - "description": "Condition to exit at the end of the loop.\n ", - "title": "Until" - }, - "maxIterations": { - "anyOf": [ - { - "$ref": "#/$defs/LocalizedExpression_TypeVar_" - }, - { - "type": "integer" - }, - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Maximal number of iterations to perform.\n ", - "title": "Maxiterations" - }, - "join": { - "anyOf": [ - { - "$ref": "#/$defs/JoinText" - }, - { - "$ref": "#/$defs/JoinArray" - }, - { - "$ref": "#/$defs/JoinObject" - }, - { - "$ref": "#/$defs/JoinLastOf" - }, - { - "$ref": "#/$defs/JoinReduce" - } - ], - "default": { - "as": "text", - "with": "" - }, - "description": "Define how to combine the result of each iteration.\n ", - "title": "Join" - }, - "pdl__trace": { - "anyOf": [ - { - "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "title": "Pdl Trace" + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": true, + "default": true, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "kind": { + "const": "read", + "default": "read", + "title": "Kind", + "type": "string" + }, + "read": { + "$ref": "#/$defs/OptionalExpressionStr", + "description": "Name of the file to read. If `None`, read the standard input.\n " + }, + "message": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Message to prompt the user to enter a value.\n " + }, + "multiline": { + "default": false, + "description": "Indicate if one or multiple lines should be read.\n ", + "title": "Multiline", + "type": "boolean" } }, "required": [ - "repeat" + "read" ], - "title": "RepeatBlock", + "title": "ReadBlock", "type": "object" }, - "TextBlock": { + "RegexParser": { "additionalProperties": false, - "description": "Create the concatenation of the stringify version of the result of each block of the list of blocks.", + "description": "A regular expression parser.", "properties": { "description": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "$ref": "#/$defs/OptionalStr", + "default": null + }, + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null + }, + "regex": { + "title": "Regex", + "type": "string" + }, + "mode": { + "default": "fullmatch", + "enum": [ + "search", + "match", + "fullmatch", + "split", + "findall" ], + "title": "Mode", + "type": "string" + } + }, + "required": [ + "regex" + ], + "title": "RegexParser", + "type": "object" + }, + "RepeatBlock": { + "additionalProperties": false, + "description": "Repeat the execution of a block sequentially.\nThe scope and `pdl_context` are accumulated in between iterations.\n\nFor loop example:\n```PDL\nfor:\n number: [1, 2, 3, 4]\n name: [\"Bob\", \"Carol\", \"David\", \"Ernest\"]\nrepeat:\n \"${ name }'s number is ${ number }\\n\"\n```\n\nWhile loop:\n```PDL\ndefs:\n i: 0\nwhile: ${i < 5}\nrepeat:\n defs:\n i: ${ i + 1}\n data: ${ i }\njoin:\n as: array\n```", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Documentation associated to the block.\n ", - "title": "Description" + "description": "Documentation associated to the block.\n " }, "spec": { "$ref": "#/$defs/PdlTypeType", @@ -12001,89 +3907,7 @@ }, "defs": { "additionalProperties": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "default": {}, "description": "Set of definitions executed before the execution of the block.\n ", @@ -12091,256 +3915,248 @@ "type": "object" }, "def": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Name of the variable used to store the result of the execution of the block.\n ", - "title": "Def" + "description": "Name of the variable used to store the result of the execution of the block.\n " }, "contribute": { + "$ref": "#/$defs/ContributeType", "default": [ "result", "context" ], - "description": "Indicate if the block contributes to the result and background context.\n ", - "items": { - "anyOf": [ - { - "$ref": "#/$defs/ContributeTarget" - }, - { - "additionalProperties": { - "$ref": "#/$defs/ContributeValue" - }, - "type": "object" - } - ] - }, - "title": "Contribute", - "type": "array" + "description": "Indicate if the block contributes to the result and background context.\n " }, "parser": { - "anyOf": [ - { - "enum": [ - "json", - "jsonl", - "yaml" - ], - "type": "string" - }, - { - "$ref": "#/$defs/PdlParser" - }, - { - "$ref": "#/$defs/RegexParser" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalParserType", "default": null, - "description": "Parser to use to construct a value out of a string result.", - "title": "Parser" + "description": "Parser to use to construct a value out of a string result." }, "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", + "default": null, + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " + }, + "role": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." + }, + "pdl__context": { + "$ref": "#/$defs/OptionalModelInput", + "default": [], + "description": "Current context." + }, + "pdl__id": { + "$ref": "#/$defs/OptionalStr", + "default": "", + "description": "Unique identifier for this block." + }, + "pdl__result": { + "$ref": "#/$defs/OptionalAny", + "default": null, + "description": "Result of the execution of the block." + }, + "pdl__location": { + "$ref": "#/$defs/OptionalPdlLocationType", + "default": null + }, + "pdl__timing": { + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." + }, + "pdl__is_leaf": { + "const": false, + "default": false, + "title": "Pdl Is Leaf", + "type": "boolean" + }, + "context": { + "$ref": "#/$defs/IndependentEnum", + "default": "dependent" + }, + "kind": { + "const": "repeat", + "default": "repeat", + "title": "Kind", + "type": "string" + }, + "for": { "anyOf": [ { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/LocalizedExpression_TypeVar_" + }, + { + "items": {}, + "type": "array" + }, + { + "type": "string" + } + ] + }, + "type": "object" }, { "type": "null" } ], "default": null, - "description": "Block to execute in case of error.\n ", - "title": "Fallback" + "description": "Arrays to iterate over.\n ", + "title": "For" + }, + "index": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable containing the loop iteration.\n " }, - "retry": { + "while": { + "$ref": "#/$defs/ExpressionBool", + "default": true, + "description": "Condition to stay at the beginning of the loop.\n " + }, + "repeat": { + "$ref": "#/$defs/BlockType", + "description": "Body of the loop.\n " + }, + "until": { + "$ref": "#/$defs/ExpressionBool", + "default": false, + "description": "Condition to exit at the end of the loop.\n " + }, + "maxIterations": { + "$ref": "#/$defs/OptionalExpressionInt", + "default": null, + "description": "Maximal number of iterations to perform.\n " + }, + "join": { + "$ref": "#/$defs/JoinType", + "default": { + "as": "text", + "with": "" + }, + "description": "Define how to combine the result of each iteration.\n " + }, + "pdl__trace": { "anyOf": [ { - "type": "integer" + "items": { + "$ref": "#/$defs/BlockType" + }, + "type": "array" }, { "type": "null" } ], "default": null, - "description": "The maximum number of times to retry when an error occurs within a block.\n ", - "title": "Retry" + "title": "Pdl Trace" + } + }, + "required": [ + "repeat" + ], + "title": "RepeatBlock", + "type": "object" + }, + "TextBlock": { + "additionalProperties": false, + "description": "Create the concatenation of the stringify version of the result of each block of the list of blocks.", + "properties": { + "description": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Documentation associated to the block.\n " }, - "trace_error_on_retry": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "string" - }, - { - "type": "null" - } + "spec": { + "$ref": "#/$defs/PdlTypeType", + "default": null, + "description": "Type specification of the result of the block.\n " + }, + "defs": { + "additionalProperties": { + "$ref": "#/$defs/BlockType" + }, + "default": {}, + "description": "Set of definitions executed before the execution of the block.\n ", + "title": "Defs", + "type": "object" + }, + "def": { + "$ref": "#/$defs/OptionalStr", + "default": null, + "description": "Name of the variable used to store the result of the execution of the block.\n " + }, + "contribute": { + "$ref": "#/$defs/ContributeType", + "default": [ + "result", + "context" ], + "description": "Indicate if the block contributes to the result and background context.\n " + }, + "parser": { + "$ref": "#/$defs/OptionalParserType", + "default": null, + "description": "Parser to use to construct a value out of a string result." + }, + "fallback": { + "$ref": "#/$defs/OptionalBlockType", + "default": null, + "description": "Block to execute in case of error.\n " + }, + "retry": { + "$ref": "#/$defs/OptionalInt", + "default": null, + "description": "The maximum number of times to retry when an error occurs within a block.\n " + }, + "trace_error_on_retry": { + "$ref": "#/$defs/OptionalBoolOrStr", "default": null, - "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n ", - "title": "Trace Error On Retry" + "description": "Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials.\n " }, "role": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": null, - "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`.", - "title": "Role" + "description": "Role associated to the block and sub-blocks.\nTypical roles are `system`, `user`, and `assistant`,\nbut there may be other roles such as `available_tools`." }, "pdl__context": { - "anyOf": [ - { - "items": { - "additionalProperties": true, - "type": "object" - }, - "type": "array" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalModelInput", "default": [], - "description": "Current context\n ", - "title": "Pdl Context" + "description": "Current context." }, "pdl__id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalStr", "default": "", - "description": "Unique identifier for this block\n ", - "title": "Pdl Id" + "description": "Unique identifier for this block." }, "pdl__result": { - "anyOf": [ - {}, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalAny", "default": null, - "description": "Result of the execution of the block", - "title": "Pdl Result" + "description": "Result of the execution of the block." }, "pdl__location": { - "anyOf": [ - { - "$ref": "#/$defs/PdlLocationType" - }, - { - "type": "null" - } - ], + "$ref": "#/$defs/OptionalPdlLocationType", "default": null }, "pdl__timing": { - "anyOf": [ - { - "$ref": "#/$defs/PdlTiming" - }, - { - "type": "null" - } - ], - "default": null + "$ref": "#/$defs/OptionalPdlTiming", + "default": null, + "description": "Execution timing information." }, "pdl__is_leaf": { "const": false, @@ -12361,173 +4177,13 @@ "text": { "anyOf": [ { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" + "$ref": "#/$defs/BlockType" }, { "items": { - "anyOf": [ - { - "type": "boolean" - }, - { - "type": "integer" - }, - { - "type": "number" - }, - { - "type": "string" - }, - { - "$ref": "#/$defs/FunctionBlock" - }, - { - "$ref": "#/$defs/CallBlock" - }, - { - "$ref": "#/$defs/LitellmModelBlock" - }, - { - "$ref": "#/$defs/GraniteioModelBlock" - }, - { - "$ref": "#/$defs/CodeBlock" - }, - { - "$ref": "#/$defs/ArgsBlock" - }, - { - "$ref": "#/$defs/GetBlock" - }, - { - "$ref": "#/$defs/DataBlock" - }, - { - "$ref": "#/$defs/IfBlock" - }, - { - "$ref": "#/$defs/MatchBlock" - }, - { - "$ref": "#/$defs/RepeatBlock" - }, - { - "$ref": "#/$defs/MapBlock" - }, - { - "$ref": "#/$defs/TextBlock" - }, - { - "$ref": "#/$defs/LastOfBlock" - }, - { - "$ref": "#/$defs/ArrayBlock" - }, - { - "$ref": "#/$defs/ObjectBlock" - }, - { - "$ref": "#/$defs/MessageBlock" - }, - { - "$ref": "#/$defs/ReadBlock" - }, - { - "$ref": "#/$defs/IncludeBlock" - }, - { - "$ref": "#/$defs/ImportBlock" - }, - { - "$ref": "#/$defs/ErrorBlock" - }, - { - "$ref": "#/$defs/EmptyBlock" - }, - { - "type": "null" - } - ] + "$ref": "#/$defs/BlockType" }, "type": "array" - }, - { - "type": "null" } ], "description": "Body of the text.\n ", diff --git a/src/pdl/pdl_ast.py b/src/pdl/pdl_ast.py index 6f0224ca6..65e066784 100644 --- a/src/pdl/pdl_ast.py +++ b/src/pdl/pdl_ast.py @@ -37,13 +37,28 @@ def _ensure_lower(value): return value -ScopeType: TypeAlias = PdlDict[str, Any] +OptionalStr = TypeAliasType("OptionalStr", Optional[str]) +"""Optional string.""" +OptionalInt = TypeAliasType("OptionalInt", Optional[int]) +"""Optional integer.""" +OptionalBoolOrStr = TypeAliasType("OptionalBoolOrStr", Optional[Union[bool, str]]) +"""Optional boolean or string.""" +OptionalAny = TypeAliasType("OptionalAny", Optional[Any]) +"""Optional value of any type.""" +OptionalBlockType = TypeAliasType("OptionalBlockType", Optional["BlockType"]) +"""Optional block.""" -ModelInput: TypeAlias = Sequence[Mapping[str, Any]] +ScopeType = TypeAliasType("ScopeType", PdlDict[str, Any]) +"""Type of the execution environment.""" -LazyMessage: TypeAlias = PdlLazy[dict[str, Any]] +ModelInput = TypeAliasType("ModelInput", Sequence[Mapping[str, Any]]) +"""Type of the input of an LLM call.""" +OptionalModelInput = TypeAliasType("OptionalModelInput", Optional[ModelInput]) +"""Optional value of type ModelInput.""" + +LazyMessage = TypeAliasType("LazyMessage", PdlLazy[dict[str, Any]]) LazyMessages: TypeAlias = PDLContext @@ -79,6 +94,12 @@ class PdlLocationType(BaseModel): table: dict[str, int] +OptionalPdlLocationType = TypeAliasType( + "OptionalPdlLocationType", Optional[PdlLocationType] +) +"""Optional location type.""" + + empty_block_location = PdlLocationType(file="", path=[], table={}) @@ -96,19 +117,39 @@ class LocalizedExpression(BaseModel, Generic[LocalizedExpressionT]): ) pdl__expr: Any pdl__result: Optional[LocalizedExpressionT] = None - pdl__location: Optional[PdlLocationType] = None + pdl__location: OptionalPdlLocationType = None ExpressionTypeT = TypeVar("ExpressionTypeT") ExpressionType: TypeAlias = LocalizedExpression[ExpressionTypeT] | ExpressionTypeT | str """Expressions are represented Jinja as strings in between `${` and `}`.""" +ExpressionStr = TypeAliasType("ExpressionStr", ExpressionType[str]) +"""Expression evaluating into a string.""" + +OptionalExpressionStr = TypeAliasType("OptionalExpressionStr", Optional[ExpressionStr]) +"""Optional expression evaluating into a string.""" + +ExpressionInt = TypeAliasType("ExpressionInt", ExpressionType[int]) +"""Expression evaluating into an int.""" + +OptionalExpressionInt = TypeAliasType("OptionalExpressionInt", Optional[ExpressionInt]) +"""Optional expression evaluating into an int.""" + +ExpressionBool = TypeAliasType("ExpressionBool", ExpressionType[bool]) +"""Expression evaluating into a bool.""" + +OptionalExpressionBool = TypeAliasType( + "OptionalExpressionBool", Optional[ExpressionBool] +) +"""Optional expression evaluating into a bool.""" + class Pattern(BaseModel): """Common fields for structured patterns.""" model_config = ConfigDict(extra="forbid") - def_: Optional[str] = Field(default=None, alias="def") + def_: OptionalStr = Field(default=None, alias="def") """Name of the variable used to store the value matched by the pattern. """ @@ -140,16 +181,11 @@ class AnyPattern(Pattern): any: Literal[None] -PatternType: TypeAlias = ( - None - | bool - | int - | float - | str - | OrPattern - | ArrayPattern - | ObjectPattern - | AnyPattern +PatternType = TypeAliasType( + "PatternType", + Union[ + None, bool, int, float, str, OrPattern, ArrayPattern, ObjectPattern, AnyPattern + ], ) """Patterns allowed to match values in a `case` clause.""" @@ -234,7 +270,7 @@ class Parser(BaseModel): """Common fields for all parsers (`parser` field).""" model_config = ConfigDict(extra="forbid") - description: Optional[str] = None + description: OptionalStr = None """Documentation associated to the parser. """ spec: PdlTypeType = None @@ -261,10 +297,14 @@ class RegexParser(Parser): """Function used to parse to value (https://docs.python.org/3/library/re.html).""" -ParserType: TypeAlias = Literal["json", "jsonl", "yaml"] | PdlParser | RegexParser - +ParserType = TypeAliasType( + "ParserType", Union[Literal["json", "jsonl", "yaml"], PdlParser, RegexParser] +) +"""Different parsers.""" +OptionalParserType = TypeAliasType("OptionalParserType", Optional[ParserType]) +"""Optional parser.""" -RoleType: TypeAlias = Optional[str] +RoleType: TypeAlias = OptionalStr """Role name.""" @@ -284,35 +324,49 @@ class ContributeValue(BaseModel): """Value to contribute.""" +ContributeType = TypeAliasType( + "ContributeType", Sequence[Union[ContributeTarget, dict[str, ContributeValue]]] +) +"""Type of the contribute field.""" + + class PdlTiming(BaseModel): """Internal data structure to record timing information in the trace.""" model_config = ConfigDict(extra="forbid") - start_nanos: Optional[int] = 0 + start_nanos: OptionalInt = 0 """Time at which block execution began. """ - end_nanos: Optional[int] = 0 + end_nanos: OptionalInt = 0 """Time at which block execution ended. """ - first_use_nanos: Optional[int] = 0 + first_use_nanos: OptionalInt = 0 """Time at which the value of the block was needed for the first time. """ - timezone: Optional[str] = "" + timezone: OptionalStr = "" """Timezone of start_nanos and end_nanos. """ +OptionalPdlTiming = TypeAliasType("OptionalPdlTiming", Optional[PdlTiming]) +"""Optional execution time information.""" + + class PdlUsage(BaseModel): """Internal data structure to record token consumption usage information.""" - completion_tokens: Optional[int] = 0 + completion_tokens: OptionalInt = 0 """Completion tokens consumed """ - prompt_tokens: Optional[int] = 0 + prompt_tokens: OptionalInt = 0 """Prompt tokens consumed """ +OptionalPdlUsage = TypeAliasType("OptionalPdlUsage", Optional[PdlUsage]) +"""Optional usage of statistics of an LLM call.""" + + class Block(BaseModel): """Common fields for all PDL blocks.""" @@ -323,7 +377,7 @@ class Block(BaseModel): validate_by_name=True, ) - description: Optional[str] = None + description: OptionalStr = None """Documentation associated to the block. """ spec: PdlTypeType = None @@ -332,24 +386,24 @@ class Block(BaseModel): defs: dict[str, "BlockType"] = {} """Set of definitions executed before the execution of the block. """ - def_: Optional[str] = Field(default=None, alias="def") + def_: OptionalStr = Field(default=None, alias="def") """Name of the variable used to store the result of the execution of the block. """ - contribute: Sequence[ContributeTarget | dict[str, ContributeValue]] = [ + contribute: ContributeType = [ ContributeTarget.RESULT, ContributeTarget.CONTEXT, ] """Indicate if the block contributes to the result and background context. """ - parser: Annotated[Optional[ParserType], BeforeValidator(_ensure_lower)] = None + parser: Annotated[OptionalParserType, BeforeValidator(_ensure_lower)] = None """Parser to use to construct a value out of a string result.""" - fallback: Optional["BlockType"] = None + fallback: OptionalBlockType = None """Block to execute in case of error. """ - retry: Optional[int] = None + retry: OptionalInt = None """The maximum number of times to retry when an error occurs within a block. """ - trace_error_on_retry: Optional[bool] | str = None + trace_error_on_retry: OptionalBoolOrStr = None """Whether to add the errors while retrying to the trace. Set this to true to use retry feature for multiple LLM trials. """ role: RoleType = None @@ -358,16 +412,15 @@ class Block(BaseModel): but there may be other roles such as `available_tools`. """ # Fields for internal use - pdl__context: Optional[ModelInput] = [] - """Current context - """ - pdl__id: Optional[str] = "" - """Unique identifier for this block - """ - pdl__result: Optional[Any] = None - """Result of the execution of the block""" - pdl__location: Optional[PdlLocationType] = None - pdl__timing: Optional[PdlTiming] = None + pdl__context: OptionalModelInput = [] + """Current context.""" + pdl__id: OptionalStr = "" + """Unique identifier for this block.""" + pdl__result: OptionalAny = None + """Result of the execution of the block.""" + pdl__location: OptionalPdlLocationType = None + pdl__timing: OptionalPdlTiming = None + """Execution timing information.""" class LeafBlock(Block): @@ -412,7 +465,7 @@ class CallBlock(LeafBlock): """Arguments of the function with their values. """ # Field for internal use - pdl__trace: Optional["BlockType"] = None + pdl__trace: OptionalBlockType = None class LitellmParameters(BaseModel): @@ -518,14 +571,14 @@ class ModelBlock(LeafBlock): input: "BlockType" = "${ pdl_context }" """Messages to send to the model. """ - modelResponse: Optional[str] = None + modelResponse: OptionalStr = None """Variable where to store the raw response of the model. """ # Field for internal use - pdl__usage: Optional[PdlUsage] = None + pdl__usage: OptionalPdlUsage = None """Tokens consumed during model call """ - pdl__model_input: Optional[ModelInput] = None + pdl__model_input: OptionalModelInput = None class LitellmModelBlock(ModelBlock): @@ -543,7 +596,7 @@ class LitellmModelBlock(ModelBlock): platform: Literal[ModelPlatform.LITELLM] = ModelPlatform.LITELLM """Optional field to ensure that the block is using LiteLLM. """ - model: ExpressionType[str] + model: ExpressionStr """Name of the model following the LiteLLM convention. """ parameters: Optional[LitellmParameters | ExpressionType[dict]] = None @@ -552,10 +605,10 @@ class LitellmModelBlock(ModelBlock): class GraniteioProcessor(BaseModel): - type: Optional[ExpressionType[str]] = None + type: OptionalExpressionStr = None """Type of IO processor. """ - model: Optional[ExpressionType[str]] = None + model: OptionalExpressionStr = None """Model name used by the backend. """ backend: ExpressionType[str | dict[str, Any] | object] @@ -620,7 +673,7 @@ class ArgsBlock(BaseCodeBlock): """ lang: Annotated[Literal["command"], BeforeValidator(_ensure_lower)] = "command" - args: list[ExpressionType[str]] + args: list[ExpressionStr] """The argument vector to spawn. """ @@ -708,9 +761,9 @@ class MessageBlock(LeafBlock): kind: Literal[BlockKind.MESSAGE] = BlockKind.MESSAGE content: "BlockType" """Content of the message.""" - name: Optional[ExpressionType[str]] = None + name: OptionalExpressionStr = None """For example, the name of the tool that was invoked, for which this message is the tool response.""" - tool_call_id: Optional[ExpressionType[str]] = None + tool_call_id: OptionalExpressionStr = None """The id of the tool invocation for which this message is the tool response.""" @@ -730,13 +783,13 @@ class IfBlock(StructuredBlock): """ kind: Literal[BlockKind.IF] = BlockKind.IF - condition: ExpressionType[bool] = Field(alias="if") + condition: ExpressionBool = Field(alias="if") """Condition. """ then: "BlockType" """Branch to execute if the condition is true. """ - else_: Optional["BlockType"] = Field(default=None, alias="else") + else_: OptionalBlockType = Field(default=None, alias="else") """Branch to execute if the condition is false. """ @@ -748,7 +801,7 @@ class MatchCase(BaseModel): case: Optional[PatternType] = None """Value to match. """ - if_: Optional[ExpressionType[bool]] = Field(default=None, alias="if") + if_: OptionalExpressionBool = Field(default=None, alias="if") """Boolean condition to satisfy. """ then: "BlockType" @@ -843,7 +896,9 @@ class JoinReduce(JoinConfig): """Function used to combine the results.""" -JoinType: TypeAlias = JoinText | JoinArray | JoinObject | JoinLastOf | JoinReduce +JoinType = TypeAliasType( + "JoinType", Union[JoinText, JoinArray, JoinObject, JoinLastOf, JoinReduce] +) """Different ways to join loop iterations.""" @@ -879,19 +934,19 @@ class RepeatBlock(StructuredBlock): for_: Optional[dict[str, ExpressionType[list]]] = Field(default=None, alias="for") """Arrays to iterate over. """ - index: Optional[str] = None + index: OptionalStr = None """Name of the variable containing the loop iteration. """ - while_: ExpressionType[bool] = Field(default=True, alias="while") + while_: ExpressionBool = Field(default=True, alias="while") """Condition to stay at the beginning of the loop. """ repeat: "BlockType" """Body of the loop. """ - until: ExpressionType[bool] = False + until: ExpressionBool = False """Condition to exit at the end of the loop. """ - maxIterations: Optional[ExpressionType[int]] = None + maxIterations: OptionalExpressionInt = None """Maximal number of iterations to perform. """ join: JoinType = JoinText() @@ -931,13 +986,13 @@ class MapBlock(StructuredBlock): for_: Optional[dict[str, ExpressionType[list]]] = Field(default=None, alias="for") """Arrays to iterate over. """ - index: Optional[str] = None + index: OptionalStr = None """Name of the variable containing the loop iteration. """ map: "BlockType" """Body of the iterator. """ - maxIterations: Optional[ExpressionType[int]] = None + maxIterations: OptionalExpressionInt = None """Maximal number of iterations to perform. """ join: JoinType = JoinText() @@ -964,10 +1019,10 @@ class ReadBlock(LeafBlock): """ kind: Literal[BlockKind.READ] = BlockKind.READ - read: ExpressionType[str] | None + read: OptionalExpressionStr """Name of the file to read. If `None`, read the standard input. """ - message: Optional[str] = None + message: OptionalStr = None """Message to prompt the user to enter a value. """ multiline: bool = False @@ -983,7 +1038,7 @@ class IncludeBlock(StructuredBlock): """Name of the file to include. """ # Field for internal use - pdl__trace: Optional["BlockType"] = None + pdl__trace: OptionalBlockType = None class ImportBlock(LeafBlock): @@ -994,7 +1049,7 @@ class ImportBlock(LeafBlock): """Name of the file to import. """ # Field for internal use - pdl__trace: Optional["BlockType"] = None + pdl__trace: OptionalBlockType = None class ErrorBlock(LeafBlock): @@ -1041,7 +1096,9 @@ class EmptyBlock(LeafBlock): ) """Different types of structured blocks. """ -BlockType: TypeAlias = None | bool | int | float | str | AdvancedBlockType +BlockType = TypeAliasType( + "BlockType", Union[None, bool, int, float, str, AdvancedBlockType] +) """All kinds of blocks. """ BlockOrBlocksType: TypeAlias = BlockType | list[BlockType] # pyright: ignore @@ -1076,7 +1133,7 @@ def __init__( message: str, loc: Optional[PdlLocationType] = None, trace: Optional[BlockType] = None, - fallback: Optional[Any] = None, + fallback: OptionalAny = None, ): super().__init__(message) self.loc = loc @@ -1099,7 +1156,7 @@ def __init__( message: str, blocks: list[BlockType], loc: Optional[PdlLocationType] = None, - fallback: Optional[Any] = None, + fallback: OptionalAny = None, ): super().__init__(message) self.loc = loc diff --git a/src/pdl/pdl_interpreter.py b/src/pdl/pdl_interpreter.py index d0fb3aa51..23552d8a2 100644 --- a/src/pdl/pdl_interpreter.py +++ b/src/pdl/pdl_interpreter.py @@ -229,6 +229,9 @@ def __call__(self, *args, **kwargs): return result +ClosureBlock.model_rebuild() + + def generate( pdl_file: str | Path, state: Optional[InterpreterState], diff --git a/src/pdl/pdl_schema_error_analyzer.py b/src/pdl/pdl_schema_error_analyzer.py index 93f207b24..9b9076159 100644 --- a/src/pdl/pdl_schema_error_analyzer.py +++ b/src/pdl/pdl_schema_error_analyzer.py @@ -156,6 +156,13 @@ def analyze_errors(defs, schema, data, loc: PdlLocationType) -> list[str]: # no the_type_exists = True if "enum" in item and data in item["enum"]: the_type_exists = True + if "$ref" in item: + ref_string = item["$ref"].split("/")[2] + ref_type = defs[ref_string] + errs = analyze_errors(defs, ref_type, data, loc) + the_type_exists = len(errs) == 0 + if the_type_exists: + break if not the_type_exists: ret.append( get_loc_string(loc)