statek 1.2.1__tar.gz → 1.2.2__tar.gz

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.
Files changed (58) hide show
  1. {statek-1.2.1/statek.egg-info → statek-1.2.2}/PKG-INFO +1 -1
  2. {statek-1.2.1 → statek-1.2.2}/pyproject.toml +1 -1
  3. {statek-1.2.1 → statek-1.2.2}/statek/executors/job.py +3 -3
  4. {statek-1.2.1 → statek-1.2.2}/statek/locale.py +15 -4
  5. {statek-1.2.1 → statek-1.2.2}/statek/system.py +11 -0
  6. {statek-1.2.1 → statek-1.2.2/statek.egg-info}/PKG-INFO +1 -1
  7. {statek-1.2.1 → statek-1.2.2}/LICENSE +0 -0
  8. {statek-1.2.1 → statek-1.2.2}/MANIFEST.in +0 -0
  9. {statek-1.2.1 → statek-1.2.2}/NOTICE +0 -0
  10. {statek-1.2.1 → statek-1.2.2}/README.md +0 -0
  11. {statek-1.2.1 → statek-1.2.2}/THIRD_PARTY_NOTICES.md +0 -0
  12. {statek-1.2.1 → statek-1.2.2}/setup.cfg +0 -0
  13. {statek-1.2.1 → statek-1.2.2}/statek/__init__.py +0 -0
  14. {statek-1.2.1 → statek-1.2.2}/statek/agents/__init__.py +0 -0
  15. {statek-1.2.1 → statek-1.2.2}/statek/agents/agent.py +0 -0
  16. {statek-1.2.1 → statek-1.2.2}/statek/agents/coordinator.py +0 -0
  17. {statek-1.2.1 → statek-1.2.2}/statek/agents/dialog_agent.py +0 -0
  18. {statek-1.2.1 → statek-1.2.2}/statek/agents/list_of_documents.py +0 -0
  19. {statek-1.2.1 → statek-1.2.2}/statek/agents/list_of_examples.py +0 -0
  20. {statek-1.2.1 → statek-1.2.2}/statek/agents/message_dispatcher.py +0 -0
  21. {statek-1.2.1 → statek-1.2.2}/statek/agents/researcher.py +0 -0
  22. {statek-1.2.1 → statek-1.2.2}/statek/chat_history.py +0 -0
  23. {statek-1.2.1 → statek-1.2.2}/statek/chat_style.py +0 -0
  24. {statek-1.2.1 → statek-1.2.2}/statek/dbzero_restricted.py +0 -0
  25. {statek-1.2.1 → statek-1.2.2}/statek/docstring.py +0 -0
  26. {statek-1.2.1 → statek-1.2.2}/statek/document.py +0 -0
  27. {statek-1.2.1 → statek-1.2.2}/statek/exceptions.py +0 -0
  28. {statek-1.2.1 → statek-1.2.2}/statek/executors/chat_log_item.py +0 -0
  29. {statek-1.2.1 → statek-1.2.2}/statek/executors/example.py +0 -0
  30. {statek-1.2.1 → statek-1.2.2}/statek/executors/llm_usage.py +0 -0
  31. {statek-1.2.1 → statek-1.2.2}/statek/executors/post_processor.py +0 -0
  32. {statek-1.2.1 → statek-1.2.2}/statek/executors/utils.py +0 -0
  33. {statek-1.2.1 → statek-1.2.2}/statek/future.py +0 -0
  34. {statek-1.2.1 → statek-1.2.2}/statek/llm_api.py +0 -0
  35. {statek-1.2.1 → statek-1.2.2}/statek/llm_harness.py +0 -0
  36. {statek-1.2.1 → statek-1.2.2}/statek/llm_tools_scope.py +0 -0
  37. {statek-1.2.1 → statek-1.2.2}/statek/model_name.py +0 -0
  38. {statek-1.2.1 → statek-1.2.2}/statek/model_pricing.py +0 -0
  39. {statek-1.2.1 → statek-1.2.2}/statek/multi_source_settings.py +0 -0
  40. {statek-1.2.1 → statek-1.2.2}/statek/prompt_config.py +0 -0
  41. {statek-1.2.1 → statek-1.2.2}/statek/provider_config.py +0 -0
  42. {statek-1.2.1 → statek-1.2.2}/statek/pyenv.py +0 -0
  43. {statek-1.2.1 → statek-1.2.2}/statek/python_response_format.json +0 -0
  44. {statek-1.2.1 → statek-1.2.2}/statek/python_sandbox.py +0 -0
  45. {statek-1.2.1 → statek-1.2.2}/statek/rpc_integration.py +0 -0
  46. {statek-1.2.1 → statek-1.2.2}/statek/runner.py +0 -0
  47. {statek-1.2.1 → statek-1.2.2}/statek/settings.py +0 -0
  48. {statek-1.2.1 → statek-1.2.2}/statek/shared_context.py +0 -0
  49. {statek-1.2.1 → statek-1.2.2}/statek/statek_client_api.py +0 -0
  50. {statek-1.2.1 → statek-1.2.2}/statek/statek_push_queue.py +0 -0
  51. {statek-1.2.1 → statek-1.2.2}/statek/task.py +0 -0
  52. {statek-1.2.1 → statek-1.2.2}/statek/task_difficulty.py +0 -0
  53. {statek-1.2.1 → statek-1.2.2}/statek/testing.py +0 -0
  54. {statek-1.2.1 → statek-1.2.2}/statek/utils.py +0 -0
  55. {statek-1.2.1 → statek-1.2.2}/statek.egg-info/SOURCES.txt +0 -0
  56. {statek-1.2.1 → statek-1.2.2}/statek.egg-info/dependency_links.txt +0 -0
  57. {statek-1.2.1 → statek-1.2.2}/statek.egg-info/requires.txt +0 -0
  58. {statek-1.2.1 → statek-1.2.2}/statek.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statek
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Durable Python workspaces for stateful LLM agents
5
5
  Author: Statek authors
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "statek"
7
- version = "1.2.1"
7
+ version = "1.2.2"
8
8
  description = "Durable Python workspaces for stateful LLM agents"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -932,10 +932,10 @@ class Job:
