prompture 0.0.42.dev1__py3-none-any.whl → 0.0.43__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.
prompture/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.0.42.dev1'
32
- __version_tuple__ = version_tuple = (0, 0, 42, 'dev1')
31
+ __version__ = version = '0.0.43'
32
+ __version_tuple__ = version_tuple = (0, 0, 43)
33
33
 
34
34
  __commit_id__ = commit_id = None
prompture/async_groups.py CHANGED
@@ -70,6 +70,27 @@ class ParallelGroup:
70
70
  """Request graceful shutdown."""
71
71
  self._stop_requested = True
72
72
 
73
+ @property
74
+ def shared_state(self) -> dict[str, Any]:
75
+ """Return a copy of the current shared execution state."""
76
+ return dict(self._state)
77
+
78
+ def inject_state(self, state: dict[str, Any], *, recursive: bool = False) -> None:
79
+ """Merge external key-value pairs into this group's shared state.
80
+
81
+ Existing keys are NOT overwritten (uses setdefault semantics).
82
+
83
+ Args:
84
+ state: Key-value pairs to inject.
85
+ recursive: If True, also inject into nested sub-groups.
86
+ """
87
+ for k, v in state.items():
88
+ self._state.setdefault(k, v)
89
+ if recursive:
90
+ for agent, _ in self._agents:
91
+ if hasattr(agent, "inject_state"):
92
+ agent.inject_state(state, recursive=True)
93
+
73
94
  async def run_async(self, prompt: str = "") -> GroupResult:
74
95
  """Execute all agents concurrently."""
75
96
  self._stop_requested = False
@@ -213,6 +234,27 @@ class AsyncSequentialGroup:
213
234
  def stop(self) -> None:
214
235
  self._stop_requested = True
215
236
 
237
+ @property
238
+ def shared_state(self) -> dict[str, Any]:
239
+ """Return a copy of the current shared execution state."""
240
+ return dict(self._state)
241
+
242
+ def inject_state(self, state: dict[str, Any], *, recursive: bool = False) -> None:
243
+ """Merge external key-value pairs into this group's shared state.
244
+
245
+ Existing keys are NOT overwritten (uses setdefault semantics).
246
+
247
+ Args:
248
+ state: Key-value pairs to inject.
249
+ recursive: If True, also inject into nested sub-groups.
250
+ """
251
+ for k, v in state.items():
252
+ self._state.setdefault(k, v)
253
+ if recursive:
254
+ for agent, _ in self._agents:
255
+ if hasattr(agent, "inject_state"):
256
+ agent.inject_state(state, recursive=True)
257
+
216
258
  async def run(self, prompt: str = "") -> GroupResult:
217
259
  """Execute all agents in sequence (async)."""
218
260
  self._stop_requested = False
@@ -351,6 +393,27 @@ class AsyncLoopGroup:
351
393
  def stop(self) -> None:
352
394
  self._stop_requested = True
353
395
 
396
+ @property
397
+ def shared_state(self) -> dict[str, Any]:
398
+ """Return a copy of the current shared execution state."""
399
+ return dict(self._state)
400
+
401
+ def inject_state(self, state: dict[str, Any], *, recursive: bool = False) -> None:
402
+ """Merge external key-value pairs into this group's shared state.
403
+
404
+ Existing keys are NOT overwritten (uses setdefault semantics).
405
+
406
+ Args:
407
+ state: Key-value pairs to inject.
408
+ recursive: If True, also inject into nested sub-groups.
409
+ """
410
+ for k, v in state.items():
411
+ self._state.setdefault(k, v)
412
+ if recursive:
413
+ for agent, _ in self._agents:
414
+ if hasattr(agent, "inject_state"):
415
+ agent.inject_state(state, recursive=True)
416
+
354
417
  async def run(self, prompt: str = "") -> GroupResult:
355
418
  """Execute the loop (async)."""
356
419
  self._stop_requested = False
