@@ -22,6 +22,8 @@ fine-grained control, or building your own inference loops.
2222These three snippets all produce the same result:
2323
2424``` python
25+ # Requires: mellea
26+ # Returns: str
2527import mellea
2628from mellea import start_session
2729from mellea.stdlib import functional as mfuncs
@@ -49,6 +51,8 @@ result, new_ctx = mfuncs.act(instruction, context=ctx, backend=backend)
4951Pass any ` Component ` to ` act() ` . It returns a ` ModelOutputThunk ` :
5052
5153``` python
54+ # Requires: mellea
55+ # Returns: str
5256from mellea import start_session
5357from mellea.stdlib.components import Instruction
5458
@@ -68,6 +72,8 @@ print(str(result))
6872skip the IVR loop — this is what ` chat() ` does internally:
6973
7074``` python
75+ # Requires: mellea
76+ # Returns: str
7177from mellea import start_session
7278from mellea.stdlib.components import Message
7379
@@ -82,6 +88,8 @@ print(str(result))
8288Pass document content directly in a ` Message ` :
8389
8490``` python
91+ # Requires: mellea
92+ # Returns: str
8593from mellea import start_session
8694from mellea.stdlib.components import Message
8795
@@ -106,6 +114,8 @@ For rich document processing (PDFs, tables), see
106114The default is ` RejectionSamplingStrategy(loop_budget=2) ` :
107115
108116``` python
117+ # Requires: mellea
118+ # Returns: SamplingResult
109119from mellea import start_session
110120from mellea.core import Requirement
111121from mellea.stdlib.components import Instruction
@@ -136,6 +146,8 @@ and validation.
136146Pass a Pydantic ` BaseModel ` as the ` format ` parameter for constrained decoding:
137147
138148``` python
149+ # Requires: mellea, pydantic
150+ # Returns: Planet
139151from pydantic import BaseModel
140152from mellea import start_session
141153from mellea.stdlib.components import Instruction
@@ -159,6 +171,8 @@ print(result.value) # A Planet instance
159171> relying on a session to thread them.
160172
161173``` python
174+ # Requires: mellea
175+ # Returns: str
162176from mellea.backends.ollama import OllamaModelBackend
163177from mellea.stdlib import functional as mfuncs
164178from mellea.stdlib.components import Instruction
@@ -185,6 +199,8 @@ simpler.
185199` aact() ` is the async counterpart. Same signature, same return types:
186200
187201``` python
202+ # Requires: mellea
203+ # Returns: None
188204import asyncio
189205from mellea import start_session
190206from mellea.stdlib.components import Instruction
@@ -202,6 +218,8 @@ asyncio.run(main())
202218The functional async version is ` mfuncs.aact() ` :
203219
204220``` python
221+ # Requires: mellea
222+ # Returns: tuple
205223result, new_ctx = await mfuncs.aact(instruction, context = ctx, backend = backend)
206224```
207225
0 commit comments