Skip to content

Commit 9612a7f

Browse files
committed
Remove pdl__trace from model block
1 parent 149d1c7 commit 9612a7f

File tree

5 files changed

+6
-239
lines changed

5 files changed

+6
-239
lines changed

pdl-live-react/src/pdl_ast.d.ts

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,32 +2180,6 @@ export type Input =
21802180
export type Modelresponse = string | null
21812181
export type CompletionTokens = number | null
21822182
export type PromptTokens = number | null
2183-
export type PdlTrace3 =
2184-
| boolean
2185-
| number
2186-
| string
2187-
| FunctionBlock
2188-
| CallBlock
2189-
| LitellmModelBlock
2190-
| GraniteioModelBlock
2191-
| CodeBlock
2192-
| ArgsBlock
2193-
| GetBlock
2194-
| DataBlock
2195-
| IfBlock
2196-
| MatchBlock
2197-
| RepeatBlock
2198-
| TextBlock
2199-
| LastOfBlock
2200-
| ArrayBlock
2201-
| ObjectBlock
2202-
| MessageBlock
2203-
| ReadBlock
2204-
| IncludeBlock
2205-
| ImportBlock
2206-
| ErrorBlock
2207-
| EmptyBlock
2208-
| null
22092183
/**
22102184
* Optional field to ensure that the block is using granite-io.
22112185
*
@@ -2352,32 +2326,6 @@ export type Input1 =
23522326
*
23532327
*/
23542328
export type Modelresponse1 = string | null
2355-
export type PdlTrace4 =
2356-
| boolean
2357-
| number
2358-
| string
2359-
| FunctionBlock
2360-
| CallBlock
2361-
| LitellmModelBlock
2362-
| GraniteioModelBlock
2363-
| CodeBlock
2364-
| ArgsBlock
2365-
| GetBlock
2366-
| DataBlock
2367-
| IfBlock
2368-
| MatchBlock
2369-
| RepeatBlock
2370-
| TextBlock
2371-
| LastOfBlock
2372-
| ArrayBlock
2373-
| ObjectBlock
2374-
| MessageBlock
2375-
| ReadBlock
2376-
| IncludeBlock
2377-
| ImportBlock
2378-
| ErrorBlock
2379-
| EmptyBlock
2380-
| null
23812329
/**
23822330
* Optional field to ensure that the block is using LiteLLM.
23832331
*
@@ -2517,7 +2465,7 @@ export type Context19 =
25172465
export type PdlId19 = string | null
25182466
export type PdlIsLeaf19 = true
25192467
export type Kind19 = "call"
2520-
export type PdlTrace5 =
2468+
export type PdlTrace3 =
25212469
| boolean
25222470
| number
25232471
| string
@@ -2764,7 +2712,7 @@ export interface CallBlock {
27642712
kind?: Kind19
27652713
call: unknown
27662714
args?: unknown
2767-
pdl__trace?: PdlTrace5
2715+
pdl__trace?: PdlTrace3
27682716
}
27692717
/**
27702718
* Type specification of the result of the block.
@@ -2839,7 +2787,6 @@ export interface LitellmModelBlock {
28392787
*
28402788
*/
28412789
pdl__usage?: PdlUsage | null
2842-
pdl__trace?: PdlTrace4
28432790
platform?: Platform1
28442791
parameters?: Parameters1
28452792
}
@@ -2909,7 +2856,6 @@ export interface GraniteioModelBlock {
29092856
*
29102857
*/
29112858
pdl__usage?: PdlUsage | null
2912-
pdl__trace?: PdlTrace3
29132859
platform?: Platform
29142860
backend: Backend
29152861
processor?: Processor

src/pdl/pdl-schema.json

Lines changed: 0 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,90 +4236,6 @@
42364236
"default": null,
42374237
"description": "Tokens consumed during model call\n "
42384238
},
4239-
"pdl__trace": {
4240-
"anyOf": [
4241-
{
4242-
"type": "boolean"
4243-
},
4244-
{
4245-
"type": "integer"
4246-
},
4247-
{
4248-
"type": "number"
4249-
},
4250-
{
4251-
"type": "string"
4252-
},
4253-
{
4254-
"$ref": "#/$defs/FunctionBlock"
4255-
},
4256-
{
4257-
"$ref": "#/$defs/CallBlock"
4258-
},
4259-
{
4260-
"$ref": "#/$defs/LitellmModelBlock"
4261-
},
4262-
{
4263-
"$ref": "#/$defs/GraniteioModelBlock"
4264-
},
4265-
{
4266-
"$ref": "#/$defs/CodeBlock"
4267-
},
4268-
{
4269-
"$ref": "#/$defs/ArgsBlock"
4270-
},
4271-
{
4272-
"$ref": "#/$defs/GetBlock"
4273-
},
4274-
{
4275-
"$ref": "#/$defs/DataBlock"
4276-
},
4277-
{
4278-
"$ref": "#/$defs/IfBlock"
4279-
},
4280-
{
4281-
"$ref": "#/$defs/MatchBlock"
4282-
},
4283-
{
4284-
"$ref": "#/$defs/RepeatBlock"
4285-
},
4286-
{
4287-
"$ref": "#/$defs/TextBlock"
4288-
},
4289-
{
4290-
"$ref": "#/$defs/LastOfBlock"
4291-
},
4292-
{
4293-
"$ref": "#/$defs/ArrayBlock"
4294-
},
4295-
{
4296-
"$ref": "#/$defs/ObjectBlock"
4297-
},
4298-
{
4299-
"$ref": "#/$defs/MessageBlock"
4300-
},
4301-
{
4302-
"$ref": "#/$defs/ReadBlock"
4303-
},
4304-
{
4305-
"$ref": "#/$defs/IncludeBlock"
4306-
},
4307-
{
4308-
"$ref": "#/$defs/ImportBlock"
4309-
},
4310-
{
4311-
"$ref": "#/$defs/ErrorBlock"
4312-
},
4313-
{
4314-
"$ref": "#/$defs/EmptyBlock"
4315-
},
4316-
{
4317-
"type": "null"
4318-
}
4319-
],
4320-
"default": null,
4321-
"title": "Pdl Trace"
4322-
},
43234239
"platform": {
43244240
"const": "granite-io",
43254241
"default": "granite-io",
@@ -6770,90 +6686,6 @@
67706686
"default": null,
67716687
"description": "Tokens consumed during model call\n "
67726688
},
6773-
"pdl__trace": {
6774-
"anyOf": [
6775-
{
6776-
"type": "boolean"
6777-
},
6778-
{
6779-
"type": "integer"
6780-
},
6781-
{
6782-
"type": "number"
6783-
},
6784-
{
6785-
"type": "string"
6786-
},
6787-
{
6788-
"$ref": "#/$defs/FunctionBlock"
6789-
},
6790-
{
6791-
"$ref": "#/$defs/CallBlock"
6792-
},
6793-
{
6794-
"$ref": "#/$defs/LitellmModelBlock"
6795-
},
6796-
{
6797-
"$ref": "#/$defs/GraniteioModelBlock"
6798-
},
6799-
{
6800-
"$ref": "#/$defs/CodeBlock"
6801-
},
6802-
{
6803-
"$ref": "#/$defs/ArgsBlock"
6804-
},
6805-
{
6806-
"$ref": "#/$defs/GetBlock"
6807-
},
6808-
{
6809-
"$ref": "#/$defs/DataBlock"
6810-
},
6811-
{
6812-
"$ref": "#/$defs/IfBlock"
6813-
},
6814-
{
6815-
"$ref": "#/$defs/MatchBlock"
6816-
},
6817-
{
6818-
"$ref": "#/$defs/RepeatBlock"
6819-
},
6820-
{
6821-
"$ref": "#/$defs/TextBlock"
6822-
},
6823-
{
6824-
"$ref": "#/$defs/LastOfBlock"
6825-
},
6826-
{
6827-
"$ref": "#/$defs/ArrayBlock"
6828-
},
6829-
{
6830-
"$ref": "#/$defs/ObjectBlock"
6831-
},
6832-
{
6833-
"$ref": "#/$defs/MessageBlock"
6834-
},
6835-
{
6836-
"$ref": "#/$defs/ReadBlock"
6837-
},
6838-
{
6839-
"$ref": "#/$defs/IncludeBlock"
6840-
},
6841-
{
6842-
"$ref": "#/$defs/ImportBlock"
6843-
},
6844-
{
6845-
"$ref": "#/$defs/ErrorBlock"
6846-
},
6847-
{
6848-
"$ref": "#/$defs/EmptyBlock"
6849-
},
6850-
{
6851-
"type": "null"
6852-
}
6853-
],
6854-
"default": null,
6855-
"title": "Pdl Trace"
6856-
},
68576689
"platform": {
68586690
"const": "litellm",
68596691
"default": "litellm",

src/pdl/pdl_ast.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,10 @@ class ModelBlock(LeafBlock):
406406
modelResponse: Optional[str] = None
407407
"""Variable where to store the raw response of the model.
408408
"""
409+
# Field for internal use
409410
pdl__usage: Optional[PdlUsage] = None
410411
"""Tokens consumed during model call
411412
"""
412-
# Field for internal use
413-
pdl__trace: Optional["BlockType"] = None
414413

415414

416415
class LitellmModelBlock(ModelBlock):

src/pdl/pdl_ast_utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ def iter_block_children(f: Callable[[BlockType], None], block: BlockType) -> Non
4545
case ModelBlock():
4646
if block.input is not None:
4747
f(block.input)
48-
if block.pdl__trace is not None:
49-
f(block.pdl__trace)
5048
case CodeBlock():
5149
f(block.code)
5250
case GetBlock():
@@ -137,16 +135,10 @@ def map_block_children(f: MappedFunctions, block: BlockType) -> BlockType:
137135
block.model = f.f_expr(block.model)
138136
if block.input is not None:
139137
block.input = f.f_block(block.input)
140-
if block.pdl__trace is not None:
141-
block.pdl__trace = f.f_block(block.pdl__trace)
142-
if block.parameters is not None:
143-
block.parameters = f.f_expr(block.parameters)
144138
case GraniteioModelBlock():
145139
block.model = f.f_expr(block.model)
146140
if block.input is not None:
147141
block.input = f.f_block(block.input)
148-
if block.pdl__trace is not None:
149-
block.pdl__trace = f.f_block(block.pdl__trace)
150142
if block.parameters is not None:
151143
block.parameters = f.f_expr(block.parameters)
152144
case CodeBlock():

src/pdl/pdl_interpreter.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,13 +1324,11 @@ def get_transformed_inputs(kwargs):
13241324
result = lazy_apply(
13251325
lambda msg: "" if msg["content"] is None else msg["content"], msg
13261326
)
1327-
trace = block.model_copy(
1328-
update={"pdl__result": result, "pdl__trace": concrete_block}
1329-
)
1330-
if concrete_block.pdl__usage is not None:
1331-
trace.pdl__usage = concrete_block.pdl__usage
13321327
if block.modelResponse is not None:
13331328
scope = scope | {block.modelResponse: raw_result}
1329+
trace: BlockTypeTVarProcessCallModel = concrete_block.model_copy(
1330+
update={"pdl__result": result}
1331+
) # pyright: ignore
13341332
return result, background, scope, trace
13351333
except httpx.RequestError as exc:
13361334
message = f"model '{model_id}' encountered {repr(exc)} trying to {exc.request.method} against {exc.request.url}"

0 commit comments

Comments
 (0)