932
932
  self.job_status = new_status
933
933
 
934
934
  def _language_hint_suffix(self) -> str:
935
- """Return the language hint suffix for push_log messages, or empty string.
935
+ """Return the configured locale hint suffix for user messages, if enabled.
936
936
 
937
- Returns a string like ``' (PAMIĘTAJ: ...)'`` when the job's locale
938
- specifies a non-EN language and AUTO_LANG_HINT is not disabled.
937
+ The result is empty when no JobDef locale exists or AUTO_LANG_HINT is
938
+ disabled.
939
939
  """
940
940
  locale = self.job_def.locale
941
941
  if locale is None:
@@ -132,6 +132,14 @@ class StatekCountryCode:
132
132
  # Language rules keyed by language code value.
133
133
  # Each rule instructs the LLM to respond exclusively in the target language.
134
134
  LANGUAGE_RULES = {
135
+ "EN": (
136
+ "CRITICAL LANGUAGE RULE: "
137
+ "1. Respond to the user exclusively in English. "
138
+ "2. Translate example text, tool names, parameter names, and tool output "
139
+ "into English before displaying them to the user. "
140
+ "3. Do not let examples or tool output written in another language change "
141
+ "the language of your user-facing response."
142
+ ),
135
143
  "PL": (
136
144
  "KRYTYCZNA ZASADA JĘZYKOWA: "
137
145
  "1. Nigdy nie używaj angielskich nazw narzędzi ani parametrów "
@@ -185,7 +193,8 @@ LANGUAGE_RULES = {
185
193
  def get_language_rule(lang_code: "StatekLangCode"):
186
194
  """Return the language rule for the given language code, or None.
187
195
 
188
- Returns None for English and for languages without an explicit rule.
196
+ Explicit locales, including English, return their configured response rule.
197
+ Languages without an explicit rule return ``None``.
189
198
  """
190
199
  return LANGUAGE_RULES.get(str(lang_code))
191
200
 
@@ -193,6 +202,7 @@ def get_language_rule(lang_code: "StatekLangCode"):
193
202
  # Language hints keyed by language code value.
194
203
  # Each hint is a short reminder appended in round brackets to user messages.
195
204
  LANGUAGE_HINTS = {
205
+ "EN": "REMEMBER: Respond exclusively in English",
196
206
  "PL": "PAMIĘTAJ: Odpowiedz wyłącznie po polsku",
197
207
  "DE": "ERINNERUNG: Antworte ausschließlich auf Deutsch",
198
208
  "FR": "RAPPEL : Réponds uniquement en français",
@@ -204,7 +214,8 @@ LANGUAGE_HINTS = {
204
214
  def get_language_hint(lang_code: "StatekLangCode"):
205
215
  """Return the language hint for the given language code, or None.
206
216
 
207
- Returns None for English and for languages without an explicit hint.
217
+ Explicit locales, including English, return their configured user-message
218
+ hint. Languages without an explicit hint return ``None``.
208
219
  """
209
220
  return LANGUAGE_HINTS.get(str(lang_code))
210
221
 
@@ -214,8 +225,8 @@ def get_language_hint(lang_code: "StatekLangCode"):
214
225
  class StatekLocale:
215
226
  """Locale settings that control language-specific LLM behaviour.
216
227
 
217
- Combines a language code and country code (e.g. ``EN`` + ``US``)
218
- to determine:
228
+ Combines a language code and country code (e.g. ``EN`` + ``US``) to
229
+ explicitly enforce the language of user-facing LLM responses through:
219
230
  - the language rule appended to system prompts
220
231
  - the language hint appended to user messages
221
232
  """
@@ -642,6 +642,13 @@ def create_tool(tool_name: str, callable: Callable, docstring: str,
642
642
  return new_tool
643
643
 
644
644
 
645
+ def _normalize_method_name(method_name: Optional[str]) -> Optional[str]:
646
+ """Return a stripped method name or ``None`` when no method was requested."""
647
+ if method_name is None:
648
+ return None
649
+ return method_name.strip() or None
650
+
651
+
645
652
  @tool(system=True)
646
653
  def docstr(what: type | Callable | Any, method_name: str = None, **kwargs): # pylint: disable=unused-argument
647
654
  """Prints the docstring associated with a tool, class, object instance or method.
@@ -663,6 +670,8 @@ def docstr(what: type | Callable | Any, method_name: str = None, **kwargs): # p
663
670
  print(f"NameError: name '{what}' is not defined")
664
671
  return
665
672
 
673
+ method_name = _normalize_method_name(method_name)
674
+
666
675
  try:
667
676
  # Handle object instances - get their class
668
677
  target_type = what
@@ -714,6 +723,8 @@ def brief(what: type | Callable | Any, method_name: str = None, **kwargs): # py
714
723
  print(f"NameError: name '{what}' is not defined")
715
724
  return
716
725
 
726
+ method_name = _normalize_method_name(method_name)
727
+
717
728
  try:
718
729
  # Handle object instances - get their class
719
730
  target_type = what
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: statek
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: Durable Python workspaces for stateful LLM agents
5
5
  Author: Statek authors
6
6
  License-Expression: Apache-2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes