Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 0 additions & 75 deletions src/pdl/pdl-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@
"kind": {
"const": "array",
"default": "array",
"enum": [
"array"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -1072,9 +1069,6 @@
"kind": {
"const": "model",
"default": "model",
"enum": [
"model"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -1345,9 +1339,6 @@
},
"platform": {
"const": "bam",
"enum": [
"bam"
],
"title": "Platform",
"type": "string"
},
Expand Down Expand Up @@ -2086,9 +2077,6 @@
"kind": {
"const": "call",
"default": "call",
"enum": [
"call"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -2721,9 +2709,6 @@
"kind": {
"const": "code",
"default": "code",
"enum": [
"code"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -3381,9 +3366,6 @@
"kind": {
"const": "data",
"default": "data",
"enum": [
"data"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -3861,9 +3843,6 @@
"kind": {
"const": "empty",
"default": "empty",
"enum": [
"empty"
],
"title": "Kind",
"type": "string"
}
Expand Down Expand Up @@ -4319,9 +4298,6 @@
"kind": {
"const": "error",
"default": "error",
"enum": [
"error"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -4948,9 +4924,6 @@
"kind": {
"const": "for",
"default": "for",
"enum": [
"for"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -5771,9 +5744,6 @@
"kind": {
"const": "function",
"default": "function",
"enum": [
"function"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -6421,9 +6391,6 @@
"kind": {
"const": "get",
"default": "get",
"enum": [
"get"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -6888,9 +6855,6 @@
"kind": {
"const": "if",
"default": "if",
"enum": [
"if"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -7694,9 +7658,6 @@
"kind": {
"const": "include",
"default": "include",
"enum": [
"include"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -7881,9 +7842,6 @@
"as": {
"const": "array",
"description": "Return the result of each iteration as an array.\n ",
"enum": [
"array"
],
"title": "As",
"type": "string"
}
Expand All @@ -7900,9 +7858,6 @@
"as": {
"const": "lastOf",
"description": "Return the result of the last iteration.\n ",
"enum": [
"lastOf"
],
"title": "As",
"type": "string"
}
Expand All @@ -7920,9 +7875,6 @@
"const": "text",
"default": "text",
"description": "String concatenation of the result of each iteration.\n ",
"enum": [
"text"
],
"title": "As",
"type": "string"
},
Expand Down Expand Up @@ -8385,9 +8337,6 @@
"kind": {
"const": "lastOf",
"default": "lastOf",
"enum": [
"lastOf"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -9042,9 +8991,6 @@
"kind": {
"const": "model",
"default": "model",
"enum": [
"model"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -9316,9 +9262,6 @@
"platform": {
"const": "litellm",
"default": "litellm",
"enum": [
"litellm"
],
"title": "Platform",
"type": "string"
},
Expand Down Expand Up @@ -10220,9 +10163,6 @@
"kind": {
"const": "message",
"default": "message",
"enum": [
"message"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -11117,9 +11057,6 @@
"kind": {
"const": "object",
"default": "object",
"enum": [
"object"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -12455,9 +12392,6 @@
"kind": {
"const": "read",
"default": "read",
"enum": [
"read"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -12996,9 +12930,6 @@
"kind": {
"const": "repeat",
"default": "repeat",
"enum": [
"repeat"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -13819,9 +13750,6 @@
"kind": {
"const": "repeat_until",
"default": "repeat_until",
"enum": [
"repeat_until"
],
"title": "Kind",
"type": "string"
},
Expand Down Expand Up @@ -14641,9 +14569,6 @@
"kind": {
"const": "text",
"default": "text",
"enum": [
"text"
],
"title": "Kind",
"type": "string"
},
Expand Down
4 changes: 2 additions & 2 deletions src/pdl/pdl_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""

from enum import StrEnum
from typing import Any, Literal, Optional, TypeAlias, Union
from typing import Any, Literal, Optional, Sequence, TypeAlias, Union

from genai.schema import (
DecodingMethod,
Expand Down Expand Up @@ -110,7 +110,7 @@ class Block(BaseModel):
assign: Optional[str] = Field(default=None, alias="def")
"""Name of the variable used to store the result of the execution of the block.
"""
contribute: list[ContributeTarget | dict[ContributeTarget, ContributeValue]] = [
contribute: Sequence[ContributeTarget | dict[str, ContributeValue]] = [
ContributeTarget.RESULT,
ContributeTarget.CONTEXT,
]
Expand Down
2 changes: 1 addition & 1 deletion src/pdl/pdl_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def step_block(


def context_in_contribute(block: AdvancedBlockType) -> bool:
if ContributeTarget.CONTEXT in block.contribute:
if ContributeTarget.CONTEXT.value in block.contribute:
return True
if get_contribute_value(block.contribute) is not None:
return True
Expand Down
5 changes: 3 additions & 2 deletions src/pdl/pdl_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
from typing import Sequence

from .pdl_ast import ContributeTarget, ContributeValue, FunctionBlock, Message, Messages

Expand All @@ -17,7 +18,7 @@ def stringify(result):


def replace_contribute_value(
contribute: list[ContributeTarget | dict[ContributeTarget, ContributeValue]],
contribute: Sequence[ContributeTarget | dict[str, ContributeValue]],
value: ContributeValue,
):
ret = []
Expand All @@ -31,7 +32,7 @@ def replace_contribute_value(


def get_contribute_value(
contribute: list[ContributeTarget | dict[ContributeTarget, ContributeValue]] | None
contribute: Sequence[ContributeTarget | dict[str, ContributeValue]] | None
):
if contribute is None:
return None
Expand Down