trodo-python 2.18.2__py3-none-any.whl → 2.20.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- trodo/__init__.py +1 -1
- trodo/managers/prompt_manager.py +3 -1
- trodo/prompts/compile.py +8 -4
- trodo/prompts/types.py +8 -4
- {trodo_python-2.18.2.dist-info → trodo_python-2.20.0.dist-info}/METADATA +1 -1
- {trodo_python-2.18.2.dist-info → trodo_python-2.20.0.dist-info}/RECORD +8 -8
- {trodo_python-2.18.2.dist-info → trodo_python-2.20.0.dist-info}/WHEEL +0 -0
- {trodo_python-2.18.2.dist-info → trodo_python-2.20.0.dist-info}/top_level.txt +0 -0
trodo/__init__.py
CHANGED
trodo/managers/prompt_manager.py
CHANGED
|
@@ -56,10 +56,12 @@ def _to_variables(raw: Any) -> List[PromptVariable]:
|
|
|
56
56
|
out.append(v)
|
|
57
57
|
elif isinstance(v, dict) and isinstance(v.get("name"), str):
|
|
58
58
|
out.append(
|
|
59
|
+
# Named fields only — a stored version may carry keys this SDK
|
|
60
|
+
# no longer models (`required`, retired in 2.20.0), and fetching
|
|
61
|
+
# one must never raise.
|
|
59
62
|
PromptVariable(
|
|
60
63
|
name=v["name"],
|
|
61
64
|
type=v.get("type") or "string",
|
|
62
|
-
required=bool(v.get("required")),
|
|
63
65
|
default=v.get("default"),
|
|
64
66
|
description=v.get("description"),
|
|
65
67
|
)
|
trodo/prompts/compile.py
CHANGED
|
@@ -74,8 +74,10 @@ def build_scope(
|
|
|
74
74
|
) -> Dict[str, Any]:
|
|
75
75
|
"""Build the render scope from declarations + caller values.
|
|
76
76
|
|
|
77
|
-
Resolution order: caller value
|
|
78
|
-
|
|
77
|
+
Resolution order: caller value -> declared default -> empty.
|
|
78
|
+
|
|
79
|
+
A missing value never raises. The one thing this does reject is a value for
|
|
80
|
+
a variable the prompt does not declare, which is almost always a typo.
|
|
79
81
|
"""
|
|
80
82
|
errors: List[str] = []
|
|
81
83
|
scope: Dict[str, Any] = {}
|
|
@@ -100,8 +102,10 @@ def build_scope(
|
|
|
100
102
|
has = name in values
|
|
101
103
|
value = values.get(name) if has else None
|
|
102
104
|
|
|
103
|
-
#
|
|
104
|
-
#
|
|
105
|
+
# A missing value resolves, it never fails: the declared default, or
|
|
106
|
+
# empty. That IS the point of declaring a default -- there is no third
|
|
107
|
+
# case where the caller has to have supplied something, and adding one
|
|
108
|
+
# would turn an empty render into a crash for no gain.
|
|
105
109
|
if not has or value is None:
|
|
106
110
|
value = default if has_default else ([] if type_ == "messages" else "")
|
|
107
111
|
|
trodo/prompts/types.py
CHANGED
|
@@ -26,14 +26,18 @@ class PromptVariable:
|
|
|
26
26
|
"""A declared variable.
|
|
27
27
|
|
|
28
28
|
Every competitor leaves variables undeclared and untyped — discovered by
|
|
29
|
-
regex, with no defaults
|
|
30
|
-
``compile()``
|
|
31
|
-
|
|
29
|
+
regex, and with no defaults. Knowing the declared set is what lets
|
|
30
|
+
``compile()`` catch a value passed for a variable that doesn't exist,
|
|
31
|
+
instead of silently rendering the wrong prompt.
|
|
32
|
+
|
|
33
|
+
A missing value never fails. It resolves to the declared ``default``, or to
|
|
34
|
+
empty — that is what declaring a default is FOR. There is deliberately no
|
|
35
|
+
``required`` flag: it would give the author a decision to get wrong and the
|
|
36
|
+
caller a crash where an empty render would do.
|
|
32
37
|
"""
|
|
33
38
|
|
|
34
39
|
name: str
|
|
35
40
|
type: str = "string"
|
|
36
|
-
required: bool = False
|
|
37
41
|
default: Any = None
|
|
38
42
|
description: Optional[str] = None
|
|
39
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
trodo/__init__.py,sha256=
|
|
1
|
+
trodo/__init__.py,sha256=ueM-l4KXHdP42DzvCRN9Zc5d4OsCxOSjiT-NIGAiLyQ,26928
|
|
2
2
|
trodo/client.py,sha256=9UYaHZtWPMYdlG2xWVf77PQJ9DfFgN-zobTh60i8_Cc,22453
|
|
3
3
|
trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
|
|
4
4
|
trodo/user_context.py,sha256=uHCI2WYoOI3cNwdIUEuZdX4VYSu14pzm348ksn6hn_c,8195
|
|
@@ -13,7 +13,7 @@ trodo/managers/dataset_manager.py,sha256=gx0S8ujG3cbw4IskBNMdceBjDbcEh_nebwKSzEv
|
|
|
13
13
|
trodo/managers/experiment_manager.py,sha256=V-vemLtenfSI5VIcP0HPiXzEy8AyTrRrbJVCA9Z6wjo,10579
|
|
14
14
|
trodo/managers/group_manager.py,sha256=ki3Se3qEoSZfREX63oeDeBmEfZF-ISHLE8azEtLg0tM,3542
|
|
15
15
|
trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8pK1E,2882
|
|
16
|
-
trodo/managers/prompt_manager.py,sha256=
|
|
16
|
+
trodo/managers/prompt_manager.py,sha256=4xj_38b2qU31aTs5fIq-wNJnPisqf1zre0u8jvjZOF4,11375
|
|
17
17
|
trodo/managers/user_manager.py,sha256=faJYX3CHrD7ulYiShV7FhThSMX9aJ3kdOgU4Qtdy5FM,2844
|
|
18
18
|
trodo/otel/__init__.py,sha256=yiRFXWUU45bAM2CV37XeO7zf1hmnmjufdP4XO50yEyE,624
|
|
19
19
|
trodo/otel/auto_instrument.py,sha256=Iae9A9lvh2PImE6gqnyEMXeRPRpjTxZcxx1zW2KDLac,21467
|
|
@@ -25,9 +25,9 @@ trodo/otel/register.py,sha256=bV_ePTfUvPugig2GZnylhzxi2QfoPWs96A9mGLPMrSQ,9387
|
|
|
25
25
|
trodo/otel/transport.py,sha256=hzZz8gwSMGJ8CxdijmLn1Ljt18owr9XTWy13DLbwYbw,2441
|
|
26
26
|
trodo/otel/wrap_agent.py,sha256=cJjrzlZNW2g6q_coLN7UR4uxn65h4u3-LNzMfE4dLVw,40999
|
|
27
27
|
trodo/prompts/__init__.py,sha256=yunNc8WkTSfEEkRR-NZWXAt_ZB3Ee2INRh-4RE7uHj4,806
|
|
28
|
-
trodo/prompts/compile.py,sha256=
|
|
28
|
+
trodo/prompts/compile.py,sha256=UhJhu-BtVicaauDEKpAXB17KhgVs4jWos_I60I8kZFk,6583
|
|
29
29
|
trodo/prompts/template.py,sha256=obQiivPCR6LEdz7q1cby7uL25tYHYui4aoEaiUNqWfs,9357
|
|
30
|
-
trodo/prompts/types.py,sha256=
|
|
30
|
+
trodo/prompts/types.py,sha256=A24njy6qcc8QNzWEfGu28BbBr360S7A5Pw7_ObIWNS4,4684
|
|
31
31
|
trodo/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
trodo/queue/batch_flusher.py,sha256=4Lg6T3Urwi9U0Q4FpFGPmjDYKg4ZliCTR-ND8BJvWaY,1298
|
|
33
33
|
trodo/queue/event_queue.py,sha256=EVFZrhlq_kwC3jJ2GK0wMhHISf9UzLCZNDnT_aZ2I2A,872
|
|
@@ -36,7 +36,7 @@ trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrT
|
|
|
36
36
|
trodo/session/session_manager.py,sha256=7ht5LeeZX1HLLfPeNV_a8NkXGbHl3up0CRtCGr3EzjQ,2995
|
|
37
37
|
trodo/util/__init__.py,sha256=Z9c4rPPdKg06Kk3byKheDqksSgR4WNvS475oQ5sNljc,54
|
|
38
38
|
trodo/util/lru.py,sha256=QIsM7s6J_E9ZjiXatSyReZIEeGypTAcgrPWWy8YsRa4,2465
|
|
39
|
-
trodo_python-2.
|
|
40
|
-
trodo_python-2.
|
|
41
|
-
trodo_python-2.
|
|
42
|
-
trodo_python-2.
|
|
39
|
+
trodo_python-2.20.0.dist-info/METADATA,sha256=EYdoY1cwgukIxmryCG6QadL0qiIz5J8harU3y7v6Q0Y,25308
|
|
40
|
+
trodo_python-2.20.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
41
|
+
trodo_python-2.20.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
|
|
42
|
+
trodo_python-2.20.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|