ommlds 0.0.0.dev449__py3-none-any.whl → 0.0.0.dev451__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.

Potentially problematic release.


This version of ommlds might be problematic. Click here for more details.

Files changed (67) hide show
  1. ommlds/.omlish-manifests.json +3 -3
  2. ommlds/backends/anthropic/protocol/_marshal.py +1 -1
  3. ommlds/backends/anthropic/protocol/sse/_marshal.py +1 -1
  4. ommlds/backends/anthropic/protocol/sse/assemble.py +1 -1
  5. ommlds/backends/anthropic/protocol/types.py +30 -9
  6. ommlds/backends/google/protocol/__init__.py +3 -0
  7. ommlds/backends/google/protocol/_marshal.py +16 -0
  8. ommlds/backends/google/protocol/types.py +303 -76
  9. ommlds/backends/mlx/generation.py +1 -1
  10. ommlds/backends/openai/protocol/_marshal.py +1 -1
  11. ommlds/cli/main.py +29 -8
  12. ommlds/cli/sessions/chat/code.py +124 -0
  13. ommlds/cli/sessions/chat/interactive.py +2 -5
  14. ommlds/cli/sessions/chat/printing.py +5 -4
  15. ommlds/cli/sessions/chat/prompt.py +2 -2
  16. ommlds/cli/sessions/chat/state.py +1 -0
  17. ommlds/cli/sessions/chat/tools.py +3 -5
  18. ommlds/cli/tools/config.py +2 -1
  19. ommlds/cli/tools/inject.py +13 -3
  20. ommlds/minichain/__init__.py +12 -0
  21. ommlds/minichain/_marshal.py +39 -0
  22. ommlds/minichain/backends/impls/anthropic/chat.py +78 -10
  23. ommlds/minichain/backends/impls/google/chat.py +95 -12
  24. ommlds/minichain/backends/impls/google/tools.py +149 -0
  25. ommlds/minichain/chat/_marshal.py +1 -1
  26. ommlds/minichain/content/_marshal.py +24 -3
  27. ommlds/minichain/content/json.py +13 -0
  28. ommlds/minichain/content/materialize.py +13 -20
  29. ommlds/minichain/content/prepare.py +4 -0
  30. ommlds/minichain/json.py +20 -0
  31. ommlds/minichain/lib/code/prompts.py +6 -0
  32. ommlds/minichain/lib/fs/context.py +18 -4
  33. ommlds/minichain/lib/fs/errors.py +6 -0
  34. ommlds/minichain/lib/fs/tools/edit.py +104 -0
  35. ommlds/minichain/lib/fs/{catalog → tools}/ls.py +3 -3
  36. ommlds/minichain/lib/fs/{catalog → tools}/read.py +6 -6
  37. ommlds/minichain/lib/fs/tools/recursivels/__init__.py +0 -0
  38. ommlds/minichain/lib/fs/{catalog → tools}/recursivels/execution.py +2 -2
  39. ommlds/minichain/lib/todo/__init__.py +0 -0
  40. ommlds/minichain/lib/todo/context.py +54 -0
  41. ommlds/minichain/lib/todo/tools/__init__.py +0 -0
  42. ommlds/minichain/lib/todo/tools/read.py +44 -0
  43. ommlds/minichain/lib/todo/tools/write.py +335 -0
  44. ommlds/minichain/lib/todo/types.py +60 -0
  45. ommlds/minichain/llms/_marshal.py +1 -1
  46. ommlds/minichain/services/_marshal.py +1 -1
  47. ommlds/minichain/tools/_marshal.py +1 -1
  48. ommlds/minichain/tools/execution/catalog.py +2 -1
  49. ommlds/minichain/tools/execution/executors.py +8 -3
  50. ommlds/minichain/tools/execution/reflect.py +43 -5
  51. ommlds/minichain/tools/fns.py +46 -9
  52. ommlds/minichain/tools/jsonschema.py +11 -1
  53. ommlds/minichain/tools/reflect.py +9 -2
  54. ommlds/minichain/tools/types.py +9 -0
  55. ommlds/minichain/utils.py +27 -0
  56. ommlds/minichain/vectors/_marshal.py +1 -1
  57. ommlds/tools/ocr.py +7 -1
  58. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/METADATA +3 -3
  59. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/RECORD +67 -53
  60. /ommlds/minichain/lib/{fs/catalog → code}/__init__.py +0 -0
  61. /ommlds/minichain/lib/fs/{catalog/recursivels → tools}/__init__.py +0 -0
  62. /ommlds/minichain/lib/fs/{catalog → tools}/recursivels/rendering.py +0 -0
  63. /ommlds/minichain/lib/fs/{catalog → tools}/recursivels/running.py +0 -0
  64. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/WHEEL +0 -0
  65. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/entry_points.txt +0 -0
  66. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/licenses/LICENSE +0 -0
  67. {ommlds-0.0.0.dev449.dist-info → ommlds-0.0.0.dev451.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,7 @@
18
18
  "module": ".minichain.backends.impls.anthropic.chat",
19
19
  "attr": null,
20
20
  "file": "ommlds/minichain/backends/impls/anthropic/chat.py",
21
- "line": 30,
21
+ "line": 37,
22
22
  "value": {
23
23
  "!.minichain.registries.manifests.RegistryManifest": {
24
24
  "module": "ommlds.minichain.backends.impls.anthropic.chat",
@@ -96,7 +96,7 @@
96
96
  "module": ".minichain.backends.impls.google.chat",
97
97
  "attr": null,
98
98
  "file": "ommlds/minichain/backends/impls/google/chat.py",
99
- "line": 29,
99
+ "line": 34,
100
100
  "value": {
101
101
  "!.minichain.registries.manifests.RegistryManifest": {
102
102
  "module": "ommlds.minichain.backends.impls.google.chat",
@@ -606,7 +606,7 @@
606
606
  "module": ".tools.ocr",
607
607
  "attr": "_CLI_MODULE",
608
608
  "file": "ommlds/tools/ocr.py",
609
- "line": 83,
609
+ "line": 89,
610
610
  "value": {
611
611
  "!omdev.cli.types.CliModule": {
612
612
  "name": "ocr",
@@ -8,7 +8,7 @@ from .types import Content
8
8
 
9
9
 
10
10
  @lang.static_init
11
- def _install_standard_marshalling() -> None:
11
+ def _install_standard_marshaling() -> None:
12
12
  for root_cls in [
13
13
  Content,
14
14
  Content.CacheControl,
@@ -8,7 +8,7 @@ from .events import AnthropicSseDecoderEvents
8
8
 
9
9
 
10
10
  @lang.static_init
11
- def _install_standard_marshalling() -> None:
11
+ def _install_standard_marshaling() -> None:
12
12
  for root_cls in [
13
13
  AnthropicSseDecoderEvents.Event,
14
14
  AnthropicSseDecoderEvents.ContentBlockStart.ContentBlock,
@@ -76,7 +76,7 @@ class AnthropicSseMessageAssembler(
76
76
  elif isinstance(ae, AnthropicSseDecoderEvents.MessageStop):
77
77
  yield [Message(
78
78
  id=ms.message.id,
79
- role=ms.message.role,
79
+ role=ms.message.role, # type: ignore[arg-type]
80
80
  model=ms.message.model,
81
81
  content=content,
82
82
  stop_reason=dct['stop_reason'],
@@ -1,3 +1,6 @@
1
+ """
2
+ https://docs.claude.com/en/api/messages
3
+ """
1
4
  import typing as ta
2
5
 
3
6
  from omlish import dataclasses as dc
@@ -8,6 +11,22 @@ from omlish import marshal as msh
8
11
  ##
9
12
 
10
13
 
14
+ def _set_class_marshal_options(cls):
15
+ msh.update_object_metadata(
16
+ cls,
17
+ field_defaults=msh.FieldMetadata(
18
+ options=msh.FieldOptions(
19
+ omit_if=lang.is_none,
20
+ ),
21
+ ),
22
+ )
23
+
24
+ return cls
25
+
26
+
27
+ ##
28
+
29
+
11
30
  class Content(lang.Abstract, lang.Sealed):
12
31
  class CacheControl(lang.Abstract, lang.Sealed):
13
32
  """https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching"""
@@ -18,7 +37,7 @@ class Content(lang.Abstract, lang.Sealed):
18
37
 
19
38
 
20
39
  @dc.dataclass(frozen=True)
21
- @msh.update_fields_metadata(['cache_control'], omit_if=lang.is_none)
40
+ @_set_class_marshal_options
22
41
  class Text(Content):
23
42
  text: str
24
43
 
@@ -28,7 +47,7 @@ class Text(Content):
28
47
 
29
48
 
30
49
  @dc.dataclass(frozen=True)
31
- @msh.update_fields_metadata(['cache_control'], omit_if=lang.is_none)
50
+ @_set_class_marshal_options
32
51
  class ToolUse(Content):
33
52
  id: str
34
53
  name: str
@@ -40,6 +59,7 @@ class ToolUse(Content):
40
59
 
41
60
 
42
61
  @dc.dataclass(frozen=True)
62
+ @_set_class_marshal_options
43
63
  class ToolResult(Content):
44
64
  tool_use_id: str
45
65
  content: str
@@ -49,7 +69,7 @@ class ToolResult(Content):
49
69
 
50
70
 
51
71
  @dc.dataclass(frozen=True, kw_only=True)
52
- @msh.update_object_metadata(field_defaults=msh.FieldMetadata(options=msh.FieldOptions(omit_if=lang.is_none)))
72
+ @_set_class_marshal_options
53
73
  class CacheCreation:
54
74
  ephemeral_5m_input_tokens: int | None = None
55
75
  ephemeral_1h_input_tokens: int | None = None
@@ -59,7 +79,7 @@ class CacheCreation:
59
79
 
60
80
 
61
81
  @dc.dataclass(frozen=True, kw_only=True)
62
- @msh.update_object_metadata(field_defaults=msh.FieldMetadata(options=msh.FieldOptions(omit_if=lang.is_none)))
82
+ @_set_class_marshal_options
63
83
  class Usage:
64
84
  input_tokens: int | None = None
65
85
  output_tokens: int | None = None
@@ -75,15 +95,15 @@ class Usage:
75
95
 
76
96
 
77
97
  @dc.dataclass(frozen=True, kw_only=True)
78
- @msh.update_object_metadata(field_defaults=msh.FieldMetadata(options=msh.FieldOptions(omit_if=lang.is_none)))
98
+ @_set_class_marshal_options
79
99
  class Message:
80
100
  id: str | None = None
81
101
 
82
- role: str | None = None
102
+ role: ta.Literal['user', 'assistant']
83
103
 
84
104
  model: str | None = None
85
105
 
86
- content: ta.Sequence[Content] | None = None
106
+ content: str | ta.Sequence[Content] | None = None
87
107
 
88
108
  stop_reason: str | None = None
89
109
  stop_sequence: str | None = None
@@ -95,6 +115,7 @@ class Message:
95
115
 
96
116
 
97
117
  @dc.dataclass(frozen=True)
118
+ @_set_class_marshal_options
98
119
  class ToolSpec:
99
120
  name: str
100
121
  description: str
@@ -105,7 +126,7 @@ class ToolSpec:
105
126
 
106
127
 
107
128
  @dc.dataclass(frozen=True)
108
- @msh.update_object_metadata(field_defaults=msh.FieldMetadata(options=msh.FieldOptions(omit_if=lang.is_none)))
129
+ @_set_class_marshal_options
109
130
  class MessagesRequest:
110
131
  model: str
111
132
 
@@ -113,7 +134,7 @@ class MessagesRequest:
113
134
 
114
135
  _: dc.KW_ONLY
115
136
 
116
- system: ta.Sequence[Content] | None = None
137
+ system: str | ta.Sequence[Content] | None = None
117
138
 
118
139
  tools: ta.Sequence[ToolSpec] | None = None
119
140
 
@@ -0,0 +1,3 @@
1
+ from omlish import marshal as _msh # noqa
2
+
3
+ _msh.register_global_module_import('._marshal', __package__)
@@ -0,0 +1,16 @@
1
+ from omlish import lang
2
+ from omlish import marshal as msh
3
+
4
+ from .types import Value
5
+
6
+
7
+ ##
8
+
9
+
10
+ @lang.static_init
11
+ def _install_standard_marshaling() -> None:
12
+ msh.install_standard_factories(
13
+ *msh.standard_polymorphism_factories(
14
+ msh.polymorphism_from_subclasses(Value),
15
+ ),
16
+ )