prompture/discovery.py CHANGED
@@ -10,6 +10,7 @@ from typing import Any, overload
10
10
  import requests
11
11
 
12
12
  from .drivers import (
13
+ AirLLMDriver,
13
14
  AzureDriver,
14
15
  ClaudeDriver,
15
16
  GoogleDriver,
@@ -17,9 +18,12 @@ from .drivers import (
17
18
  GroqDriver,
18
19
  LMStudioDriver,
19
20
  LocalHTTPDriver,
21
+ ModelScopeDriver,
22
+ MoonshotDriver,
20
23
  OllamaDriver,
21
24
  OpenAIDriver,
22
25
  OpenRouterDriver,
26
+ ZaiDriver,
23
27
  )
24
28
  from .settings import settings
25
29
 
@@ -71,6 +75,10 @@ def get_available_models(
71
75
  "ollama": OllamaDriver,
72
76
  "lmstudio": LMStudioDriver,
73
77
  "local_http": LocalHTTPDriver,
78
+ "moonshot": MoonshotDriver,
79
+ "zai": ZaiDriver,
80
+ "modelscope": ModelScopeDriver,
81
+ "airllm": AirLLMDriver,
74
82
  }
75
83
 
76
84
  for provider, driver_cls in provider_classes.items():
@@ -102,6 +110,18 @@ def get_available_models(
102
110
  elif provider == "grok":
103
111
  if settings.grok_api_key or os.getenv("GROK_API_KEY"):
104
112
  is_configured = True
113
+ elif provider == "moonshot":
114
+ if settings.moonshot_api_key or os.getenv("MOONSHOT_API_KEY"):
115
+ is_configured = True
116
+ elif provider == "zai":
117
+ if settings.zhipu_api_key or os.getenv("ZHIPU_API_KEY"):
118
+ is_configured = True
119
+ elif provider == "modelscope":
120
+ if settings.modelscope_api_key or os.getenv("MODELSCOPE_API_KEY"):
121
+ is_configured = True
122
+ elif provider == "airllm":
123
+ # AirLLM runs locally, always considered configured
124
+ is_configured = True
105
125
  elif (
106
126
  provider == "ollama"
107
127
  or provider == "lmstudio"
prompture/groups.py CHANGED
@@ -114,6 +114,27 @@ class SequentialGroup:
114
114
  """Request graceful shutdown after the current agent finishes."""
115
115
  self._stop_requested = True
116
116
 
117
+ @property
118
+ def shared_state(self) -> dict[str, Any]:
119
+ """Return a copy of the current shared execution state."""
120
+ return dict(self._state)
121
+
122
+ def inject_state(self, state: dict[str, Any], *, recursive: bool = False) -> None:
123
+ """Merge external key-value pairs into this group's shared state.
124
+
125
+ Existing keys are NOT overwritten (uses setdefault semantics).
126
+
127
+ Args:
128
+ state: Key-value pairs to inject.
129
+ recursive: If True, also inject into nested sub-groups.
130
+ """
131
+ for k, v in state.items():
132
+ self._state.setdefault(k, v)
133
+ if recursive:
134
+ for agent, _ in self._agents:
135
+ if hasattr(agent, "inject_state"):
136
+ agent.inject_state(state, recursive=True)
137
+
117
138
  def save(self, path: str) -> None:
118
139
  """Run and save result to file. Convenience wrapper."""
119
140
  result = self.run()
@@ -267,6 +288,27 @@ class LoopGroup:
267
288
  """Request graceful shutdown."""
268
289
  self._stop_requested = True
269
290
 
291
+ @property
292
+ def shared_state(self) -> dict[str, Any]:
293
+ """Return a copy of the current shared execution state."""
294
+ return dict(self._state)
295
+
296
+ def inject_state(self, state: dict[str, Any], *, recursive: bool = False) -> None:
297
+ """Merge external key-value pairs into this group's shared state.
298
+
299
+ Existing keys are NOT overwritten (uses setdefault semantics).
300
+
301
+ Args:
302
+ state: Key-value pairs to inject.
303
+ recursive: If True, also inject into nested sub-groups.
304
+ """
305
+ for k, v in state.items():
306
+ self._state.setdefault(k, v)
307
+ if recursive:
308
+ for agent, _ in self._agents:
309
+ if hasattr(agent, "inject_state"):
310
+ agent.inject_state(state, recursive=True)
311
+
270
312
  def run(self, prompt: str = "") -> GroupResult:
271
313
  """Execute the loop."""
272
314
  self._stop_requested = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prompture
3
- Version: 0.0.42.dev1
3
+ Version: 0.0.43
4
4
  Summary: Ask LLMs to return structured JSON and run cross-model tests. API-first.
5
5
  Author-email: Juan Denis <juan@vene.co>
6
6
  License-Expression: MIT
@@ -1,23 +1,23 @@
1
1
  prompture/__init__.py,sha256=cJnkefDpiyFbU77juw4tXPdKJQWoJ-c6XBFt2v-e5Q4,7455
2
- prompture/_version.py,sha256=SSM-qShNUjWEfdsxyswrsdNVeXKkZXRlSSnZCvyhXh8,719
2
+ prompture/_version.py,sha256=qJphZkKjg5qeGMzBrtqKwyJZQtcx3oaEh-0t6ejMuVo,706
3
3
  prompture/agent.py,sha256=-8qdo_Lz20GGssCe5B_QPxb5Kct71YtKHh5vZgrSYik,34748
4
4
  prompture/agent_types.py,sha256=Icl16PQI-ThGLMFCU43adtQA6cqETbsPn4KssKBI4xc,4664
5
5
  prompture/async_agent.py,sha256=_6_IRb-LGzZxGxfPVy43SIWByUoQfN-5XnUWahVP6r8,33110
6
6
  prompture/async_conversation.py,sha256=m9sdKBu1wxo5veGwO6g6Zvf1sBzpuxP-mSIEeNKlBjQ,31155
7
7
  prompture/async_core.py,sha256=hbRXLvsBJv3JAnUwGZbazsL6x022FrsJU6swmZolgxY,29745
8
8
  prompture/async_driver.py,sha256=4VQ9Q_tI6Ufw6W1CYJ5j8hVtgVdqFGuk6e2tLaSceWE,8581
9
- prompture/async_groups.py,sha256=8B383EF_qI9NzcG9zljLKjIZ_37bpNivvsmfJQoOGRk,19894
9
+ prompture/async_groups.py,sha256=G7d9mM2A-glD6Qd7GjA1YOzxrMty3eX8EaWzFsaS39s,22261
10
10
  prompture/cache.py,sha256=4dfQDMsEZ9JMQDXLOkiugPmmMJQIfKVE8rTAKDH4oL8,14401
11
11
  prompture/callbacks.py,sha256=JPDqWGzPIzv44l54ocmezlYVBnbKPDEEXRrLdluWGAo,1731
12
12
  prompture/cli.py,sha256=tNiIddRmgC1BomjY5O1VVVAwvqHVzF8IHmQrM-cG2wQ,2902
13
13
  prompture/conversation.py,sha256=kBflwh7Qmw1I_jcUGyV36oskdVz4SYDSw_dCjemRRRc,32756
14
14
  prompture/core.py,sha256=5FHwX7fNPwFHMbFCMvV-RH7LpPpTToLAmcyDnKbrN0E,57202
15
15
  prompture/cost_mixin.py,sha256=Qx7gPgPsWgTHiaFeI7q_p9cfe95ccjgN8Mi56d_AVX0,4563
16
- prompture/discovery.py,sha256=EWx2d-LJHmlDpm8dlpOicey6XZdDx70ZEetIlOOIlxw,9464
16
+ prompture/discovery.py,sha256=K-svbO-qJraHinCbFVS64vEo5McWX5pURv26ZMmuL6U,10295
17
17
  prompture/driver.py,sha256=wE7K3vnqeCVT5pEEBP-3uZ6e-YyU6TXtnEKRSB25eOc,10410
18
18
  prompture/field_definitions.py,sha256=PLvxq2ot-ngJ8JbWkkZ-XLtM1wvjUQ3TL01vSEo-a6E,21368
19
19
  prompture/group_types.py,sha256=BxeFV1tI4PTH3xPOie7q3-35ivkTdB9lJUPLH0kPH7A,4731
20
- prompture/groups.py,sha256=q9lpD57VWw6iQgK9S0nLVidItJZmusJkmpblM4EX9Sc,18349
20
+ prompture/groups.py,sha256=9lMJBNOmlzRm2qmmwQLXAySsR4NF_oIUCBA6gbxr9cU,19927
21
21
  prompture/image.py,sha256=3uBxC6blXRNyY5KAJ5MkG6ow8KGAslX8WxM8Is8S8cw,5620
22
22
  prompture/ledger.py,sha256=2iXkd9PWiM9WpRCxvnHG1-nwh_IM4mCbxjF4LE92Gzs,8576
23
23
  prompture/logging.py,sha256=SkFO26_56Zai05vW8kTq3jvJudfLG2ipI5qNHaXKH3g,2574
@@ -76,9 +76,9 @@ prompture/scaffold/templates/env.example.j2,sha256=eESKr1KWgyrczO6d-nwAhQwSpf_G-
76
76
  prompture/scaffold/templates/main.py.j2,sha256=TEgc5OvsZOEX0JthkSW1NI_yLwgoeVN_x97Ibg-vyWY,2632
77
77
  prompture/scaffold/templates/models.py.j2,sha256=JrZ99GCVK6TKWapskVRSwCssGrTu5cGZ_r46fOhY2GE,858
78
78
  prompture/scaffold/templates/requirements.txt.j2,sha256=m3S5fi1hq9KG9l_9j317rjwWww0a43WMKd8VnUWv2A4,102
79
- prompture-0.0.42.dev1.dist-info/licenses/LICENSE,sha256=0HgDepH7aaHNFhHF-iXuW6_GqDfYPnVkjtiCAZ4yS8I,1060
80
- prompture-0.0.42.dev1.dist-info/METADATA,sha256=8IPzdovJ1OSR92U6_J5AFOxJbEYBXs-NZ-NN451iGJU,10842
81
- prompture-0.0.42.dev1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
82
- prompture-0.0.42.dev1.dist-info/entry_points.txt,sha256=AFPG3lJR86g4IJMoWQUW5Ph7G6MLNWG3A2u2Tp9zkp8,48
83
- prompture-0.0.42.dev1.dist-info/top_level.txt,sha256=to86zq_kjfdoLeAxQNr420UWqT0WzkKoZ509J7Qr2t4,10
84
- prompture-0.0.42.dev1.dist-info/RECORD,,
79
+ prompture-0.0.43.dist-info/licenses/LICENSE,sha256=0HgDepH7aaHNFhHF-iXuW6_GqDfYPnVkjtiCAZ4yS8I,1060
80
+ prompture-0.0.43.dist-info/METADATA,sha256=fqgAi4_SNDUounCogVib3kuZUmqqhqOCQ2UANXomj9k,10837
81
+ prompture-0.0.43.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
82
+ prompture-0.0.43.dist-info/entry_points.txt,sha256=AFPG3lJR86g4IJMoWQUW5Ph7G6MLNWG3A2u2Tp9zkp8,48
83
+ prompture-0.0.43.dist-info/top_level.txt,sha256=to86zq_kjfdoLeAxQNr420UWqT0WzkKoZ509J7Qr2t4,10
84
+ prompture-0.0.43.dist-info/RECORD,,