ommlds 0.0.0.dev502__py3-none-any.whl → 0.0.0.dev504__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.
Files changed (39) hide show
  1. ommlds/.omlish-manifests.json +14 -7
  2. ommlds/backends/anthropic/protocol/_dataclasses.py +16 -16
  3. ommlds/backends/cerebras/_dataclasses.py +42 -42
  4. ommlds/backends/google/protocol/_dataclasses.py +64 -64
  5. ommlds/backends/groq/_dataclasses.py +36 -36
  6. ommlds/backends/ollama/_dataclasses.py +28 -28
  7. ommlds/backends/openai/protocol/_dataclasses.py +88 -88
  8. ommlds/backends/tavily/_dataclasses.py +16 -16
  9. ommlds/cli/_dataclasses.py +64 -114
  10. ommlds/cli/backends/inject.py +20 -0
  11. ommlds/cli/backends/meta.py +47 -0
  12. ommlds/cli/sessions/chat/drivers/ai/tools.py +3 -7
  13. ommlds/cli/sessions/chat/facades/commands/base.py +1 -1
  14. ommlds/minichain/__init__.py +38 -4
  15. ommlds/minichain/_dataclasses.py +452 -289
  16. ommlds/minichain/backends/impls/anthropic/stream.py +1 -1
  17. ommlds/minichain/backends/impls/cerebras/names.py +15 -0
  18. ommlds/minichain/backends/impls/cerebras/stream.py +39 -52
  19. ommlds/minichain/backends/impls/google/chat.py +11 -82
  20. ommlds/minichain/backends/impls/google/protocol.py +105 -0
  21. ommlds/minichain/backends/impls/google/stream.py +49 -132
  22. ommlds/minichain/backends/impls/groq/stream.py +40 -53
  23. ommlds/minichain/backends/impls/ollama/chat.py +1 -1
  24. ommlds/minichain/backends/impls/openai/format.py +1 -0
  25. ommlds/minichain/backends/impls/openai/stream.py +40 -55
  26. ommlds/minichain/http/__init__.py +0 -0
  27. ommlds/minichain/http/stream.py +195 -0
  28. ommlds/minichain/resources.py +22 -1
  29. ommlds/minichain/stream/services.py +24 -1
  30. ommlds/minichain/wrappers/firstinwins.py +1 -1
  31. ommlds/minichain/wrappers/instrument.py +1 -1
  32. ommlds/minichain/wrappers/retry.py +34 -13
  33. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/METADATA +4 -4
  34. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/RECORD +38 -36
  35. ommlds/minichain/stream/wrap.py +0 -62
  36. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/WHEEL +0 -0
  37. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/entry_points.txt +0 -0
  38. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/licenses/LICENSE +0 -0
  39. {ommlds-0.0.0.dev502.dist-info → ommlds-0.0.0.dev504.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ from .types import BackendProvider
6
6
 
7
7
 
8
8
  ServiceT = ta.TypeVar('ServiceT', bound=mc.Service)
9
+ StreamServiceT = ta.TypeVar('StreamServiceT', bound=mc.Service)
9
10
 
10
11
 
11
12
  ##
@@ -33,3 +34,49 @@ class FirstInWinsBackendProvider(BackendProvider[ServiceT]):
33
34
  yield AsyncioFirstInWinsService(*svcs)
34
35
 
35
36
  return inner()
37
+
38
+
39
+ ##
40
+
41
+
42
+ class RetryBackendProvider(BackendProvider):
43
+ def __init__(
44
+ self,
45
+ backend_provider: BackendProvider,
46
+ ) -> None:
47
+ super().__init__()
48
+
49
+ self._backend_provider = backend_provider
50
+
51
+ def provide_backend(self) -> ta.AsyncContextManager:
52
+ @contextlib.asynccontextmanager
53
+ async def inner():
54
+ async with contextlib.AsyncExitStack() as aes:
55
+ yield mc.RetryService(
56
+ await aes.enter_async_context(self._backend_provider.provide_backend()),
57
+ )
58
+
59
+ return inner()
60
+
61
+
62
+ ##
63
+
64
+
65
+ class RetryStreamBackendProvider(BackendProvider):
66
+ def __init__(
67
+ self,
68
+ backend_provider: BackendProvider,
69
+ ) -> None:
70
+ super().__init__()
71
+
72
+ self._backend_provider = backend_provider
73
+
74
+ def provide_backend(self) -> ta.AsyncContextManager:
75
+ @contextlib.asynccontextmanager
76
+ async def inner():
77
+ async with contextlib.AsyncExitStack() as aes:
78
+ yield mc.RetryStreamService(
79
+ await aes.enter_async_context(self._backend_provider.provide_backend()),
80
+ )
81
+
82
+ return inner()
@@ -24,17 +24,13 @@ class ToolExecutingAiChatGenerator(AiChatGenerator):
24
24
  while True:
25
25
  new = await self._wrapped.get_next_ai_messages([*chat, *out])
26
26
 
27
- out.extend(new)
28
-
29
27
  cont = False
30
28
 
31
29
  for msg in new:
30
+ out.append(msg)
31
+
32
32
  if isinstance(msg, mc.ToolUseMessage):
33
- trm = await self._executor.execute_tool_use(
34
- msg.tu,
35
- # fs_tool_context,
36
- # todo_tool_context, # noqa
37
- )
33
+ trm = await self._executor.execute_tool_use(msg.tu)
38
34
 
39
35
  out.append(trm)
40
36
 
@@ -13,7 +13,7 @@ class CommandError(Exception):
13
13
  pass
14
14
 
15
15
 
16
- @dc.dataclass(frozen=True)
16
+ @dc.dataclass()
17
17
  class ArgsCommandError(CommandError):
18
18
  command: 'Command'
19
19
  argv: ta.Sequence[str]
@@ -457,10 +457,6 @@ with _lang.auto_proxy_init(
457
457
  new_stream_response,
458
458
  )
459
459
 
460
- from .stream.wrap import ( # noqa
461
- WrappedStreamService,
462
- )
463
-
464
460
  ##
465
461
 
466
462
  from .tools.execution.catalog import ( # noqa
@@ -603,6 +599,44 @@ with _lang.auto_proxy_init(
603
599
 
604
600
  ##
605
601
 
602
+ from .wrappers.retry import ( # noqa
603
+ AnyRetryService,
604
+
605
+ RetryServiceMaxRetriesExceededError,
606
+ RetryServiceOutput,
607
+
608
+ RetryService,
609
+
610
+ RetryStreamService,
611
+ )
612
+
613
+ from .wrappers.services import ( # noqa
614
+ WrappedRequestV,
615
+ WrappedOptionT,
616
+ WrappedResponseV,
617
+ WrappedOutputT,
618
+ WrappedRequest,
619
+ WrappedResponse,
620
+ WrappedService,
621
+
622
+ WrapperService,
623
+ MultiWrapperService,
624
+
625
+ wrap_service,
626
+ )
627
+
628
+ from .wrappers.stream import ( # noqa
629
+ WrappedStreamOutputT,
630
+ WrappedStreamOptions,
631
+ WrappedStreamRequest,
632
+ WrappedStreamResponse,
633
+ WrappedStreamService,
634
+
635
+ WrapperStreamService,
636
+ )
637
+
638
+ ##
639
+
606
640
  from .completion import ( # noqa
607
641
  CompletionOption,
608
642
  CompletionOptions,