From 2a28082be33a1af149b83fea461991490ba6aa14 Mon Sep 17 00:00:00 2001 From: Louis Mandel Date: Thu, 13 Mar 2025 16:27:01 -0400 Subject: [PATCH] Use `${ pdl_context }` as default value for the `input` field of a model block --- pdl-live-react/src/pdl_ast.d.ts | 42 ++++++++++++++++----------------- src/pdl/pdl-schema.json | 4 ++-- src/pdl/pdl_ast.py | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pdl-live-react/src/pdl_ast.d.ts b/pdl-live-react/src/pdl_ast.d.ts index aec521f7e..76d178137 100644 --- a/pdl-live-react/src/pdl_ast.d.ts +++ b/pdl-live-react/src/pdl_ast.d.ts @@ -140,7 +140,9 @@ export type Description19 = string | null */ export type Def = string | null export type ContributeTarget = "result" | "context" -export type Value = unknown[] +export type Value = unknown[] | string | LocalizedExpression +export type Path = string[] +export type File = string /** * Indicate if the block contributes to the result and background context. * @@ -243,8 +245,6 @@ export type Context = * */ export type PdlId = string | null -export type Path = string[] -export type File = string export type StartNanos = number | null export type EndNanos = number | null export type FirstUseNanos = number | null @@ -3821,6 +3821,24 @@ export interface Defs19 { export interface ContributeValue { value: Value } +export interface LocalizedExpression { + expr: Expr + pdl__location?: PdlLocationType | null +} +export interface Expr { + [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 +} export interface PdlParser { description?: Description20 spec?: Spec20 @@ -3835,17 +3853,6 @@ export interface RegexParser { regex: Regex mode?: Mode } -/** - * 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 -} /** * Internal data structure to record timing information in the trace. */ @@ -3855,13 +3862,6 @@ export interface PdlTiming { first_use_nanos?: FirstUseNanos timezone?: Timezone } -export interface LocalizedExpression { - expr: Expr - pdl__location?: PdlLocationType | null -} -export interface Expr { - [k: string]: unknown -} export interface JoinText { as?: As with?: With diff --git a/src/pdl/pdl-schema.json b/src/pdl/pdl-schema.json index a8dac644d..cd3575d98 100644 --- a/src/pdl/pdl-schema.json +++ b/src/pdl/pdl-schema.json @@ -3766,7 +3766,7 @@ "type": "null" } ], - "default": null, + "default": "${ pdl_context }", "description": "Messages to send to the model.\n ", "title": "Input" }, @@ -6237,7 +6237,7 @@ "type": "null" } ], - "default": null, + "default": "${ pdl_context }", "description": "Messages to send to the model.\n ", "title": "Input" }, diff --git a/src/pdl/pdl_ast.py b/src/pdl/pdl_ast.py index c11a7d5f9..eb19acab9 100644 --- a/src/pdl/pdl_ast.py +++ b/src/pdl/pdl_ast.py @@ -388,7 +388,7 @@ class ModelBlock(LeafBlock): model: ExpressionType """Model to use. """ - input: Optional["BlockType"] = None + input: "BlockType" = "${ pdl_context }" """Messages to send to the model. """ modelResponse: Optional[str] = None