PageSourceSearch

https://mirascope.com/assets/responses-tXcq-qTs.js

js mirascope.com collected 2026-10-03 23:00:39 UTC 107,507 bytes, 3,325 lines download raw bytes

1const n={frontmatter:{title:"responses",description:"API documentation for responses"},tableOfContents:[{id:"responses",content:"responses",level:1},{id:"any-response",content:"[Attribute] AnyResponse",level:2},{id:"async-chunk-iterator",content:"[Attribute] AsyncChunkIterator",level:2},{id:"async-context-response",content:"[Class] AsyncContextResponse",level:2},{id:"mirascope-llm-responses-response--async-context-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-response--async-context-response-resume",content:"[Function] resume",level:2},{id:"async-context-stream-response",content:"[Class] AsyncContextStreamResponse",level:2},{id:"mirascope-llm-responses-stream_response--async-context-stream-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-stream_response--async-context-stream-response-resume",content:"[Function] resume",level:2},{id:"async-response",content:"[Class] AsyncResponse",level:2},{id:"mirascope-llm-responses-response--async-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-response--async-response-resume",content:"[Function] resume",level:2},{id:"async-stream",content:"[Attribute] AsyncStream",level:2},{id:"async-stream-response",content:"[Class] AsyncStreamResponse",level:2},{id:"mirascope-llm-responses-stream_response--async-stream-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-stream_response--async-stream-response-resume",content:"[Function] resume",level:2},{id:"async-text-stream",content:"[Class] AsyncTextStream",level:2},{id:"mirascope-llm-responses-streams--async-text-stream-collect",content:"[Function] collect",level:2},{id:"async-thought-stream",content:"[Class] AsyncThoughtStream",level:2},{id:"mirascope-llm-responses-streams--async-thought-stream-collect",content:"[Function] collect",level:2},{id:"async-tool-call-stream",content:"[Class] AsyncToolCallStream",level:2},{id:"mirascope-llm-responses-streams--async-tool-call-stream-collect",content:"[Function] collect",level:2},{id:"chunk-iterator",content:"[Attribute] ChunkIterator",level:2},{id:"context-response",content:"[Class] ContextResponse",level:2},{id:"mirascope-llm-responses-response--context-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-response--context-response-resume",content:"[Function] resume",level:2},{id:"context-stream-response",content:"[Class] ContextStreamResponse",level:2},{id:"mirascope-llm-responses-stream_response--context-stream-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-stream_response--context-stream-response-resume",content:"[Function] resume",level:2},{id:"finish-reason",content:"[Class] FinishReason",level:2},{id:"finish-reason-chunk",content:"[Class] FinishReasonChunk",level:2},{id:"raw-message-chunk",content:"[Class] RawMessageChunk",level:2},{id:"raw-stream-event-chunk",content:"[Class] RawStreamEventChunk",level:2},{id:"response",content:"[Class] Response",level:2},{id:"mirascope-llm-responses-response--response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-response--response-resume",content:"[Function] resume",level:2},{id:"response-t",content:"[Attribute] ResponseT",level:2},{id:"root-response",content:"[Class] RootResponse",level:2},{id:"mirascope-llm-responses-root_response--root-response-parse",content:"[Function] parse",level:2},{id:"mirascope-llm-responses-root_response--root-response-text",content:"[Function] text",level:2},{id:"mirascope-llm-responses-root_response--root-response-pretty",content:"[Function] pretty",level:2},{id:"stream",content:"[Attribute] Stream",level:2},{id:"stream-response",content:"[Class] StreamResponse",level:2},{id:"mirascope-llm-responses-stream_response--stream-response-execute_tools",content:"[Function] execute_tools",level:2},{id:"mirascope-llm-responses-stream_response--stream-response-resume",content:"[Function] resume",level:2},{id:"stream-response-chunk",content:"[Attribute] StreamResponseChunk",level:2},{id:"stream-response-t",content:"[Attribute] StreamResponseT",level:2},{id:"text-stream",content:"[Class] TextStream",level:2},{id:"mirascope-llm-responses-streams--text-stream-collect",content:"[Function] collect",level:2},{id:"thought-stream",content:"[Class] ThoughtStream",level:2},{id:"mirascope-llm-responses-streams--thought-stream-collect",content:"[Function] collect",level:2},{id:"tool-call-stream",content:"[Class] ToolCallStream",level:2},{id:"mirascope-llm-responses-streams--tool-call-stream-collect",content:"[Function] collect",level:2},{id:"usage",content:"[Class] Usage",level:2},{id:"usage-delta-chunk",content:"[Class] UsageDeltaChunk",level:2}],content:`# responses
2
3## <ApiType type="Attribute" slug="any-response" symbolName="AnyResponse" /> AnyResponse
4
5**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
6
7
8## <ApiType type="Attribute" slug="async-chunk-iterator" symbolName="AsyncChunkIterator" /> AsyncChunkIterator
9
10**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
11
12Asynchronous iterator yielding chunks with raw data.
13
14
15## <ApiType type="Class" slug="async-context-response" symbolName="AsyncContextResponse" /> AsyncContextResponse
16
17The response generated by an LLM from an async context call.
18
19**Bases:** 
20<TypeLink type={{"type_str": "BaseResponse[AsyncContextToolkit[DepsT], FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseResponse", "description": null, "kind": "simple", "symbol_name": "BaseResponse", "doc_url": null}, "parameters": [{"type_str": "AsyncContextToolkit[DepsT]", "description": null, "kind": "generic", "base_type": {"type_str": "AsyncContextToolkit", "description": null, "kind": "simple", "symbol_name": "AsyncContextToolkit", "doc_url": "/docs/api/llm/tools#async-context-toolkit"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}], "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[DepsT, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
21
22## <ApiType type="Function" slug="mirascope-llm-responses-response--async-context-response-execute_tools" symbolName="execute_tools" /> execute_tools
23
24Execute and return all of the tool calls in the response.
25
26<ParametersTable
27  parameters={[
28  {
29    "name": "self",
30    "type_info": {
31      "type_str": "Any",
32      "description": null,
33      "kind": "simple",
34      "symbol_name": null,
35      "doc_url": null
36    }
37  },
38  {
39    "name": "ctx",
40    "type_info": {
41      "type_str": "Context[DepsT]",
42      "description": null,
43      "kind": "generic",
44      "base_type": {
45        "type_str": "Context",
46        "description": null,
47        "kind": "simple",
48        "symbol_name": "Context",
49        "doc_url": null
50      },
51      "parameters": [
52        {
53          "type_str": "DepsT",
54          "description": null,
55          "kind": "simple",
56          "symbol_name": "DepsT",
57          "doc_url": null
58        }
59      ],
60      "doc_url": null
61    },
62    "description": "A \`Context\` with the required deps type."
63  }
64]}
65/>
66
67<ReturnTable
68  returnType={{
69  "type_info": {
70    "type_str": "Sequence[ToolOutput[Jsonable]]",
71    "description": null,
72    "kind": "generic",
73    "base_type": {
74      "type_str": "Sequence",
75      "description": null,
76      "kind": "simple",
77      "symbol_name": "Sequence",
78      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
79    },
80    "parameters": [
81      {
82        "type_str": "ToolOutput[Jsonable]",
83        "description": null,
84        "kind": "generic",
85        "base_type": {
86          "type_str": "ToolOutput",
87          "description": null,
88          "kind": "simple",
89          "symbol_name": "ToolOutput",
90          "doc_url": "/docs/api/llm/content#tool-output"
91        },
92        "parameters": [
93          {
94            "type_str": "Jsonable",
95            "description": null,
96            "kind": "simple",
97            "symbol_name": "Jsonable",
98            "doc_url": "/docs/api/llm/types#jsonable"
99          }
100        ],
101        "doc_url": null
102      }
103    ],
104    "doc_url": null
105  },
106  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
107}}
108/>
109
110
111## <ApiType type="Function" slug="mirascope-llm-responses-response--async-context-response-resume" symbolName="resume" /> resume
112
113Generate a new \`AsyncContextResponse\` using this response's messages with additional user content.
114
115Uses this response's tools and format type. Also uses this response's provider,
116model, client, and params, unless the model context manager is being used to
117provide a new LLM as an override.
118
119<ParametersTable
120  parameters={[
121  {
122    "name": "self",
123    "type_info": {
124      "type_str": "Any",
125      "description": null,
126      "kind": "simple",
127      "symbol_name": null,
128      "doc_url": null
129    }
130  },
131  {
132    "name": "ctx",
133    "type_info": {
134      "type_str": "Context[DepsT]",
135      "description": null,
136      "kind": "generic",
137      "base_type": {
138        "type_str": "Context",
139        "description": null,
140        "kind": "simple",
141        "symbol_name": "Context",
142        "doc_url": null
143      },
144      "parameters": [
145        {
146          "type_str": "DepsT",
147          "description": null,
148          "kind": "simple",
149          "symbol_name": "DepsT",
150          "doc_url": null
151        }
152      ],
153      "doc_url": null
154    },
155    "description": "A Context with the required deps type."
156  },
157  {
158    "name": "content",
159    "type_info": {
160      "type_str": "UserContent",
161      "description": null,
162      "kind": "simple",
163      "symbol_name": "UserContent",
164      "doc_url": "/docs/api/llm/messages#user-content"
165    },
166    "description": "The new user message content to append to the message history."
167  }
168]}
169/>
170
171<ReturnTable
172  returnType={{
173  "type_info": {
174    "type_str": "AsyncContextResponse[DepsT] | AsyncContextResponse[DepsT, FormattableT]",
175    "description": null,
176    "kind": "union",
177    "base_type": {
178      "type_str": "Union",
179      "description": null,
180      "kind": "simple",
181      "symbol_name": "Union",
182      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
183    },
184    "parameters": [
185      {
186        "type_str": "AsyncContextResponse[DepsT]",
187        "description": null,
188        "kind": "generic",
189        "base_type": {
190          "type_str": "AsyncContextResponse",
191          "description": null,
192          "kind": "simple",
193          "symbol_name": "AsyncContextResponse",
194          "doc_url": "/docs/api/llm/responses#async-context-response"
195        },
196        "parameters": [
197          {
198            "type_str": "DepsT",
199            "description": null,
200            "kind": "simple",
201            "symbol_name": "DepsT",
202            "doc_url": null
203          }
204        ],
205        "doc_url": null
206      },
207      {
208        "type_str": "AsyncContextResponse[DepsT, FormattableT]",
209        "description": null,
210        "kind": "generic",
211        "base_type": {
212          "type_str": "AsyncContextResponse",
213          "description": null,
214          "kind": "simple",
215          "symbol_name": "AsyncContextResponse",
216          "doc_url": "/docs/api/llm/responses#async-context-response"
217        },
218        "parameters": [
219          {
220            "type_str": "DepsT",
221            "description": null,
222            "kind": "simple",
223            "symbol_name": "DepsT",
224            "doc_url": null
225          },
226          {
227            "type_str": "FormattableT",
228            "description": null,
229            "kind": "simple",
230            "symbol_name": "FormattableT",
231            "doc_url": "/docs/api/llm/formatting#formattable-t"
232          }
233        ],
234        "doc_url": null
235      }
236    ],
237    "doc_url": null
238  },
239  "description": "A new \`AsyncContextResponse\` instance generated from the extended message history."
240}}
241/>
242
243
244
245## <ApiType type="Class" slug="async-context-stream-response" symbolName="AsyncContextStreamResponse" /> AsyncContextStreamResponse
246
247An \`AsyncContextStreamResponse\` wraps response content from the LLM with a streaming interface.
248
249This class supports iteration to process chunks as they arrive from the model.
250
251Content can be streamed in one of three ways:
252- Via \`.streams()\`, which provides an iterator of streams, where each
253  stream contains chunks of streamed data. The chunks contain \`delta\`s (new content
254  in that particular chunk), and the stream itself accumulates the collected state
255  of all the chunks processed thus far.
256- Via \`.chunk_stream()\` which allows iterating over Mirascope's provider-
257  agnostic chunk representation.
258- Via \`.pretty_stream()\` a helper method which provides all response content
259  as \`str\` deltas. Iterating through \`pretty_stream\` will yield text content and
260  optionally placeholder representations for other content types, but it will still
261  consume the full stream.
262- Via \`.structured_stream()\`, a helper method which provides partial
263  structured outputs from a response (useful when FormatT is set). Iterating through
264  \`structured_stream\` will only yield structured partials, but it will still consume
265  the full stream.
266
267As chunks are consumed, they are collected in-memory on the \`AsyncContextStreamResponse\`, and they
268become available in \`.content\`, \`.messages\`, \`.tool_calls\`, etc. All of the stream
269iterators can be restarted after the stream has been consumed, in which case they
270will yield chunks from memory in the original sequence that came from the LLM. If
271the stream is only partially consumed, a fresh iterator will first iterate through
272in-memory content, and then will continue consuming fresh chunks from the LLM.
273
274In the specific case of text chunks, they are included in the response content as soon
275as they become available, via an \`llm.Text\` part that updates as more deltas come in.
276This enables the behavior where resuming a partially-streamed response will include
277as much text as the model generated.
278
279For other chunks, like \`Thinking\` or \`ToolCall\`, they are only added to response
280content once the corresponding part has fully streamed. This avoids issues like
281adding incomplete tool calls, or thinking blocks missing signatures, to the response.
282
283For each iterator, fully iterating through the iterator will consume the whole
284LLM stream. You can pause stream execution midway by breaking out of the iterator,
285and you can safely resume execution from the same iterator if desired.
286
287**Bases:** 
288<TypeLink type={{"type_str": "BaseAsyncStreamResponse[AsyncContextToolkit[DepsT], FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseAsyncStreamResponse", "description": null, "kind": "simple", "symbol_name": "BaseAsyncStreamResponse", "doc_url": null}, "parameters": [{"type_str": "AsyncContextToolkit[DepsT]", "description": null, "kind": "generic", "base_type": {"type_str": "AsyncContextToolkit", "description": null, "kind": "simple", "symbol_name": "AsyncContextToolkit", "doc_url": "/docs/api/llm/tools#async-context-toolkit"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}], "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[DepsT, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
289
290## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--async-context-stream-response-execute_tools" symbolName="execute_tools" /> execute_tools
291
292Execute and return all of the tool calls in the response.
293
294<ParametersTable
295  parameters={[
296  {
297    "name": "self",
298    "type_info": {
299      "type_str": "Any",
300      "description": null,
301      "kind": "simple",
302      "symbol_name": null,
303      "doc_url": null
304    }
305  },
306  {
307    "name": "ctx",
308    "type_info": {
309      "type_str": "Context[DepsT]",
310      "description": null,
311      "kind": "generic",
312      "base_type": {
313        "type_str": "Context",
314        "description": null,
315        "kind": "simple",
316        "symbol_name": "Context",
317        "doc_url": null
318      },
319      "parameters": [
320        {
321          "type_str": "DepsT",
322          "description": null,
323          "kind": "simple",
324          "symbol_name": "DepsT",
325          "doc_url": null
326        }
327      ],
328      "doc_url": null
329    },
330    "description": "A \`Context\` with the required deps type."
331  }
332]}
333/>
334
335<ReturnTable
336  returnType={{
337  "type_info": {
338    "type_str": "Sequence[ToolOutput[Jsonable]]",
339    "description": null,
340    "kind": "generic",
341    "base_type": {
342      "type_str": "Sequence",
343      "description": null,
344      "kind": "simple",
345      "symbol_name": "Sequence",
346      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
347    },
348    "parameters": [
349      {
350        "type_str": "ToolOutput[Jsonable]",
351        "description": null,
352        "kind": "generic",
353        "base_type": {
354          "type_str": "ToolOutput",
355          "description": null,
356          "kind": "simple",
357          "symbol_name": "ToolOutput",
358          "doc_url": "/docs/api/llm/content#tool-output"
359        },
360        "parameters": [
361          {
362            "type_str": "Jsonable",
363            "description": null,
364            "kind": "simple",
365            "symbol_name": "Jsonable",
366            "doc_url": "/docs/api/llm/types#jsonable"
367          }
368        ],
369        "doc_url": null
370      }
371    ],
372    "doc_url": null
373  },
374  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
375}}
376/>
377
378
379## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--async-context-stream-response-resume" symbolName="resume" /> resume
380
381Generate a new \`AsyncContextStreamResponse\` using this response's messages with additional user content.
382
383Uses this response's tools and format type. Also uses this response's provider,
384model, client, and params, unless the model context manager is being used to
385provide a new LLM as an override.
386
387<ParametersTable
388  parameters={[
389  {
390    "name": "self",
391    "type_info": {
392      "type_str": "Any",
393      "description": null,
394      "kind": "simple",
395      "symbol_name": null,
396      "doc_url": null
397    }
398  },
399  {
400    "name": "ctx",
401    "type_info": {
402      "type_str": "Context[DepsT]",
403      "description": null,
404      "kind": "generic",
405      "base_type": {
406        "type_str": "Context",
407        "description": null,
408        "kind": "simple",
409        "symbol_name": "Context",
410        "doc_url": null
411      },
412      "parameters": [
413        {
414          "type_str": "DepsT",
415          "description": null,
416          "kind": "simple",
417          "symbol_name": "DepsT",
418          "doc_url": null
419        }
420      ],
421      "doc_url": null
422    },
423    "description": "A Context with the required deps type."
424  },
425  {
426    "name": "content",
427    "type_info": {
428      "type_str": "UserContent",
429      "description": null,
430      "kind": "simple",
431      "symbol_name": "UserContent",
432      "doc_url": "/docs/api/llm/messages#user-content"
433    },
434    "description": "The new user message content to append to the message history."
435  }
436]}
437/>
438
439<ReturnTable
440  returnType={{
441  "type_info": {
442    "type_str": "AsyncContextStreamResponse[DepsT] | AsyncContextStreamResponse[DepsT, FormattableT]",
443    "description": null,
444    "kind": "union",
445    "base_type": {
446      "type_str": "Union",
447      "description": null,
448      "kind": "simple",
449      "symbol_name": "Union",
450      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
451    },
452    "parameters": [
453      {
454        "type_str": "AsyncContextStreamResponse[DepsT]",
455        "description": null,
456        "kind": "generic",
457        "base_type": {
458          "type_str": "AsyncContextStreamResponse",
459          "description": null,
460          "kind": "simple",
461          "symbol_name": "AsyncContextStreamResponse",
462          "doc_url": "/docs/api/llm/responses#async-context-stream-response"
463        },
464        "parameters": [
465          {
466            "type_str": "DepsT",
467            "description": null,
468            "kind": "simple",
469            "symbol_name": "DepsT",
470            "doc_url": null
471          }
472        ],
473        "doc_url": null
474      },
475      {
476        "type_str": "AsyncContextStreamResponse[DepsT, FormattableT]",
477        "description": null,
478        "kind": "generic",
479        "base_type": {
480          "type_str": "AsyncContextStreamResponse",
481          "description": null,
482          "kind": "simple",
483          "symbol_name": "AsyncContextStreamResponse",
484          "doc_url": "/docs/api/llm/responses#async-context-stream-response"
485        },
486        "parameters": [
487          {
488            "type_str": "DepsT",
489            "description": null,
490            "kind": "simple",
491            "symbol_name": "DepsT",
492            "doc_url": null
493          },
494          {
495            "type_str": "FormattableT",
496            "description": null,
497            "kind": "simple",
498            "symbol_name": "FormattableT",
499            "doc_url": "/docs/api/llm/formatting#formattable-t"
500          }
501        ],
502        "doc_url": null
503      }
504    ],
505    "doc_url": null
506  },
507  "description": "A new \`AsyncContextStreamResponse\` instance generated from the extended message history."
508}}
509/>
510
511
512
513## <ApiType type="Class" slug="async-response" symbolName="AsyncResponse" /> AsyncResponse
514
515The response generated by an LLM in async mode.
516
517**Bases:** 
518<TypeLink type={{"type_str": "BaseResponse[AsyncToolkit, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseResponse", "description": null, "kind": "simple", "symbol_name": "BaseResponse", "doc_url": null}, "parameters": [{"type_str": "AsyncToolkit", "description": null, "kind": "simple", "symbol_name": "AsyncToolkit", "doc_url": "/docs/api/llm/tools#async-toolkit"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
519
520## <ApiType type="Function" slug="mirascope-llm-responses-response--async-response-execute_tools" symbolName="execute_tools" /> execute_tools
521
522Execute and return all of the tool calls in the response.
523
524<ParametersTable
525  parameters={[
526  {
527    "name": "self",
528    "type_info": {
529      "type_str": "Any",
530      "description": null,
531      "kind": "simple",
532      "symbol_name": null,
533      "doc_url": null
534    }
535  }
536]}
537/>
538
539<ReturnTable
540  returnType={{
541  "type_info": {
542    "type_str": "Sequence[ToolOutput[Jsonable]]",
543    "description": null,
544    "kind": "generic",
545    "base_type": {
546      "type_str": "Sequence",
547      "description": null,
548      "kind": "simple",
549      "symbol_name": "Sequence",
550      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
551    },
552    "parameters": [
553      {
554        "type_str": "ToolOutput[Jsonable]",
555        "description": null,
556        "kind": "generic",
557        "base_type": {
558          "type_str": "ToolOutput",
559          "description": null,
560          "kind": "simple",
561          "symbol_name": "ToolOutput",
562          "doc_url": "/docs/api/llm/content#tool-output"
563        },
564        "parameters": [
565          {
566            "type_str": "Jsonable",
567            "description": null,
568            "kind": "simple",
569            "symbol_name": "Jsonable",
570            "doc_url": "/docs/api/llm/types#jsonable"
571          }
572        ],
573        "doc_url": null
574      }
575    ],
576    "doc_url": null
577  },
578  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
579}}
580/>
581
582
583## <ApiType type="Function" slug="mirascope-llm-responses-response--async-response-resume" symbolName="resume" /> resume
584
585Generate a new \`AsyncResponse\` using this response's messages with additional user content.
586
587Uses this response's tools and format type. Also uses this response's provider,
588model, client, and params, unless the model context manager is being used to
589provide a new LLM as an override.
590
591<ParametersTable
592  parameters={[
593  {
594    "name": "self",
595    "type_info": {
596      "type_str": "Any",
597      "description": null,
598      "kind": "simple",
599      "symbol_name": null,
600      "doc_url": null
601    }
602  },
603  {
604    "name": "content",
605    "type_info": {
606      "type_str": "UserContent",
607      "description": null,
608      "kind": "simple",
609      "symbol_name": "UserContent",
610      "doc_url": "/docs/api/llm/messages#user-content"
611    },
612    "description": "The new user message content to append to the message history."
613  }
614]}
615/>
616
617<ReturnTable
618  returnType={{
619  "type_info": {
620    "type_str": "AsyncResponse | AsyncResponse[FormattableT]",
621    "description": null,
622    "kind": "union",
623    "base_type": {
624      "type_str": "Union",
625      "description": null,
626      "kind": "simple",
627      "symbol_name": "Union",
628      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
629    },
630    "parameters": [
631      {
632        "type_str": "AsyncResponse",
633        "description": null,
634        "kind": "simple",
635        "symbol_name": "AsyncResponse",
636        "doc_url": "/docs/api/llm/responses#async-response"
637      },
638      {
639        "type_str": "AsyncResponse[FormattableT]",
640        "description": null,
641        "kind": "generic",
642        "base_type": {
643          "type_str": "AsyncResponse",
644          "description": null,
645          "kind": "simple",
646          "symbol_name": "AsyncResponse",
647          "doc_url": "/docs/api/llm/responses#async-response"
648        },
649        "parameters": [
650          {
651            "type_str": "FormattableT",
652            "description": null,
653            "kind": "simple",
654            "symbol_name": "FormattableT",
655            "doc_url": "/docs/api/llm/formatting#formattable-t"
656          }
657        ],
658        "doc_url": null
659      }
660    ],
661    "doc_url": null
662  },
663  "description": "A new \`AsyncResponse\` instance generated from the extended message history."
664}}
665/>
666
667
668
669## <ApiType type="Attribute" slug="async-stream" symbolName="AsyncStream" /> AsyncStream
670
671**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
672
673An asynchronous assistant content stream.
674
675
676## <ApiType type="Class" slug="async-stream-response" symbolName="AsyncStreamResponse" /> AsyncStreamResponse
677
678An \`AsyncStreamResponse\` wraps response content from the LLM with a streaming interface.
679
680This class supports iteration to process chunks as they arrive from the model.
681
682Content can be streamed in one of three ways:
683- Via \`.streams()\`, which provides an iterator of streams, where each
684  stream contains chunks of streamed data. The chunks contain \`delta\`s (new content
685  in that particular chunk), and the stream itself accumulates the collected state
686  of all the chunks processed thus far.
687- Via \`.chunk_stream()\` which allows iterating over Mirascope's provider-
688  agnostic chunk representation.
689- Via \`.pretty_stream()\` a helper method which provides all response content
690  as \`str\` deltas. Iterating through \`pretty_stream\` will yield text content and
691  optionally placeholder representations for other content types, but it will still
692  consume the full stream.
693- Via \`.structured_stream()\`, a helper method which provides partial
694  structured outputs from a response (useful when FormatT is set). Iterating through
695  \`structured_stream\` will only yield structured partials, but it will still consume
696  the full stream.
697
698As chunks are consumed, they are collected in-memory on the \`AsyncContextStreamResponse\`, and they
699become available in \`.content\`, \`.messages\`, \`.tool_calls\`, etc. All of the stream
700iterators can be restarted after the stream has been consumed, in which case they
701will yield chunks from memory in the original sequence that came from the LLM. If
702the stream is only partially consumed, a fresh iterator will first iterate through
703in-memory content, and then will continue consuming fresh chunks from the LLM.
704
705In the specific case of text chunks, they are included in the response content as soon
706as they become available, via an \`llm.Text\` part that updates as more deltas come in.
707This enables the behavior where resuming a partially-streamed response will include
708as much text as the model generated.
709
710For other chunks, like \`Thinking\` or \`ToolCall\`, they are only added to response
711content once the corresponding part has fully streamed. This avoids issues like
712adding incomplete tool calls, or thinking blocks missing signatures, to the response.
713
714For each iterator, fully iterating through the iterator will consume the whole
715LLM stream. You can pause stream execution midway by breaking out of the iterator,
716and you can safely resume execution from the same iterator if desired.
717
718**Bases:** 
719<TypeLink type={{"type_str": "BaseAsyncStreamResponse[AsyncToolkit, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseAsyncStreamResponse", "description": null, "kind": "simple", "symbol_name": "BaseAsyncStreamResponse", "doc_url": null}, "parameters": [{"type_str": "AsyncToolkit", "description": null, "kind": "simple", "symbol_name": "AsyncToolkit", "doc_url": "/docs/api/llm/tools#async-toolkit"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
720
721## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--async-stream-response-execute_tools" symbolName="execute_tools" /> execute_tools
722
723Execute and return all of the tool calls in the response.
724
725<ParametersTable
726  parameters={[
727  {
728    "name": "self",
729    "type_info": {
730      "type_str": "Any",
731      "description": null,
732      "kind": "simple",
733      "symbol_name": null,
734      "doc_url": null
735    }
736  }
737]}
738/>
739
740<ReturnTable
741  returnType={{
742  "type_info": {
743    "type_str": "Sequence[ToolOutput[Jsonable]]",
744    "description": null,
745    "kind": "generic",
746    "base_type": {
747      "type_str": "Sequence",
748      "description": null,
749      "kind": "simple",
750      "symbol_name": "Sequence",
751      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
752    },
753    "parameters": [
754      {
755        "type_str": "ToolOutput[Jsonable]",
756        "description": null,
757        "kind": "generic",
758        "base_type": {
759          "type_str": "ToolOutput",
760          "description": null,
761          "kind": "simple",
762          "symbol_name": "ToolOutput",
763          "doc_url": "/docs/api/llm/content#tool-output"
764        },
765        "parameters": [
766          {
767            "type_str": "Jsonable",
768            "description": null,
769            "kind": "simple",
770            "symbol_name": "Jsonable",
771            "doc_url": "/docs/api/llm/types#jsonable"
772          }
773        ],
774        "doc_url": null
775      }
776    ],
777    "doc_url": null
778  },
779  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
780}}
781/>
782
783
784## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--async-stream-response-resume" symbolName="resume" /> resume
785
786Generate a new \`AsyncStreamResponse\` using this response's messages with additional user content.
787
788Uses this response's tools and format type. Also uses this response's provider,
789model, client, and params, unless the model context manager is being used to
790provide a new LLM as an override.
791
792<ParametersTable
793  parameters={[
794  {
795    "name": "self",
796    "type_info": {
797      "type_str": "Any",
798      "description": null,
799      "kind": "simple",
800      "symbol_name": null,
801      "doc_url": null
802    }
803  },
804  {
805    "name": "content",
806    "type_info": {
807      "type_str": "UserContent",
808      "description": null,
809      "kind": "simple",
810      "symbol_name": "UserContent",
811      "doc_url": "/docs/api/llm/messages#user-content"
812    },
813    "description": "The new user message content to append to the message history."
814  }
815]}
816/>
817
818<ReturnTable
819  returnType={{
820  "type_info": {
821    "type_str": "AsyncStreamResponse | AsyncStreamResponse[FormattableT]",
822    "description": null,
823    "kind": "union",
824    "base_type": {
825      "type_str": "Union",
826      "description": null,
827      "kind": "simple",
828      "symbol_name": "Union",
829      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
830    },
831    "parameters": [
832      {
833        "type_str": "AsyncStreamResponse",
834        "description": null,
835        "kind": "simple",
836        "symbol_name": "AsyncStreamResponse",
837        "doc_url": "/docs/api/llm/responses#async-stream-response"
838      },
839      {
840        "type_str": "AsyncStreamResponse[FormattableT]",
841        "description": null,
842        "kind": "generic",
843        "base_type": {
844          "type_str": "AsyncStreamResponse",
845          "description": null,
846          "kind": "simple",
847          "symbol_name": "AsyncStreamResponse",
848          "doc_url": "/docs/api/llm/responses#async-stream-response"
849        },
850        "parameters": [
851          {
852            "type_str": "FormattableT",
853            "description": null,
854            "kind": "simple",
855            "symbol_name": "FormattableT",
856            "doc_url": "/docs/api/llm/formatting#formattable-t"
857          }
858        ],
859        "doc_url": null
860      }
861    ],
862    "doc_url": null
863  },
864  "description": "A new \`AsyncStreamResponse\` instance generated from the extended message history."
865}}
866/>
867
868
869
870## <ApiType type="Class" slug="async-text-stream" symbolName="AsyncTextStream" /> AsyncTextStream
871
872Asynchronous text stream implementation.
873
874**Bases:** 
875<TypeLink type={{"type_str": "BaseAsyncStream[Text, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseAsyncStream", "description": null, "kind": "simple", "symbol_name": "BaseAsyncStream", "doc_url": null}, "parameters": [{"type_str": "Text", "description": null, "kind": "simple", "symbol_name": "Text", "doc_url": "/docs/api/llm/content#text"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
876
877<AttributesTable
878  attributes={[
879  {
880    "name": "type",
881    "type_info": {
882      "type_str": "Literal['async_text_stream']",
883      "description": null,
884      "kind": "generic",
885      "base_type": {
886        "type_str": "Literal",
887        "description": null,
888        "kind": "simple",
889        "symbol_name": "Literal",
890        "doc_url": null
891      },
892      "parameters": [
893        {
894          "type_str": "'async_text_stream'",
895          "description": null,
896          "kind": "simple",
897          "symbol_name": "'async_text_stream'",
898          "doc_url": null
899        }
900      ],
901      "doc_url": null
902    }
903  },
904  {
905    "name": "content_type",
906    "type_info": {
907      "type_str": "Literal['text']",
908      "description": null,
909      "kind": "generic",
910      "base_type": {
911        "type_str": "Literal",
912        "description": null,
913        "kind": "simple",
914        "symbol_name": "Literal",
915        "doc_url": null
916      },
917      "parameters": [
918        {
919          "type_str": "'text'",
920          "description": null,
921          "kind": "simple",
922          "symbol_name": "'text'",
923          "doc_url": null
924        }
925      ],
926      "doc_url": null
927    },
928    "description": "The type of content stored in this stream."
929  },
930  {
931    "name": "partial_text",
932    "type_info": {
933      "type_str": "str",
934      "description": null,
935      "kind": "simple",
936      "symbol_name": "str",
937      "doc_url": null
938    },
939    "description": "The accumulated text content as chunks are received."
940  }
941]}
942/>
943
944## <ApiType type="Function" slug="mirascope-llm-responses-streams--async-text-stream-collect" symbolName="collect" /> collect
945
946Asynchronously collect all chunks and return the final Text content.
947
948<ParametersTable
949  parameters={[
950  {
951    "name": "self",
952    "type_info": {
953      "type_str": "Any",
954      "description": null,
955      "kind": "simple",
956      "symbol_name": null,
957      "doc_url": null
958    }
959  }
960]}
961/>
962
963<ReturnTable
964  returnType={{
965  "type_info": {
966    "type_str": "Text",
967    "description": null,
968    "kind": "simple",
969    "symbol_name": "Text",
970    "doc_url": "/docs/api/llm/content#text"
971  },
972  "description": "The complete text content after consuming all chunks."
973}}
974/>
975
976
977
978## <ApiType type="Class" slug="async-thought-stream" symbolName="AsyncThoughtStream" /> AsyncThoughtStream
979
980Asynchronous thought stream implementation.
981
982**Bases:** 
983<TypeLink type={{"type_str": "BaseAsyncStream[Thought, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseAsyncStream", "description": null, "kind": "simple", "symbol_name": "BaseAsyncStream", "doc_url": null}, "parameters": [{"type_str": "Thought", "description": null, "kind": "simple", "symbol_name": "Thought", "doc_url": "/docs/api/llm/content#thought"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
984
985<AttributesTable
986  attributes={[
987  {
988    "name": "type",
989    "type_info": {
990      "type_str": "Literal['async_thought_stream']",
991      "description": null,
992      "kind": "generic",
993      "base_type": {
994        "type_str": "Literal",
995        "description": null,
996        "kind": "simple",
997        "symbol_name": "Literal",
998        "doc_url": null
999      },
1000      "parameters": [
1001        {
1002          "type_str": "'async_thought_stream'",
1003          "description": null,
1004          "kind": "simple",
1005          "symbol_name": "'async_thought_stream'",
1006          "doc_url": null
1007        }
1008      ],
1009      "doc_url": null
1010    }
1011  },
1012  {
1013    "name": "content_type",
1014    "type_info": {
1015      "type_str": "Literal['thought']",
1016      "description": null,
1017      "kind": "generic",
1018      "base_type": {
1019        "type_str": "Literal",
1020        "description": null,
1021        "kind": "simple",
1022        "symbol_name": "Literal",
1023        "doc_url": null
1024      },
1025      "parameters": [
1026        {
1027          "type_str": "'thought'",
1028          "description": null,
1029          "kind": "simple",
1030          "symbol_name": "'thought'",
1031          "doc_url": null
1032        }
1033      ],
1034      "doc_url": null
1035    },
1036    "description": "The type of content stored in this stream."
1037  },
1038  {
1039    "name": "partial_thought",
1040    "type_info": {
1041      "type_str": "str",
1042      "description": null,
1043      "kind": "simple",
1044      "symbol_name": "str",
1045      "doc_url": null
1046    },
1047    "description": "The accumulated thought content as chunks are received."
1048  }
1049]}
1050/>
1051
1052## <ApiType type="Function" slug="mirascope-llm-responses-streams--async-thought-stream-collect" symbolName="collect" /> collect
1053
1054Asynchronously collect all chunks and return the final Thought content.
1055
1056<ParametersTable
1057  parameters={[
1058  {
1059    "name": "self",
1060    "type_info": {
1061      "type_str": "Any",
1062      "description": null,
1063      "kind": "simple",
1064      "symbol_name": null,
1065      "doc_url": null
1066    }
1067  }
1068]}
1069/>
1070
1071<ReturnTable
1072  returnType={{
1073  "type_info": {
1074    "type_str": "Thought",
1075    "description": null,
1076    "kind": "simple",
1077    "symbol_name": "Thought",
1078    "doc_url": "/docs/api/llm/content#thought"
1079  },
1080  "description": "The complete thought content after consuming all chunks."
1081}}
1082/>
1083
1084
1085
1086## <ApiType type="Class" slug="async-tool-call-stream" symbolName="AsyncToolCallStream" /> AsyncToolCallStream
1087
1088Asynchronous tool call stream implementation.
1089
1090**Bases:** 
1091<TypeLink type={{"type_str": "BaseAsyncStream[ToolCall, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseAsyncStream", "description": null, "kind": "simple", "symbol_name": "BaseAsyncStream", "doc_url": null}, "parameters": [{"type_str": "ToolCall", "description": null, "kind": "simple", "symbol_name": "ToolCall", "doc_url": "/docs/api/llm/content#tool-call"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
1092
1093<AttributesTable
1094  attributes={[
1095  {
1096    "name": "type",
1097    "type_info": {
1098      "type_str": "Literal['async_tool_call_stream']",
1099      "description": null,
1100      "kind": "generic",
1101      "base_type": {
1102        "type_str": "Literal",
1103        "description": null,
1104        "kind": "simple",
1105        "symbol_name": "Literal",
1106        "doc_url": null
1107      },
1108      "parameters": [
1109        {
1110          "type_str": "'async_tool_call_stream'",
1111          "description": null,
1112          "kind": "simple",
1113          "symbol_name": "'async_tool_call_stream'",
1114          "doc_url": null
1115        }
1116      ],
1117      "doc_url": null
1118    }
1119  },
1120  {
1121    "name": "content_type",
1122    "type_info": {
1123      "type_str": "Literal['tool_call']",
1124      "description": null,
1125      "kind": "generic",
1126      "base_type": {
1127        "type_str": "Literal",
1128        "description": null,
1129        "kind": "simple",
1130        "symbol_name": "Literal",
1131        "doc_url": null
1132      },
1133      "parameters": [
1134        {
1135          "type_str": "'tool_call'",
1136          "description": null,
1137          "kind": "simple",
1138          "symbol_name": "'tool_call'",
1139          "doc_url": null
1140        }
1141      ],
1142      "doc_url": null
1143    },
1144    "description": "The type of content stored in this stream."
1145  },
1146  {
1147    "name": "tool_id",
1148    "type_info": {
1149      "type_str": "str",
1150      "description": null,
1151      "kind": "simple",
1152      "symbol_name": "str",
1153      "doc_url": null
1154    },
1155    "description": "A unique identifier for this tool call."
1156  },
1157  {
1158    "name": "tool_name",
1159    "type_info": {
1160      "type_str": "str",
1161      "description": null,
1162      "kind": "simple",
1163      "symbol_name": "str",
1164      "doc_url": null
1165    },
1166    "description": "The name of the tool being called."
1167  },
1168  {
1169    "name": "partial_args",
1170    "type_info": {
1171      "type_str": "str",
1172      "description": null,
1173      "kind": "simple",
1174      "symbol_name": "str",
1175      "doc_url": null
1176    },
1177    "description": "The accumulated tool arguments as chunks are received."
1178  }
1179]}
1180/>
1181
1182## <ApiType type="Function" slug="mirascope-llm-responses-streams--async-tool-call-stream-collect" symbolName="collect" /> collect
1183
1184Asynchronously collect all chunks and return the final ToolCall content.
1185
1186<ParametersTable
1187  parameters={[
1188  {
1189    "name": "self",
1190    "type_info": {
1191      "type_str": "Any",
1192      "description": null,
1193      "kind": "simple",
1194      "symbol_name": null,
1195      "doc_url": null
1196    }
1197  }
1198]}
1199/>
1200
1201<ReturnTable
1202  returnType={{
1203  "type_info": {
1204    "type_str": "ToolCall",
1205    "description": null,
1206    "kind": "simple",
1207    "symbol_name": "ToolCall",
1208    "doc_url": "/docs/api/llm/content#tool-call"
1209  },
1210  "description": "The complete tool call after consuming all chunks."
1211}}
1212/>
1213
1214
1215
1216## <ApiType type="Attribute" slug="chunk-iterator" symbolName="ChunkIterator" /> ChunkIterator
1217
1218**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
1219
1220Synchronous iterator yielding chunks with raw data.
1221
1222
1223## <ApiType type="Class" slug="context-response" symbolName="ContextResponse" /> ContextResponse
1224
1225The response generated by an LLM from a context call.
1226
1227**Bases:** 
1228<TypeLink type={{"type_str": "BaseResponse[ContextToolkit[DepsT], FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseResponse", "description": null, "kind": "simple", "symbol_name": "BaseResponse", "doc_url": null}, "parameters": [{"type_str": "ContextToolkit[DepsT]", "description": null, "kind": "generic", "base_type": {"type_str": "ContextToolkit", "description": null, "kind": "simple", "symbol_name": "ContextToolkit", "doc_url": "/docs/api/llm/tools#context-toolkit"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}], "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
1228, <TypeLink type={{"type_str": "Generic[DepsT, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
1229
1230## <ApiType type="Function" slug="mirascope-llm-responses-response--context-response-execute_tools" symbolName="execute_tools" /> execute_tools
1231
1232Execute and return all of the tool calls in the response.
1233
1234<ParametersTable
1235  parameters={[
1236  {
1237    "name": "self",
1238    "type_info": {
1239      "type_str": "Any",
1240      "description": null,
1241      "kind": "simple",
1242      "symbol_name": null,
1243      "doc_url": null
1244    }
1245  },
1246  {
1247    "name": "ctx",
1248    "type_info": {
1249      "type_str": "Context[DepsT]",
1250      "description": null,
1251      "kind": "generic",
1252      "base_type": {
1253        "type_str": "Context",
1254        "description": null,
1255        "kind": "simple",
1256        "symbol_name": "Context",
1257        "doc_url": null
1258      },
1259      "parameters": [
1260        {
1261          "type_str": "DepsT",
1262          "description": null,
1263          "kind": "simple",
1264          "symbol_name": "DepsT",
1265          "doc_url": null
1266        }
1267      ],
1268      "doc_url": null
1269    },
1270    "description": "A \`Context\` with the required deps type."
1271  }
1272]}
1273/>
1274
1275<ReturnTable
1276  returnType={{
1277  "type_info": {
1278    "type_str": "Sequence[ToolOutput[Jsonable]]",
1279    "description": null,
1280    "kind": "generic",
1281    "base_type": {
1282      "type_str": "Sequence",
1283      "description": null,
1284      "kind": "simple",
1285      "symbol_name": "Sequence",
1286      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
1287    },
1288    "parameters": [
1289      {
1290        "type_str": "ToolOutput[Jsonable]",
1291        "description": null,
1292        "kind": "generic",
1293        "base_type": {
1294          "type_str": "ToolOutput",
1295          "description": null,
1296          "kind": "simple",
1297          "symbol_name": "ToolOutput",
1298          "doc_url": "/docs/api/llm/content#tool-output"
1299        },
1300        "parameters": [
1301          {
1302            "type_str": "Jsonable",
1303            "description": null,
1304            "kind": "simple",
1305            "symbol_name": "Jsonable",
1306            "doc_url": "/docs/api/llm/types#jsonable"
1307          }
1308        ],
1309        "doc_url": null
1310      }
1311    ],
1312    "doc_url": null
1313  },
1314  "description": "A sequence containing a \`ToolOutput\` for every tool call."
1315}}
1316/>
1317
1318
1319## <ApiType type="Function" slug="mirascope-llm-responses-response--context-response-resume" symbolName="resume" /> resume
1320
1321Generate a new \`ContextResponse\` using this response's messages with additional user content.
1322
1323Uses this response's tools and format type. Also uses this response's provider,
1324model, client, and params, unless the model context manager is being used to
1325provide a new LLM as an override.
1326
1327<ParametersTable
1328  parameters={[
1329  {
1330    "name": "self",
1331    "type_info": {
1332      "type_str": "Any",
1333      "description": null,
1334      "kind": "simple",
1335      "symbol_name": null,
1336      "doc_url": null
1337    }
1338  },
1339  {
1340    "name": "ctx",
1341    "type_info": {
1342      "type_str": "Context[DepsT]",
1343      "description": null,
1344      "kind": "generic",
1345      "base_type": {
1346        "type_str": "Context",
1347        "description": null,
1348        "kind": "simple",
1349        "symbol_name": "Context",
1350        "doc_url": null
1351      },
1352      "parameters": [
1353        {
1354          "type_str": "DepsT",
1355          "description": null,
1356          "kind": "simple",
1357          "symbol_name": "DepsT",
1358          "doc_url": null
1359        }
1360      ],
1361      "doc_url": null
1362    },
1363    "description": "A \`Context\` with the required deps type."
1364  },
1365  {
1366    "name": "content",
1367    "type_info": {
1368      "type_str": "UserContent",
1369      "description": null,
1370      "kind": "simple",
1371      "symbol_name": "UserContent",
1372      "doc_url": "/docs/api/llm/messages#user-content"
1373    },
1374    "description": "The new user message content to append to the message history."
1375  }
1376]}
1377/>
1378
1379<ReturnTable
1380  returnType={{
1381  "type_info": {
1382    "type_str": "ContextResponse[DepsT] | ContextResponse[DepsT, FormattableT]",
1383    "description": null,
1384    "kind": "union",
1385    "base_type": {
1386      "type_str": "Union",
1387      "description": null,
1388      "kind": "simple",
1389      "symbol_name": "Union",
1390      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
1391    },
1392    "parameters": [
1393      {
1394        "type_str": "ContextResponse[DepsT]",
1395        "description": null,
1396        "kind": "generic",
1397        "base_type": {
1398          "type_str": "ContextResponse",
1399          "description": null,
1400          "kind": "simple",
1401          "symbol_name": "ContextResponse",
1402          "doc_url": "/docs/api/llm/responses#context-response"
1403        },
1404        "parameters": [
1405          {
1406            "type_str": "DepsT",
1407            "description": null,
1408            "kind": "simple",
1409            "symbol_name": "DepsT",
1410            "doc_url": null
1411          }
1412        ],
1413        "doc_url": null
1414      },
1415      {
1416        "type_str": "ContextResponse[DepsT, FormattableT]",
1417        "description": null,
1418        "kind": "generic",
1419        "base_type": {
1420          "type_str": "ContextResponse",
1421          "description": null,
1422          "kind": "simple",
1423          "symbol_name": "ContextResponse",
1424          "doc_url": "/docs/api/llm/responses#context-response"
1425        },
1426        "parameters": [
1427          {
1428            "type_str": "DepsT",
1429            "description": null,
1430            "kind": "simple",
1431            "symbol_name": "DepsT",
1432            "doc_url": null
1433          },
1434          {
1435            "type_str": "FormattableT",
1436            "description": null,
1437            "kind": "simple",
1438            "symbol_name": "FormattableT",
1439            "doc_url": "/docs/api/llm/formatting#formattable-t"
1440          }
1441        ],
1442        "doc_url": null
1443      }
1444    ],
1445    "doc_url": null
1446  },
1447  "description": "A new \`ContextResponse\` instance generated from the extended message history."
1448}}
1449/>
1450
1451
1452
1453## <ApiType type="Class" slug="context-stream-response" symbolName="ContextStreamResponse" /> ContextStreamResponse
1454
1455A \`ContextStreamResponse\` wraps response content from the LLM with a streaming interface.
1456
1457This class supports iteration to process chunks as they arrive from the model.
1458
1459Content can be streamed in one of three ways:
1460- Via \`.streams()\`, which provides an iterator of streams, where each
1461  stream contains chunks of streamed data. The chunks contain \`delta\`s (new content
1462  in that particular chunk), and the stream itself accumulates the collected state
1463  of all the chunks processed thus far.
1464- Via \`.chunk_stream()\` which allows iterating over Mirascope's provider-
1465  agnostic chunk representation.
1466- Via \`.pretty_stream()\` a helper method which provides all response content
1467  as \`str\` deltas. Iterating through \`pretty_stream\` will yield text content and
1468  optionally placeholder representations for other content types, but it will still
1469  consume the full stream.
1470- Via \`.structured_stream()\`, a helper method which provides partial
1471  structured outputs from a response (useful when FormatT is set). Iterating through
1472  \`structured_stream\` will only yield structured partials, but it will still consume
1473  the full stream.
1474
1475As chunks are consumed, they are collected in-memory on the \`ContextStreamResponse\`, and they
1476become available in \`.content\`, \`.messages\`, \`.tool_calls\`, etc. All of the stream
1477iterators can be restarted after the stream has been consumed, in which case they
1478will yield chunks from memory in the original sequence that came from the LLM. If
1479the stream is only partially consumed, a fresh iterator will first iterate through
1480in-memory content, and then will continue consuming fresh chunks from the LLM.
1481
1482In the specific case of text chunks, they are included in the response content as soon
1483as they become available, via an \`llm.Text\` part that updates as more deltas come in.
1484This enables the behavior where resuming a partially-streamed response will include
1485as much text as the model generated.
1486
1487For other chunks, like \`Thinking\` or \`ToolCall\`, they are only added to response
1488content once the corresponding part has fully streamed. This avoids issues like
1489adding incomplete tool calls, or thinking blocks missing signatures, to the response.
1490
1491For each iterator, fully iterating through the iterator will consume the whole
1492LLM stream. You can pause stream execution midway by breaking out of the iterator,
1493and you can safely resume execution from the same iterator if desired.
1494
1495**Bases:** 
1496<TypeLink type={{"type_str": "BaseSyncStreamResponse[ContextToolkit[DepsT], FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseSyncStreamResponse", "description": null, "kind": "simple", "symbol_name": "BaseSyncStreamResponse", "doc_url": null}, "parameters": [{"type_str": "ContextToolkit[DepsT]", "description": null, "kind": "generic", "base_type": {"type_str": "ContextToolkit", "description": null, "kind": "simple", "symbol_name": "ContextToolkit", "doc_url": "/docs/api/llm/tools#context-toolkit"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}], "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[DepsT, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "DepsT", "description": null, "kind": "simple", "symbol_name": "DepsT", "doc_url": null}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
1497
1498## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--context-stream-response-execute_tools" symbolName="execute_tools" /> execute_tools
1499
1500Execute and return all of the tool calls in the response.
1501
1502<ParametersTable
1503  parameters={[
1504  {
1505    "name": "self",
1506    "type_info": {
1507      "type_str": "Any",
1508      "description": null,
1509      "kind": "simple",
1510      "symbol_name": null,
1511      "doc_url": null
1512    }
1513  },
1514  {
1515    "name": "ctx",
1516    "type_info": {
1517      "type_str": "Context[DepsT]",
1518      "description": null,
1519      "kind": "generic",
1520      "base_type": {
1521        "type_str": "Context",
1522        "description": null,
1523        "kind": "simple",
1524        "symbol_name": "Context",
1525        "doc_url": null
1526      },
1527      "parameters": [
1528        {
1529          "type_str": "DepsT",
1530          "description": null,
1531          "kind": "simple",
1532          "symbol_name": "DepsT",
1533          "doc_url": null
1534        }
1535      ],
1536      "doc_url": null
1537    },
1538    "description": "A \`Context\` with the required deps type."
1539  }
1540]}
1541/>
1542
1543<ReturnTable
1544  returnType={{
1545  "type_info": {
1546    "type_str": "Sequence[ToolOutput[Jsonable]]",
1547    "description": null,
1548    "kind": "generic",
1549    "base_type": {
1550      "type_str": "Sequence",
1551      "description": null,
1552      "kind": "simple",
1553      "symbol_name": "Sequence",
1554      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
1555    },
1556    "parameters": [
1557      {
1558        "type_str": "ToolOutput[Jsonable]",
1559        "description": null,
1560        "kind": "generic",
1561        "base_type": {
1562          "type_str": "ToolOutput",
1563          "description": null,
1564          "kind": "simple",
1565          "symbol_name": "ToolOutput",
1566          "doc_url": "/docs/api/llm/content#tool-output"
1567        },
1568        "parameters": [
1569          {
1570            "type_str": "Jsonable",
1571            "description": null,
1572            "kind": "simple",
1573            "symbol_name": "Jsonable",
1574            "doc_url": "/docs/api/llm/types#jsonable"
1575          }
1576        ],
1577        "doc_url": null
1578      }
1579    ],
1580    "doc_url": null
1581  },
1582  "description": "A sequence containing a \`ToolOutput\` for every tool call."
1583}}
1584/>
1585
1586
1587## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--context-stream-response-resume" symbolName="resume" /> resume
1588
1589Generate a new \`ContextStreamResponse\` using this response's messages with additional user content.
1590
1591Uses this response's tools and format type. Also uses this response's provider,
1592model, client, and params, unless the model context manager is being used to
1593provide a new LLM as an override.
1594
1595<ParametersTable
1596  parameters={[
1597  {
1598    "name": "self",
1599    "type_info": {
1600      "type_str": "Any",
1601      "description": null,
1602      "kind": "simple",
1603      "symbol_name": null,
1604      "doc_url": null
1605    }
1606  },
1607  {
1608    "name": "ctx",
1609    "type_info": {
1610      "type_str": "Context[DepsT]",
1611      "description": null,
1612      "kind": "generic",
1613      "base_type": {
1614        "type_str": "Context",
1615        "description": null,
1616        "kind": "simple",
1617        "symbol_name": "Context",
1618        "doc_url": null
1619      },
1620      "parameters": [
1621        {
1622          "type_str": "DepsT",
1623          "description": null,
1624          "kind": "simple",
1625          "symbol_name": "DepsT",
1626          "doc_url": null
1627        }
1628      ],
1629      "doc_url": null
1630    },
1631    "description": "A Context with the required deps type."
1632  },
1633  {
1634    "name": "content",
1635    "type_info": {
1636      "type_str": "UserContent",
1637      "description": null,
1638      "kind": "simple",
1639      "symbol_name": "UserContent",
1640      "doc_url": "/docs/api/llm/messages#user-content"
1641    },
1642    "description": "The new user message content to append to the message history."
1643  }
1644]}
1645/>
1646
1647<ReturnTable
1648  returnType={{
1649  "type_info": {
1650    "type_str": "ContextStreamResponse[DepsT] | ContextStreamResponse[DepsT, FormattableT]",
1651    "description": null,
1652    "kind": "union",
1653    "base_type": {
1654      "type_str": "Union",
1655      "description": null,
1656      "kind": "simple",
1657      "symbol_name": "Union",
1658      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
1659    },
1660    "parameters": [
1661      {
1662        "type_str": "ContextStreamResponse[DepsT]",
1663        "description": null,
1664        "kind": "generic",
1665        "base_type": {
1666          "type_str": "ContextStreamResponse",
1667          "description": null,
1668          "kind": "simple",
1669          "symbol_name": "ContextStreamResponse",
1670          "doc_url": "/docs/api/llm/responses#context-stream-response"
1671        },
1672        "parameters": [
1673          {
1674            "type_str": "DepsT",
1675            "description": null,
1676            "kind": "simple",
1677            "symbol_name": "DepsT",
1678            "doc_url": null
1679          }
1680        ],
1681        "doc_url": null
1682      },
1683      {
1684        "type_str": "ContextStreamResponse[DepsT, FormattableT]",
1685        "description": null,
1686        "kind": "generic",
1687        "base_type": {
1688          "type_str": "ContextStreamResponse",
1689          "description": null,
1690          "kind": "simple",
1691          "symbol_name": "ContextStreamResponse",
1692          "doc_url": "/docs/api/llm/responses#context-stream-response"
1693        },
1694        "parameters": [
1695          {
1696            "type_str": "DepsT",
1697            "description": null,
1698            "kind": "simple",
1699            "symbol_name": "DepsT",
1700            "doc_url": null
1701          },
1702          {
1703            "type_str": "FormattableT",
1704            "description": null,
1705            "kind": "simple",
1706            "symbol_name": "FormattableT",
1707            "doc_url": "/docs/api/llm/formatting#formattable-t"
1708          }
1709        ],
1710        "doc_url": null
1711      }
1712    ],
1713    "doc_url": null
1714  },
1715  "description": "A new \`ContextStreamResponse\` instance generated from the extended message history."
1716}}
1717/>
1718
1719
1720
1721## <ApiType type="Class" slug="finish-reason" symbolName="FinishReason" /> FinishReason
1722
1723The reason why the LLM finished generating a response.
1724
1725\`FinishReason\` is only set when the response did not have a normal finish (e.g. it
1726ran out of tokens). When a response finishes generating normally, no finish reason
1727is set.
1728
1729**Bases:** 
1730<TypeLink type={{"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}} />, <TypeLink type={{"type_str": "Enum", "description": null, "kind": "simple", "symbol_name": "Enum", "doc_url": "https://docs.python.org/3/library/enum.html#enum.Enum"}} />
1731
1732<AttributesTable
1733  attributes={[
1734  {
1735    "name": "MAX_TOKENS",
1736    "type_info": {
1737      "type_str": "'max_tokens'",
1738      "description": null,
1739      "kind": "simple",
1740      "symbol_name": "'max_tokens'",
1741      "doc_url": null
1742    }
1743  },
1744  {
1745    "name": "REFUSAL",
1746    "type_info": {
1747      "type_str": "'refusal'",
1748      "description": null,
1749      "kind": "simple",
1750      "symbol_name": "'refusal'",
1751      "doc_url": null
1752    }
1753  },
1754  {
1755    "name": "CONTEXT_LENGTH_EXCEEDED",
1756    "type_info": {
1757      "type_str": "'context_length_exceeded'",
1758      "description": null,
1759      "kind": "simple",
1760      "symbol_name": "'context_length_exceeded'",
1761      "doc_url": null
1762    }
1763  }
1764]}
1765/>
1766
1767
1768## <ApiType type="Class" slug="finish-reason-chunk" symbolName="FinishReasonChunk" /> FinishReasonChunk
1769
1770Represents the finish reason for a completed stream.
1771
1772<AttributesTable
1773  attributes={[
1774  {
1775    "name": "type",
1776    "type_info": {
1777      "type_str": "Literal['finish_reason_chunk']",
1778      "description": null,
1779      "kind": "generic",
1780      "base_type": {
1781        "type_str": "Literal",
1782        "description": null,
1783        "kind": "simple",
1784        "symbol_name": "Literal",
1785        "doc_url": null
1786      },
1787      "parameters": [
1788        {
1789          "type_str": "'finish_reason_chunk'",
1790          "description": null,
1791          "kind": "simple",
1792          "symbol_name": "'finish_reason_chunk'",
1793          "doc_url": null
1794        }
1795      ],
1796      "doc_url": null
1797    }
1798  },
1799  {
1800    "name": "finish_reason",
1801    "type_info": {
1802      "type_str": "FinishReason",
1803      "description": null,
1804      "kind": "simple",
1805      "symbol_name": "FinishReason",
1806      "doc_url": null
1807    },
1808    "description": "The reason the stream finished."
1809  }
1810]}
1811/>
1812
1813
1814## <ApiType type="Class" slug="raw-message-chunk" symbolName="RawMessageChunk" /> RawMessageChunk
1815
1816A chunk containing provider-specific raw message content that will be added to the \`AssistantMessage\`.
1817
1818This chunk contains a provider-specific representation of a piece of content that
1819will be added to the \`AssistantMessage\` reconstructed by the containing stream.
1820This content should be a Jsonable Python object for serialization purposes.
1821
1822The intention is that this content may be passed as-is back to the provider when the
1823generated \`AssistantMessage\` is being reused in conversation.
1824
1825<AttributesTable
1826  attributes={[
1827  {
1828    "name": "type",
1829    "type_info": {
1830      "type_str": "Literal['raw_message_chunk']",
1831      "description": null,
1832      "kind": "generic",
1833      "base_type": {
1834        "type_str": "Literal",
1835        "description": null,
1836        "kind": "simple",
1837        "symbol_name": "Literal",
1838        "doc_url": null
1839      },
1840      "parameters": [
1841        {
1842          "type_str": "'raw_message_chunk'",
1843          "description": null,
1844          "kind": "simple",
1845          "symbol_name": "'raw_message_chunk'",
1846          "doc_url": null
1847        }
1848      ],
1849      "doc_url": null
1850    }
1851  },
1852  {
1853    "name": "raw_message",
1854    "type_info": {
1855      "type_str": "Jsonable",
1856      "description": null,
1857      "kind": "simple",
1858      "symbol_name": "Jsonable",
1859      "doc_url": null
1860    },
1861    "description": "The provider-specific raw content.\\n\\nShould be a Jsonable object."
1862  }
1863]}
1864/>
1865
1866
1867## <ApiType type="Class" slug="raw-stream-event-chunk" symbolName="RawStreamEventChunk" /> RawStreamEventChunk
1868
1869A chunk containing a raw stream event from the underlying provider.
1870
1871Will be accumulated on \`StreamResponse.raw\` for debugging purposes.
1872
1873<AttributesTable
1874  attributes={[
1875  {
1876    "name": "type",
1877    "type_info": {
1878      "type_str": "Literal['raw_stream_event_chunk']",
1879      "description": null,
1880      "kind": "generic",
1881      "base_type": {
1882        "type_str": "Literal",
1883        "description": null,
1884        "kind": "simple",
1885        "symbol_name": "Literal",
1886        "doc_url": null
1887      },
1888      "parameters": [
1889        {
1890          "type_str": "'raw_stream_event_chunk'",
1891          "description": null,
1892          "kind": "simple",
1893          "symbol_name": "'raw_stream_event_chunk'",
1894          "doc_url": null
1895        }
1896      ],
1897      "doc_url": null
1898    }
1899  },
1900  {
1901    "name": "raw_stream_event",
1902    "type_info": {
1903      "type_str": "Any",
1904      "description": null,
1905      "kind": "simple",
1906      "symbol_name": "Any",
1907      "doc_url": null
1908    },
1909    "description": "The raw stream event from the underlying provider."
1910  }
1911]}
1912/>
1913
1914
1915## <ApiType type="Class" slug="response" symbolName="Response" /> Response
1916
1917The response generated by an LLM.
1918
1919**Bases:** 
1920<TypeLink type={{"type_str": "BaseResponse[Toolkit, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseResponse", "description": null, "kind": "simple", "symbol_name": "BaseResponse", "doc_url": null}, "parameters": [{"type_str": "Toolkit", "description": null, "kind": "simple", "symbol_name": "Toolkit", "doc_url": "/docs/api/llm/tools#toolkit"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
1921
1922## <ApiType type="Function" slug="mirascope-llm-responses-response--response-execute_tools" symbolName="execute_tools" /> execute_tools
1923
1924Execute and return all of the tool calls in the response.
1925
1926<ParametersTable
1927  parameters={[
1928  {
1929    "name": "self",
1930    "type_info": {
1931      "type_str": "Any",
1932      "description": null,
1933      "kind": "simple",
1934      "symbol_name": null,
1935      "doc_url": null
1936    }
1937  }
1938]}
1939/>
1940
1941<ReturnTable
1942  returnType={{
1943  "type_info": {
1944    "type_str": "Sequence[ToolOutput[Jsonable]]",
1945    "description": null,
1946    "kind": "generic",
1947    "base_type": {
1948      "type_str": "Sequence",
1949      "description": null,
1950      "kind": "simple",
1951      "symbol_name": "Sequence",
1952      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
1953    },
1954    "parameters": [
1955      {
1956        "type_str": "ToolOutput[Jsonable]",
1957        "description": null,
1958        "kind": "generic",
1959        "base_type": {
1960          "type_str": "ToolOutput",
1961          "description": null,
1962          "kind": "simple",
1963          "symbol_name": "ToolOutput",
1964          "doc_url": "/docs/api/llm/content#tool-output"
1965        },
1966        "parameters": [
1967          {
1968            "type_str": "Jsonable",
1969            "description": null,
1970            "kind": "simple",
1971            "symbol_name": "Jsonable",
1972            "doc_url": "/docs/api/llm/types#jsonable"
1973          }
1974        ],
1975        "doc_url": null
1976      }
1977    ],
1978    "doc_url": null
1979  },
1980  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
1981}}
1982/>
1983
1984
1985## <ApiType type="Function" slug="mirascope-llm-responses-response--response-resume" symbolName="resume" /> resume
1986
1987Generate a new \`Response\` using this response's messages with additional user content.
1988
1989Uses this response's tools and format type. Also uses this response's provider,
1990model, client, and params, unless the model context manager is being used to
1991provide a new LLM as an override.
1992
1993<ParametersTable
1994  parameters={[
1995  {
1996    "name": "self",
1997    "type_info": {
1998      "type_str": "Any",
1999      "description": null,
2000      "kind": "simple",
2001      "symbol_name": null,
2002      "doc_url": null
2003    }
2004  },
2005  {
2006    "name": "content",
2007    "type_info": {
2008      "type_str": "UserContent",
2009      "description": null,
2010      "kind": "simple",
2011      "symbol_name": "UserContent",
2012      "doc_url": "/docs/api/llm/messages#user-content"
2013    },
2014    "description": "The new user message content to append to the message history."
2015  }
2016]}
2017/>
2018
2019<ReturnTable
2020  returnType={{
2021  "type_info": {
2022    "type_str": "Response | Response[FormattableT]",
2023    "description": null,
2024    "kind": "union",
2025    "base_type": {
2026      "type_str": "Union",
2027      "description": null,
2028      "kind": "simple",
2029      "symbol_name": "Union",
2030      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
2031    },
2032    "parameters": [
2033      {
2034        "type_str": "Response",
2035        "description": null,
2036        "kind": "simple",
2037        "symbol_name": "Response",
2038        "doc_url": "/docs/api/llm/responses#response"
2039      },
2040      {
2041        "type_str": "Response[FormattableT]",
2042        "description": null,
2043        "kind": "generic",
2044        "base_type": {
2045          "type_str": "Response",
2046          "description": null,
2047          "kind": "simple",
2048          "symbol_name": "Response",
2049          "doc_url": "/docs/api/llm/responses#response"
2050        },
2051        "parameters": [
2052          {
2053            "type_str": "FormattableT",
2054            "description": null,
2055            "kind": "simple",
2056            "symbol_name": "FormattableT",
2057            "doc_url": "/docs/api/llm/formatting#formattable-t"
2058          }
2059        ],
2060        "doc_url": null
2061      }
2062    ],
2063    "doc_url": null
2064  },
2065  "description": "A new \`Response\` instance generated from the extended message history."
2066}}
2067/>
2068
2069
2070
2071## <ApiType type="Attribute" slug="response-t" symbolName="ResponseT" /> ResponseT
2072
2073**Type:** <TypeLink type={{"type_str": "TypeVar('ResponseT', bound='BaseResponse[Any, Any]')", "description": null, "kind": "simple", "symbol_name": null, "doc_url": null}} />
2074
2075
2076## <ApiType type="Class" slug="root-response" symbolName="RootResponse" /> RootResponse
2077
2078Base class for LLM responses.
2079
2080**Bases:** 
2081<TypeLink type={{"type_str": "Generic[ToolkitT, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "Generic", "description": null, "kind": "simple", "symbol_name": "Generic", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Generic"}, "parameters": [{"type_str": "ToolkitT", "description": null, "kind": "simple", "symbol_name": "ToolkitT", "doc_url": "/docs/api/llm/tools#toolkit-t"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
2081, <TypeLink type={{"type_str": "ABC", "description": null, "kind": "simple", "symbol_name": "ABC", "doc_url": null}} />
2082
2083<AttributesTable
2084  attributes={[
2085  {
2086    "name": "raw",
2087    "type_info": {
2088      "type_str": "Any",
2089      "description": null,
2090      "kind": "simple",
2091      "symbol_name": "Any",
2092      "doc_url": null
2093    },
2094    "description": "The raw response from the LLM."
2095  },
2096  {
2097    "name": "provider_id",
2098    "type_info": {
2099      "type_str": "ProviderId",
2100      "description": null,
2101      "kind": "simple",
2102      "symbol_name": "ProviderId",
2103      "doc_url": null
2104    },
2105    "description": "The provider that generated this response."
2106  },
2107  {
2108    "name": "model_id",
2109    "type_info": {
2110      "type_str": "ModelId",
2111      "description": null,
2112      "kind": "simple",
2113      "symbol_name": "ModelId",
2114      "doc_url": null
2115    },
2116    "description": "The model id that generated this response."
2117  },
2118  {
2119    "name": "params",
2120    "type_info": {
2121      "type_str": "Params",
2122      "description": null,
2123      "kind": "simple",
2124      "symbol_name": "Params",
2125      "doc_url": null
2126    },
2127    "description": "The params that were used to generate this response (or None)."
2128  },
2129  {
2130    "name": "toolkit",
2131    "type_info": {
2132      "type_str": "ToolkitT",
2133      "description": null,
2134      "kind": "simple",
2135      "symbol_name": "ToolkitT",
2136      "doc_url": null
2137    },
2138    "description": "The toolkit containing the tools used when generating this response."
2139  },
2140  {
2141    "name": "messages",
2142    "type_info": {
2143      "type_str": "list[Message]",
2144      "description": null,
2145      "kind": "generic",
2146      "base_type": {
2147        "type_str": "list",
2148        "description": null,
2149        "kind": "simple",
2150        "symbol_name": "list",
2151        "doc_url": null
2152      },
2153      "parameters": [
2154        {
2155          "type_str": "Message",
2156          "description": null,
2157          "kind": "simple",
2158          "symbol_name": "Message",
2159          "doc_url": null
2160        }
2161      ],
2162      "doc_url": null
2163    },
2164    "description": "The message history, including the most recent assistant message."
2165  },
2166  {
2167    "name": "content",
2168    "type_info": {
2169      "type_str": "Sequence[AssistantContentPart]",
2170      "description": null,
2171      "kind": "generic",
2172      "base_type": {
2173        "type_str": "Sequence",
2174        "description": null,
2175        "kind": "simple",
2176        "symbol_name": "Sequence",
2177        "doc_url": null
2178      },
2179      "parameters": [
2180        {
2181          "type_str": "AssistantContentPart",
2182          "description": null,
2183          "kind": "simple",
2184          "symbol_name": "AssistantContentPart",
2185          "doc_url": null
2186        }
2187      ],
2188      "doc_url": null
2189    },
2190    "description": "The content generated by the LLM."
2191  },
2192  {
2193    "name": "texts",
2194    "type_info": {
2195      "type_str": "Sequence[Text]",
2196      "description": null,
2197      "kind": "generic",
2198      "base_type": {
2199        "type_str": "Sequence",
2200        "description": null,
2201        "kind": "simple",
2202        "symbol_name": "Sequence",
2203        "doc_url": null
2204      },
2205      "parameters": [
2206        {
2207          "type_str": "Text",
2208          "description": null,
2209          "kind": "simple",
2210          "symbol_name": "Text",
2211          "doc_url": null
2212        }
2213      ],
2214      "doc_url": null
2215    },
2216    "description": "The text content in the generated response, if any."
2217  },
2218  {
2219    "name": "tool_calls",
2220    "type_info": {
2221      "type_str": "Sequence[ToolCall]",
2222      "description": null,
2223      "kind": "generic",
2224      "base_type": {
2225        "type_str": "Sequence",
2226        "description": null,
2227        "kind": "simple",
2228        "symbol_name": "Sequence",
2229        "doc_url": null
2230      },
2231      "parameters": [
2232        {
2233          "type_str": "ToolCall",
2234          "description": null,
2235          "kind": "simple",
2236          "symbol_name": "ToolCall",
2237          "doc_url": null
2238        }
2239      ],
2240      "doc_url": null
2241    },
2242    "description": "The tools the LLM wants called on its behalf, if any."
2243  },
2244  {
2245    "name": "thoughts",
2246    "type_info": {
2247      "type_str": "Sequence[Thought]",
2248      "description": null,
2249      "kind": "generic",
2250      "base_type": {
2251        "type_str": "Sequence",
2252        "description": null,
2253        "kind": "simple",
2254        "symbol_name": "Sequence",
2255        "doc_url": null
2256      },
2257      "parameters": [
2258        {
2259          "type_str": "Thought",
2260          "description": null,
2261          "kind": "simple",
2262          "symbol_name": "Thought",
2263          "doc_url": null
2264        }
2265      ],
2266      "doc_url": null
2267    },
2268    "description": "The readable thoughts from the model's thinking process, if any.\\n\\nThe thoughts may be direct output from the model thinking process, or may be a\\ngenerated summary. (This depends on the provider; newer models tend to summarize.)"
2269  },
2270  {
2271    "name": "finish_reason",
2272    "type_info": {
2273      "type_str": "FinishReason | None",
2274      "description": null,
2275      "kind": "union",
2276      "base_type": {
2277        "type_str": "Union",
2278        "description": null,
2279        "kind": "simple",
2280        "symbol_name": "Union",
2281        "doc_url": null
2282      },
2283      "parameters": [
2284        {
2285          "type_str": "FinishReason",
2286          "description": null,
2287          "kind": "simple",
2288          "symbol_name": "FinishReason",
2289          "doc_url": null
2290        },
2291        {
2292          "type_str": "None",
2293          "description": null,
2294          "kind": "simple",
2295          "symbol_name": "None",
2296          "doc_url": null
2297        }
2298      ],
2299      "doc_url": null
2300    },
2301    "description": "The reason why the LLM finished generating a response, if set.\\n\\n\`finish_reason\` is only set if the response did not finish generating normally,\\ne.g. \`FinishReason.MAX_TOKENS\` if the model ran out of tokens before completing.\\nWhen the response generates normally, \`response.finish_reason\` will be \`None\`."
2302  },
2303  {
2304    "name": "usage",
2305    "type_info": {
2306      "type_str": "Usage | None",
2307      "description": null,
2308      "kind": "union",
2309      "base_type": {
2310        "type_str": "Union",
2311        "description": null,
2312        "kind": "simple",
2313        "symbol_name": "Union",
2314        "doc_url": null
2315      },
2316      "parameters": [
2317        {
2318          "type_str": "Usage",
2319          "description": null,
2320          "kind": "simple",
2321          "symbol_name": "Usage",
2322          "doc_url": null
2323        },
2324        {
2325          "type_str": "None",
2326          "description": null,
2327          "kind": "simple",
2328          "symbol_name": "None",
2329          "doc_url": null
2330        }
2331      ],
2332      "doc_url": null
2333    },
2334    "description": "Token usage statistics for this response, if available."
2335  },
2336  {
2337    "name": "format",
2338    "type_info": {
2339      "type_str": "Format[FormattableT] | None",
2340      "description": null,
2341      "kind": "union",
2342      "base_type": {
2343        "type_str": "Union",
2344        "description": null,
2345        "kind": "simple",
2346        "symbol_name": "Union",
2347        "doc_url": null
2348      },
2349      "parameters": [
2350        {
2351          "type_str": "Format[FormattableT]",
2352          "description": null,
2353          "kind": "generic",
2354          "base_type": {
2355            "type_str": "Format",
2356            "description": null,
2357            "kind": "simple",
2358            "symbol_name": "Format",
2359            "doc_url": null
2360          },
2361          "parameters": [
2362            {
2363              "type_str": "FormattableT",
2364              "description": null,
2365              "kind": "simple",
2366              "symbol_name": "FormattableT",
2367              "doc_url": null
2368            }
2369          ],
2370          "doc_url": null
2371        },
2372        {
2373          "type_str": "None",
2374          "description": null,
2375          "kind": "simple",
2376          "symbol_name": "None",
2377          "doc_url": null
2378        }
2379      ],
2380      "doc_url": null
2381    },
2382    "description": "The \`Format\` describing the structured response format, if available."
2383  },
2384  {
2385    "name": "model",
2386    "type_info": {
2387      "type_str": "Model",
2388      "description": null,
2389      "kind": "simple",
2390      "symbol_name": "Model",
2391      "doc_url": null
2392    },
2393    "description": "A \`Model\` with parameters matching this response."
2394  }
2395]}
2396/>
2397
2398## <ApiType type="Function" slug="mirascope-llm-responses-root_response--root-response-parse" symbolName="parse" /> parse
2399
2400Format the response according to the response format parser.
2401
2402Supports:
2403- Pydantic BaseModel types (JSON schema validation)
2404- Primitive types (automatically unwrapped from wrapper model)
2405- Custom OutputParsers (custom parsing logic)
2406- Partial parsing during streaming (when partial=True)
2407
2408<ParametersTable
2409  parameters={[
2410  {
2411    "name": "self",
2412    "type_info": {
2413      "type_str": "Any",
2414      "description": null,
2415      "kind": "simple",
2416      "symbol_name": null,
2417      "doc_url": null
2418    }
2419  },
2420  {
2421    "name": "partial",
2422    "type_info": {
2423      "type_str": "bool",
2424      "description": null,
2425      "kind": "simple",
2426      "symbol_name": "bool",
2427      "doc_url": "https://docs.python.org/3/library/functions.html#bool"
2428    },
2429    "default": "False",
2430    "description": "If True, parse incomplete JSON as Partial model. Only works with\\nstreaming responses that have accumulated JSON. Returns None if JSON\\nis not yet available or cannot be parsed."
2431  }
2432]}
2433/>
2434
2435<ReturnTable
2436  returnType={{
2437  "type_info": {
2438    "type_str": "FormattableT | Partial[FormattableT] | None",
2439    "description": null,
2440    "kind": "union",
2441    "base_type": {
2442      "type_str": "Union",
2443      "description": null,
2444      "kind": "simple",
2445      "symbol_name": "Union",
2446      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
2447    },
2448    "parameters": [
2449      {
2450        "type_str": "FormattableT",
2451        "description": null,
2452        "kind": "simple",
2453        "symbol_name": "FormattableT",
2454        "doc_url": "/docs/api/llm/formatting#formattable-t"
2455      },
2456      {
2457        "type_str": "Partial[FormattableT]",
2458        "description": null,
2459        "kind": "generic",
2460        "base_type": {
2461          "type_str": "Partial",
2462          "description": null,
2463          "kind": "simple",
2464          "symbol_name": "Partial",
2465          "doc_url": "/docs/api/llm/formatting#partial"
2466        },
2467        "parameters": [
2468          {
2469            "type_str": "FormattableT",
2470            "description": null,
2471            "kind": "simple",
2472            "symbol_name": "FormattableT",
2473            "doc_url": "/docs/api/llm/formatting#formattable-t"
2474          }
2475        ],
2476        "doc_url": null
2477      },
2478      {
2479        "type_str": "None",
2480        "description": null,
2481        "kind": "simple",
2482        "symbol_name": "None",
2483        "doc_url": "https://docs.python.org/3/library/constants.html#None"
2484      }
2485    ],
2486    "doc_url": null
2487  },
2488  "description": "The formatted response object of type FormatT. For BaseModel types, returns"
2489}}
2490/>
2491
2492
2493## <ApiType type="Function" slug="mirascope-llm-responses-root_response--root-response-text" symbolName="text" /> text
2494
2495Return all text content from this response as a single string.
2496
2497Joins the text from all \`Text\` parts in the response content using the
2498specified separator.
2499
2500<ParametersTable
2501  parameters={[
2502  {
2503    "name": "self",
2504    "type_info": {
2505      "type_str": "Any",
2506      "description": null,
2507      "kind": "simple",
2508      "symbol_name": null,
2509      "doc_url": null
2510    }
2511  },
2512  {
2513    "name": "sep",
2514    "type_info": {
2515      "type_str": "str",
2516      "description": null,
2517      "kind": "simple",
2518      "symbol_name": "str",
2519      "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
2520    },
2521    "default": "'\\\\n'",
2522    "description": "The separator to use when joining multiple text parts.\\nDefaults to newline (\\"\\\\n\\")."
2523  }
2524]}
2525/>
2526
2527<ReturnTable
2528  returnType={{
2529  "type_info": {
2530    "type_str": "str",
2531    "description": null,
2532    "kind": "simple",
2533    "symbol_name": "str",
2534    "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
2535  },
2536  "description": "A string containing all text content joined by the separator."
2537}}
2538/>
2539
2540
2541## <ApiType type="Function" slug="mirascope-llm-responses-root_response--root-response-pretty" symbolName="pretty" /> pretty
2542
2543Return a string representation of all response content.
2544
2545The response content will be represented in a way that emphasies clarity and
2546readability, but may not include all metadata (like thinking signatures or tool
2547call ids), and thus cannot be used to reconstruct the response. For example:
2548
2549**Thinking:**
2550  The user is asking a math problem. I should use the calculator tool.
2551
2552**Tool Call (calculator)** \\{'operation': 'mult', 'a': 1337, 'b': 4242\\}
2553
2554I am going to use the calculator and answer your question for you!
2555
2556<ParametersTable
2557  parameters={[
2558  {
2559    "name": "self",
2560    "type_info": {
2561      "type_str": "Any",
2562      "description": null,
2563      "kind": "simple",
2564      "symbol_name": null,
2565      "doc_url": null
2566    }
2567  }
2568]}
2569/>
2570
2571<ReturnTable
2572  returnType={{
2573  "type_info": {
2574    "type_str": "str",
2575    "description": null,
2576    "kind": "simple",
2577    "symbol_name": "str",
2578    "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
2579  }
2580}}
2581/>
2582
2583
2584
2585## <ApiType type="Attribute" slug="stream" symbolName="Stream" /> Stream
2586
2587**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
2588
2589A synchronous assistant content stream.
2590
2591
2592## <ApiType type="Class" slug="stream-response" symbolName="StreamResponse" /> StreamResponse
2593
2594A \`StreamResponse\` wraps response content from the LLM with a streaming interface.
2595
2596This class supports iteration to process chunks as they arrive from the model.
2597
2598Content can be streamed in one of three ways:
2599- Via \`.streams()\`, which provides an iterator of streams, where each
2600  stream contains chunks of streamed data. The chunks contain \`delta\`s (new content
2601  in that particular chunk), and the stream itself accumulates the collected state
2602  of all the chunks processed thus far.
2603- Via \`.chunk_stream()\` which allows iterating over Mirascope's provider-
2604  agnostic chunk representation.
2605- Via \`.pretty_stream()\` a helper method which provides all response content
2606  as \`str\` deltas. Iterating through \`pretty_stream\` will yield text content and
2607  optionally placeholder representations for other content types, but it will still
2608  consume the full stream.
2609- Via \`.structured_stream()\`, a helper method which provides partial
2610  structured outputs from a response (useful when FormatT is set). Iterating through
2611  \`structured_stream\` will only yield structured partials, but it will still consume
2612  the full stream.
2613
2614As chunks are consumed, they are collected in-memory on the \`StreamResponse\`, and they
2615become available in \`.content\`, \`.messages\`, \`.tool_calls\`, etc. All of the stream
2616iterators can be restarted after the stream has been consumed, in which case they
2617will yield chunks from memory in the original sequence that came from the LLM. If
2618the stream is only partially consumed, a fresh iterator will first iterate through
2619in-memory content, and then will continue consuming fresh chunks from the LLM.
2620
2621In the specific case of text chunks, they are included in the response content as soon
2622as they become available, via an \`llm.Text\` part that updates as more deltas come in.
2623This enables the behavior where resuming a partially-streamed response will include
2624as much text as the model generated.
2625
2626For other chunks, like \`Thinking\` or \`ToolCall\`, they are only added to response
2627content once the corresponding part has fully streamed. This avoids issues like
2628adding incomplete tool calls, or thinking blocks missing signatures, to the response.
2629
2630For each iterator, fully iterating through the iterator will consume the whole
2631LLM stream. You can pause stream execution midway by breaking out of the iterator,
2632and you can safely resume execution from the same iterator if desired.
2633
2634**Bases:** 
2635<TypeLink type={{"type_str": "BaseSyncStreamResponse[Toolkit, FormattableT]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseSyncStreamResponse", "description": null, "kind": "simple", "symbol_name": "BaseSyncStreamResponse", "doc_url": null}, "parameters": [{"type_str": "Toolkit", "description": null, "kind": "simple", "symbol_name": "Toolkit", "doc_url": "/docs/api/llm/tools#toolkit"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/api/llm/formatting#formattable-t"}], "doc_url": null}} />
2636
2637## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--stream-response-execute_tools" symbolName="execute_tools" /> execute_tools
2638
2639Execute and return all of the tool calls in the response.
2640
2641<ParametersTable
2642  parameters={[
2643  {
2644    "name": "self",
2645    "type_info": {
2646      "type_str": "Any",
2647      "description": null,
2648      "kind": "simple",
2649      "symbol_name": null,
2650      "doc_url": null
2651    }
2652  }
2653]}
2654/>
2655
2656<ReturnTable
2657  returnType={{
2658  "type_info": {
2659    "type_str": "Sequence[ToolOutput[Jsonable]]",
2660    "description": null,
2661    "kind": "generic",
2662    "base_type": {
2663      "type_str": "Sequence",
2664      "description": null,
2665      "kind": "simple",
2666      "symbol_name": "Sequence",
2667      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
2668    },
2669    "parameters": [
2670      {
2671        "type_str": "ToolOutput[Jsonable]",
2672        "description": null,
2673        "kind": "generic",
2674        "base_type": {
2675          "type_str": "ToolOutput",
2676          "description": null,
2677          "kind": "simple",
2678          "symbol_name": "ToolOutput",
2679          "doc_url": "/docs/api/llm/content#tool-output"
2680        },
2681        "parameters": [
2682          {
2683            "type_str": "Jsonable",
2684            "description": null,
2685            "kind": "simple",
2686            "symbol_name": "Jsonable",
2687            "doc_url": "/docs/api/llm/types#jsonable"
2688          }
2689        ],
2690        "doc_url": null
2691      }
2692    ],
2693    "doc_url": null
2694  },
2695  "description": "A sequence containing a \`ToolOutput\` for every tool call in the order they appeared."
2696}}
2697/>
2698
2699
2700## <ApiType type="Function" slug="mirascope-llm-responses-stream_response--stream-response-resume" symbolName="resume" /> resume
2701
2702Generate a new \`StreamResponse\` using this response's messages with additional user content.
2703
2704Uses this response's tools and format type. Also uses this response's provider,
2705model, client, and params, unless the model context manager is being used to
2706provide a new LLM as an override.
2707
2708<ParametersTable
2709  parameters={[
2710  {
2711    "name": "self",
2712    "type_info": {
2713      "type_str": "Any",
2714      "description": null,
2715      "kind": "simple",
2716      "symbol_name": null,
2717      "doc_url": null
2718    }
2719  },
2720  {
2721    "name": "content",
2722    "type_info": {
2723      "type_str": "UserContent",
2724      "description": null,
2725      "kind": "simple",
2726      "symbol_name": "UserContent",
2727      "doc_url": "/docs/api/llm/messages#user-content"
2728    },
2729    "description": "The new user message content to append to the message history."
2730  }
2731]}
2732/>
2733
2734<ReturnTable
2735  returnType={{
2736  "type_info": {
2737    "type_str": "StreamResponse | StreamResponse[FormattableT]",
2738    "description": null,
2739    "kind": "union",
2740    "base_type": {
2741      "type_str": "Union",
2742      "description": null,
2743      "kind": "simple",
2744      "symbol_name": "Union",
2745      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
2746    },
2747    "parameters": [
2748      {
2749        "type_str": "StreamResponse",
2750        "description": null,
2751        "kind": "simple",
2752        "symbol_name": "StreamResponse",
2753        "doc_url": "/docs/api/llm/responses#stream-response"
2754      },
2755      {
2756        "type_str": "StreamResponse[FormattableT]",
2757        "description": null,
2758        "kind": "generic",
2759        "base_type": {
2760          "type_str": "StreamResponse",
2761          "description": null,
2762          "kind": "simple",
2763          "symbol_name": "StreamResponse",
2764          "doc_url": "/docs/api/llm/responses#stream-response"
2765        },
2766        "parameters": [
2767          {
2768            "type_str": "FormattableT",
2769            "description": null,
2770            "kind": "simple",
2771            "symbol_name": "FormattableT",
2772            "doc_url": "/docs/api/llm/formatting#formattable-t"
2773          }
2774        ],
2775        "doc_url": null
2776      }
2777    ],
2778    "doc_url": null
2779  },
2780  "description": "A new \`StreamResponse\` instance generated from the extended message history."
2781}}
2782/>
2783
2784
2785
2786## <ApiType type="Attribute" slug="stream-response-chunk" symbolName="StreamResponseChunk" /> StreamResponseChunk
2787
2788**Type:** <TypeLink type={{"type_str": "TypeAlias", "description": null, "kind": "simple", "symbol_name": "TypeAlias", "doc_url": null}} />
2789
2790
2791## <ApiType type="Attribute" slug="stream-response-t" symbolName="StreamResponseT" /> StreamResponseT
2792
2793**Type:** <TypeLink type={{"type_str": "TypeVar('StreamResponseT', bound='BaseStreamResponse[Any, Any, Any]')", "description": null, "kind": "simple", "symbol_name": null, "doc_url": null}} />
2794
2795
2796## <ApiType type="Class" slug="text-stream" symbolName="TextStream" /> TextStream
2797
2798Synchronous text stream implementation.
2799
2800**Bases:** 
2801<TypeLink type={{"type_str": "BaseStream[Text, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseStream", "description": null, "kind": "simple", "symbol_name": "BaseStream", "doc_url": null}, "parameters": [{"type_str": "Text", "description": null, "kind": "simple", "symbol_name": "Text", "doc_url": "/docs/api/llm/content#text"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
2802
2803<AttributesTable
2804  attributes={[
2805  {
2806    "name": "type",
2807    "type_info": {
2808      "type_str": "Literal['text_stream']",
2809      "description": null,
2810      "kind": "generic",
2811      "base_type": {
2812        "type_str": "Literal",
2813        "description": null,
2814        "kind": "simple",
2815        "symbol_name": "Literal",
2816        "doc_url": null
2817      },
2818      "parameters": [
2819        {
2820          "type_str": "'text_stream'",
2821          "description": null,
2822          "kind": "simple",
2823          "symbol_name": "'text_stream'",
2824          "doc_url": null
2825        }
2826      ],
2827      "doc_url": null
2828    }
2829  },
2830  {
2831    "name": "content_type",
2832    "type_info": {
2833      "type_str": "Literal['text']",
2834      "description": null,
2835      "kind": "generic",
2836      "base_type": {
2837        "type_str": "Literal",
2838        "description": null,
2839        "kind": "simple",
2840        "symbol_name": "Literal",
2841        "doc_url": null
2842      },
2843      "parameters": [
2844        {
2845          "type_str": "'text'",
2846          "description": null,
2847          "kind": "simple",
2848          "symbol_name": "'text'",
2849          "doc_url": null
2850        }
2851      ],
2852      "doc_url": null
2853    },
2854    "description": "The type of content stored in this stream."
2855  },
2856  {
2857    "name": "partial_text",
2858    "type_info": {
2859      "type_str": "str",
2860      "description": null,
2861      "kind": "simple",
2862      "symbol_name": "str",
2863      "doc_url": null
2864    },
2865    "description": "The accumulated text content as chunks are received."
2866  }
2867]}
2868/>
2869
2870## <ApiType type="Function" slug="mirascope-llm-responses-streams--text-stream-collect" symbolName="collect" /> collect
2871
2872Collect all chunks and return the final Text content.
2873
2874<ParametersTable
2875  parameters={[
2876  {
2877    "name": "self",
2878    "type_info": {
2879      "type_str": "Any",
2880      "description": null,
2881      "kind": "simple",
2882      "symbol_name": null,
2883      "doc_url": null
2884    }
2885  }
2886]}
2887/>
2888
2889<ReturnTable
2890  returnType={{
2891  "type_info": {
2892    "type_str": "Text",
2893    "description": null,
2894    "kind": "simple",
2895    "symbol_name": "Text",
2896    "doc_url": "/docs/api/llm/content#text"
2897  },
2898  "description": "The complete text content after consuming all chunks."
2899}}
2900/>
2901
2902
2903
2904## <ApiType type="Class" slug="thought-stream" symbolName="ThoughtStream" /> ThoughtStream
2905
2906Synchronous thought stream implementation.
2907
2908**Bases:** 
2909<TypeLink type={{"type_str": "BaseStream[Thought, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseStream", "description": null, "kind": "simple", "symbol_name": "BaseStream", "doc_url": null}, "parameters": [{"type_str": "Thought", "description": null, "kind": "simple", "symbol_name": "Thought", "doc_url": "/docs/api/llm/content#thought"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
2910
2911<AttributesTable
2912  attributes={[
2913  {
2914    "name": "type",
2915    "type_info": {
2916      "type_str": "Literal['thought_stream']",
2917      "description": null,
2918      "kind": "generic",
2919      "base_type": {
2920        "type_str": "Literal",
2921        "description": null,
2922        "kind": "simple",
2923        "symbol_name": "Literal",
2924        "doc_url": null
2925      },
2926      "parameters": [
2927        {
2928          "type_str": "'thought_stream'",
2929          "description": null,
2930          "kind": "simple",
2931          "symbol_name": "'thought_stream'",
2932          "doc_url": null
2933        }
2934      ],
2935      "doc_url": null
2936    }
2937  },
2938  {
2939    "name": "content_type",
2940    "type_info": {
2941      "type_str": "Literal['thought']",
2942      "description": null,
2943      "kind": "generic",
2944      "base_type": {
2945        "type_str": "Literal",
2946        "description": null,
2947        "kind": "simple",
2948        "symbol_name": "Literal",
2949        "doc_url": null
2950      },
2951      "parameters": [
2952        {
2953          "type_str": "'thought'",
2954          "description": null,
2955          "kind": "simple",
2956          "symbol_name": "'thought'",
2957          "doc_url": null
2958        }
2959      ],
2960      "doc_url": null
2961    },
2962    "description": "The type of content stored in this stream."
2963  },
2964  {
2965    "name": "partial_thought",
2966    "type_info": {
2967      "type_str": "str",
2968      "description": null,
2969      "kind": "simple",
2970      "symbol_name": "str",
2971      "doc_url": null
2972    },
2973    "description": "The accumulated thought content as chunks are received."
2974  }
2975]}
2976/>
2977
2978## <ApiType type="Function" slug="mirascope-llm-responses-streams--thought-stream-collect" symbolName="collect" /> collect
2979
2980Collect all chunks and return the final Thought content.
2981
2982<ParametersTable
2983  parameters={[
2984  {
2985    "name": "self",
2986    "type_info": {
2987      "type_str": "Any",
2988      "description": null,
2989      "kind": "simple",
2990      "symbol_name": null,
2991      "doc_url": null
2992    }
2993  }
2994]}
2995/>
2996
2997<ReturnTable
2998  returnType={{
2999  "type_info": {
3000    "type_str": "Thought",
3001    "description": null,
3002    "kind": "simple",
3003    "symbol_name": "Thought",
3004    "doc_url": "/docs/api/llm/content#thought"
3005  },
3006  "description": "The complete thought content after consuming all chunks."
3007}}
3008/>
3009
3010
3011
3012## <ApiType type="Class" slug="tool-call-stream" symbolName="ToolCallStream" /> ToolCallStream
3013
3014Synchronous tool call stream implementation.
3015
3016**Bases:** 
3017<TypeLink type={{"type_str": "BaseStream[ToolCall, str]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseStream", "description": null, "kind": "simple", "symbol_name": "BaseStream", "doc_url": null}, "parameters": [{"type_str": "ToolCall", "description": null, "kind": "simple", "symbol_name": "ToolCall", "doc_url": "/docs/api/llm/content#tool-call"}, {"type_str": "str", "description": null, "kind": "simple", "symbol_name": "str", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}], "doc_url": null}} />
3018
3019<AttributesTable
3020  attributes={[
3021  {
3022    "name": "type",
3023    "type_info": {
3024      "type_str": "Literal['tool_call_stream']",
3025      "description": null,
3026      "kind": "generic",
3027      "base_type": {
3028        "type_str": "Literal",
3029        "description": null,
3030        "kind": "simple",
3031        "symbol_name": "Literal",
3032        "doc_url": null
3033      },
3034      "parameters": [
3035        {
3036          "type_str": "'tool_call_stream'",
3037          "description": null,
3038          "kind": "simple",
3039          "symbol_name": "'tool_call_stream'",
3040          "doc_url": null
3041        }
3042      ],
3043      "doc_url": null
3044    }
3045  },
3046  {
3047    "name": "content_type",
3048    "type_info": {
3049      "type_str": "Literal['tool_call']",
3050      "description": null,
3051      "kind": "generic",
3052      "base_type": {
3053        "type_str": "Literal",
3054        "description": null,
3055        "kind": "simple",
3056        "symbol_name": "Literal",
3057        "doc_url": null
3058      },
3059      "parameters": [
3060        {
3061          "type_str": "'tool_call'",
3062          "description": null,
3063          "kind": "simple",
3064          "symbol_name": "'tool_call'",
3065          "doc_url": null
3066        }
3067      ],
3068      "doc_url": null
3069    },
3070    "description": "The type of content stored in this stream."
3071  },
3072  {
3073    "name": "tool_id",
3074    "type_info": {
3075      "type_str": "str",
3076      "description": null,
3077      "kind": "simple",
3078      "symbol_name": "str",
3079      "doc_url": null
3080    },
3081    "description": "A unique identifier for this tool call."
3082  },
3083  {
3084    "name": "tool_name",
3085    "type_info": {
3086      "type_str": "str",
3087      "description": null,
3088      "kind": "simple",
3089      "symbol_name": "str",
3090      "doc_url": null
3091    },
3092    "description": "The name of the tool being called."
3093  },
3094  {
3095    "name": "partial_args",
3096    "type_info": {
3097      "type_str": "str",
3098      "description": null,
3099      "kind": "simple",
3100      "symbol_name": "str",
3101      "doc_url": null
3102    },
3103    "description": "The accumulated tool arguments as chunks are received."
3104  }
3105]}
3106/>
3107
3108## <ApiType type="Function" slug="mirascope-llm-responses-streams--tool-call-stream-collect" symbolName="collect" /> collect
3109
3110Collect all chunks and return the final ToolCall content.
3111
3112<ParametersTable
3113  parameters={[
3114  {
3115    "name": "self",
3116    "type_info": {
3117      "type_str": "Any",
3118      "description": null,
3119      "kind": "simple",
3120      "symbol_name": null,
3121      "doc_url": null
3122    }
3123  }
3124]}
3125/>
3126
3127<ReturnTable
3128  returnType={{
3129  "type_info": {
3130    "type_str": "ToolCall",
3131    "description": null,
3132    "kind": "simple",
3133    "symbol_name": "ToolCall",
3134    "doc_url": "/docs/api/llm/content#tool-call"
3135  },
3136  "description": "The complete tool call after consuming all chunks."
3137}}
3138/>
3139
3140
3141
3142## <ApiType type="Class" slug="usage" symbolName="Usage" /> Usage
3143
3144Token usage statistics from an LLM API call.
3145
3146This abstraction captures common usage metrics across providers while preserving
3147access to the raw provider-specific usage data.
3148
3149<AttributesTable
3150  attributes={[
3151  {
3152    "name": "input_tokens",
3153    "type_info": {
3154      "type_str": "int",
3155      "description": null,
3156      "kind": "simple",
3157      "symbol_name": "int",
3158      "doc_url": null
3159    },
3160    "description": "The number of input tokens used.\\n\\nThis includes ALL input tokens, including cache read and write tokens.\\n\\nWill be 0 if not reported by the provider."
3161  },
3162  {
3163    "name": "output_tokens",
3164    "type_info": {
3165      "type_str": "int",
3166      "description": null,
3167      "kind": "simple",
3168      "symbol_name": "int",
3169      "doc_url": null
3170    },
3171    "description": "The number of output tokens used.\\n\\nThis includes ALL output tokens, including \`reasoning_tokens\` that may not be\\nin the user's visible output, or other \\"hidden\\" tokens.\\n\\nWill be 0 if not reported by the provider."
3172  },
3173  {
3174    "name": "cache_read_tokens",
3175    "type_info": {
3176      "type_str": "int",
3177      "description": null,
3178      "kind": "simple",
3179      "symbol_name": "int",
3180      "doc_url": null
3181    },
3182    "description": "The number of tokens read from cache (prompt caching).\\n\\nThese are input tokens that were read from cache. Cache read tokens are generally\\nmuch less expensive than regular input tokens.\\n\\nWill be 0 if not reported by the provider or if caching was not used."
3183  },
3184  {
3185    "name": "cache_write_tokens",
3186    "type_info": {
3187      "type_str": "int",
3188      "description": null,
3189      "kind": "simple",
3190      "symbol_name": "int",
3191      "doc_url": null
3192    },
3193    "description": "The number of tokens written to cache (cache creation).\\n\\nThese are input tokens that were written to cache, for future reuse and retrieval.\\nCache write tokens are generally more expensive than uncached input tokens,\\nbut may lead to cost savings down the line when they are re-read as cache_read_tokens.\\n\\nWill be 0 if not reported by the provider or if caching was not used."
3194  },
3195  {
3196    "name": "reasoning_tokens",
3197    "type_info": {
3198      "type_str": "int",
3199      "description": null,
3200      "kind": "simple",
3201      "symbol_name": "int",
3202      "doc_url": null
3203    },
3204    "description": "The number of tokens used for reasoning/thinking.\\n\\nReasoning tokens are a subset of output_tokens that were generated as part of the model's\\ninterior reasoning process. They are billed as output tokens, though they are generally\\nnot shown to the user.\\n\\nWill be 0 if not reported by the provider or if the model does not support reasoning."
3205  },
3206  {
3207    "name": "raw",
3208    "type_info": {
3209      "type_str": "Any",
3210      "description": null,
3211      "kind": "simple",
3212      "symbol_name": "Any",
3213      "doc_url": null
3214    },
3215    "description": "The raw usage object from the provider."
3216  },
3217  {
3218    "name": "total_tokens",
3219    "type_info": {
3220      "type_str": "int",
3221      "description": null,
3222      "kind": "simple",
3223      "symbol_name": "int",
3224      "doc_url": null
3225    },
3226    "description": "The total number of tokens used (input + output)."
3227  }
3228]}
3229/>
3230
3231
3232## <ApiType type="Class" slug="usage-delta-chunk" symbolName="UsageDeltaChunk" /> UsageDeltaChunk
3233
3234A chunk containing incremental token usage information from a streaming response.
3235
3236This represents a delta/increment in usage statistics as they arrive during streaming.
3237Multiple UsageDeltaChunks are accumulated to produce the final Usage object.
3238
3239<AttributesTable
3240  attributes={[
3241  {
3242    "name": "type",
3243    "type_info": {
3244      "type_str": "Literal['usage_delta_chunk']",
3245      "description": null,
3246      "kind": "generic",
3247      "base_type": {
3248        "type_str": "Literal",
3249        "description": null,
3250        "kind": "simple",
3251        "symbol_name": "Literal",
3252        "doc_url": null
3253      },
3254      "parameters": [
3255        {
3256          "type_str": "'usage_delta_chunk'",
3257          "description": null,
3258          "kind": "simple",
3259          "symbol_name": "'usage_delta_chunk'",
3260          "doc_url": null
3261        }
3262      ],
3263      "doc_url": null
3264    }
3265  },
3266  {
3267    "name": "input_tokens",
3268    "type_info": {
3269      "type_str": "int",
3270      "description": null,
3271      "kind": "simple",
3272      "symbol_name": "int",
3273      "doc_url": null
3274    },
3275    "description": "Delta in input tokens."
3276  },
3277  {
3278    "name": "output_tokens",
3279    "type_info": {
3280      "type_str": "int",
3281      "description": null,
3282      "kind": "simple",
3283      "symbol_name": "int",
3284      "doc_url": null
3285    },
3286    "description": "Delta in output tokens."
3287  },
3288  {
3289    "name": "cache_read_tokens",
3290    "type_info": {
3291      "type_str": "int",
3292      "description": null,
3293      "kind": "simple",
3294      "symbol_name": "int",
3295      "doc_url": null
3296    },
3297    "description": "Delta in cache read tokens."
3298  },
3299  {
3300    "name": "cache_write_tokens",
3301    "type_info": {
3302      "type_str": "int",
3303      "description": null,
3304      "kind": "simple",
3305      "symbol_name": "int",
3306      "doc_url": null
3307    },
3308    "description": "Delta in cache write tokens."
3309  },
3310  {
3311    "name": "reasoning_tokens",
3312    "type_info": {
3313      "type_str": "int",
3314      "description": null,
3315      "kind": "simple",
3316      "symbol_name": "int",
3317      "doc_url": null
3318    },
3319    "description": "Delta in reasoning/thinking tokens."
3320  }
3321]}
3322/>
3323
3324
3325`};export{n as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.