trodo-python 2.12.0__py3-none-any.whl → 2.14.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 CHANGED
@@ -41,7 +41,7 @@ Downstream microservice (join the caller's run instead of making a new one):
41
41
 
42
42
  from __future__ import annotations
43
43
 
44
- __version__ = "2.12.0"
44
+ __version__ = "2.13.0"
45
45
 
46
46
  from typing import Any, Callable, Dict, List, Optional, Union
47
47
 
@@ -16,7 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  import threading
18
18
  import time
19
- from typing import Any, Callable, Dict, List, Optional, Set
19
+ from typing import Any, Callable, Dict, List, Optional, Set, Union
20
20
 
21
21
  from ..prompts.compile import CompileError, compile_prompt
22
22
  from ..prompts.template import TemplateError, render
@@ -38,7 +38,7 @@ __all__ = [
38
38
  DEFAULT_TTL_SECONDS = 60.0
39
39
 
40
40
 
41
- def _cache_key(name: str, version: Optional[int], label: Optional[str]) -> str:
41
+ def _cache_key(name: str, version: Optional[Union[int, str]], label: Optional[str]) -> str:
42
42
  # Resolution happens server-side on every fetch; the client only caches
43
43
  # under whatever selector was asked for. So a label flip propagates within
44
44
  # one TTL without the client knowing anything about labels.
@@ -73,9 +73,12 @@ def _to_prompt(raw: Dict[str, Any], is_fallback: bool = False) -> ManagedPrompt:
73
73
  description=raw.get("description"),
74
74
  tags=list(raw.get("tags") or []),
75
75
  version=int(raw.get("version") or 0),
76
+ version_hash=raw.get("version_hash"),
77
+ content_hash=raw.get("content_hash"),
78
+ parent_hash=raw.get("parent_hash"),
76
79
  labels=list(raw.get("labels") or []),
77
80
  messages=list(raw.get("messages") or []),
78
- model_config=dict(raw.get("model_config") or {}),
81
+ model=dict(raw.get("model") or {}),
79
82
  tools=list(raw.get("tools") or []),
80
83
  response_format=raw.get("response_format"),
81
84
  variables=_to_variables(raw.get("variables")),
@@ -172,7 +175,7 @@ class PromptManager:
172
175
  self,
173
176
  name: str,
174
177
  label: Optional[str] = None,
175
- version: Optional[int] = None,
178
+ version: Optional[Union[int, str]] = None,
176
179
  cache_ttl_seconds: Optional[float] = None,
177
180
  fallback: Optional[Dict[str, Any]] = None,
178
181
  max_retries: int = 2,
@@ -181,7 +184,8 @@ class PromptManager:
181
184
 
182
185
  Without arguments you get the version labelled ``production``; pass
183
186
  ``label`` to follow a different deploy label, or ``version`` to pin
184
- exactly.
187
+ exactly. ``version`` may be the integer ``version_no`` or a
188
+ ``version_hash`` (full, or an unambiguous short prefix like ``a3f9c2``).
185
189
 
186
190
  Availability ladder — fresh cache -> stale cache -> ``fallback`` ->
187
191
  raise. A prompt fetch is on your hot path, so a Trodo outage degrades
@@ -245,7 +249,7 @@ class PromptManager:
245
249
  "labels": [],
246
250
  "tags": [],
247
251
  "messages": fallback.get("messages") or [],
248
- "model_config": fallback.get("model_config") or {},
252
+ "model": fallback.get("model") or {},
249
253
  "tools": [],
250
254
  "response_format": None,
251
255
  "variables": fallback.get("variables") or [],
trodo/prompts/compile.py CHANGED
@@ -175,7 +175,7 @@ def compile_prompt(prompt: Any, values: Optional[Dict[str, Any]] = None) -> Comp
175
175
 
176
176
  return CompiledPrompt(
177
177
  messages=out,
178
- model=get("model_config") or {},
178
+ model=get("model") or {},
179
179
  tools=get("tools") or [],
180
180
  response_format=get("response_format"),
181
181
  )
trodo/prompts/types.py CHANGED
@@ -54,11 +54,18 @@ class ManagedPrompt:
54
54
 
55
55
  name: str
56
56
  messages: List[PromptNode] = field(default_factory=list)
57
- model_config: ModelConfig = field(default_factory=dict)
57
+ model: ModelConfig = field(default_factory=dict)
58
58
  tools: List[PromptTool] = field(default_factory=list)
59
59
  response_format: Optional[ResponseFormat] = None
60
60
  variables: List[PromptVariable] = field(default_factory=list)
61
61
  version: int = 0
62
+ #: Git-style commit id of this version (content + parent + message + author
63
+ #: + time). Stable and immutable — the recommended way to reference a version.
64
+ version_hash: Optional[str] = None
65
+ #: sha256 of the content; identical content shares it.
66
+ content_hash: Optional[str] = None
67
+ #: The preceding version's ``version_hash`` (None for the first).
68
+ parent_hash: Optional[str] = None
62
69
  labels: List[str] = field(default_factory=list)
63
70
  tags: List[str] = field(default_factory=list)
64
71
  description: Optional[str] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trodo-python
3
- Version: 2.12.0
3
+ Version: 2.14.0
4
4
  Summary: Trodo Analytics SDK for Python — server-side event tracking
5
5
  License: ISC
6
6
  Keywords: analytics,tracking,trodo,server-side
@@ -1,4 +1,4 @@
1
- trodo/__init__.py,sha256=F5asTaDmKcWtk6NJ_DVr4wo1S4HoYMWFiiyqHHDNSvE,21167
1
+ trodo/__init__.py,sha256=9VvBIbahXhuKln5593dCq29dan1IN7xFHU0voW4SDqs,21167
2
2
  trodo/client.py,sha256=z2q1HZKQNENycv9CRD0kOfwEhmz3Ti9_B-uPsqpvY3U,19454
3
3
  trodo/types.py,sha256=eySgUvCXROG2TxtxgiU0MNr5iH0DEcduK8bmYtTKG44,3138
4
4
  trodo/user_context.py,sha256=9la6azzwEanVmdP4ps_xMoufbeWVeIGU-M8ychmgajg,7859
@@ -11,7 +11,7 @@ trodo/auto/auto_event_manager.py,sha256=cztuRsRkNoJE5R4NfSfTrTJTGl4jx2Yb-Ncy0aVA
11
11
  trodo/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  trodo/managers/group_manager.py,sha256=ki3Se3qEoSZfREX63oeDeBmEfZF-ISHLE8azEtLg0tM,3542
13
13
  trodo/managers/people_manager.py,sha256=mMVnx40Mlifx6NGgChvohC9ViK6dQu2mkXNHbV8pK1E,2882
14
- trodo/managers/prompt_manager.py,sha256=Ub7rlg3dVVllr6qBf6sXLGvunnP_7FLeGEOal6sYFPY,10448
14
+ trodo/managers/prompt_manager.py,sha256=kyQFdty7l7w7ngzsHw6zs1bgL4oa1Lj3ugMPxakrMqM,10719
15
15
  trodo/otel/__init__.py,sha256=yiRFXWUU45bAM2CV37XeO7zf1hmnmjufdP4XO50yEyE,624
16
16
  trodo/otel/auto_instrument.py,sha256=hJesQMOOp86U66PampcGNINmBVvwVuU_WHVrbUMauug,20895
17
17
  trodo/otel/context.py,sha256=iJ1rE42-SbO8VZHAxhIl2ZJXgNwLIVps5xLg8GKgfFc,1165
@@ -21,16 +21,16 @@ trodo/otel/register.py,sha256=bV_ePTfUvPugig2GZnylhzxi2QfoPWs96A9mGLPMrSQ,9387
21
21
  trodo/otel/transport.py,sha256=hzZz8gwSMGJ8CxdijmLn1Ljt18owr9XTWy13DLbwYbw,2441
22
22
  trodo/otel/wrap_agent.py,sha256=_nFDhxPyl0RlNKj29cBNeRc_zAY5FUiHvTiNUWxTt0M,39049
23
23
  trodo/prompts/__init__.py,sha256=yunNc8WkTSfEEkRR-NZWXAt_ZB3Ee2INRh-4RE7uHj4,806
24
- trodo/prompts/compile.py,sha256=Jqy1yaSE1j931KIHP1opMpEEmBKHv-I4BUq-1xaNVWA,6352
24
+ trodo/prompts/compile.py,sha256=sEMl8EWdK0G9uOKGcgc39ujnA5RLCUtbk26TYVqK68Q,6345
25
25
  trodo/prompts/template.py,sha256=obQiivPCR6LEdz7q1cby7uL25tYHYui4aoEaiUNqWfs,9357
26
- trodo/prompts/types.py,sha256=iCNoJk6_kk0JvEblGsDm6c9lEdQW6ixOOv6aCG6IP-k,2924
26
+ trodo/prompts/types.py,sha256=RhvYSuXCrwnZHu5TftObIAs-TQa2E7v08alNmD62x4s,3327
27
27
  trodo/queue/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  trodo/queue/batch_flusher.py,sha256=4Lg6T3Urwi9U0Q4FpFGPmjDYKg4ZliCTR-ND8BJvWaY,1298
29
29
  trodo/queue/event_queue.py,sha256=EVFZrhlq_kwC3jJ2GK0wMhHISf9UzLCZNDnT_aZ2I2A,872
30
30
  trodo/session/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  trodo/session/server_session.py,sha256=McsudEiq33XDq3nqxgzBcUvIjQxCMscwEuAPnYXrTjs,2136
32
32
  trodo/session/session_manager.py,sha256=JrgH1VeicmtlxPR4dXEuJbxhi23OelkgwW3-9Slv80o,2525
33
- trodo_python-2.12.0.dist-info/METADATA,sha256=pvC-YSCsk3GkCPdxnNGUkbgT-ZLBWIgO-MWLxqzzcrA,23115
34
- trodo_python-2.12.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
35
- trodo_python-2.12.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
36
- trodo_python-2.12.0.dist-info/RECORD,,
33
+ trodo_python-2.14.0.dist-info/METADATA,sha256=RCejgO9mpxqpdJhLGakkYLLVCzSB0ZJXwdFMQFrkXP8,23115
34
+ trodo_python-2.14.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
35
+ trodo_python-2.14.0.dist-info/top_level.txt,sha256=VCQu1CJWFmNsqTs1YxMcw4Mq35Tc3z3uI9RwHEXAayQ,6
36
+ trodo_python-2.14.0.dist-info/RECORD,,