---
# AUTO-GENERATED API DOCUMENTATION - DO NOT EDIT
title: calls
description: API documentation for calls
---

# calls

## <ApiType type="Class" slug="async-call" symbolName="AsyncCall" /> AsyncCall

An async call that directly generates LLM responses without requiring a model argument.

Created by decorating an async `MessageTemplate` with `llm.call`. The decorated async
function becomes directly callable to generate responses asynchronously, with the `Model` bundled in.

An `AsyncCall` is essentially: async `MessageTemplate` + tools + format + `Model`.
It can be invoked directly: `await call(*args, **kwargs)` (no model argument needed).

The model can be overridden at runtime using `with llm.model(...)` context manager.

**Bases:** 
<TypeLink type={{"type_str": "BaseCall", "description": null, "kind": "simple", "symbol_name": "BaseCall", "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[P, 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": "P", "description": null, "kind": "simple", "symbol_name": "P", "doc_url": "/docs/mirascope/v2/api/llm/types#p"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"}], "doc_url": null}} />

<AttributesTable
  attributes={[
  {
    "name": "prompt",
    "type_info": {
      "type_str": "AsyncPrompt[P, FormattableT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "AsyncPrompt",
        "description": null,
        "kind": "simple",
        "symbol_name": "AsyncPrompt",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "P",
          "description": null,
          "kind": "simple",
          "symbol_name": "P",
          "doc_url": null
        },
        {
          "type_str": "FormattableT",
          "description": null,
          "kind": "simple",
          "symbol_name": "FormattableT",
          "doc_url": null
        }
      ],
      "doc_url": null
    },
    "description": "The underlying AsyncPrompt instance that generates messages with tools and format."
  }
]}
/>

## <ApiType type="Function" slug="mirascope-llm-calls-calls--async-call-call" symbolName="call" /> call

Generates a response using the LLM asynchronously.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "AsyncResponse | AsyncResponse[FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "AsyncResponse",
        "description": null,
        "kind": "simple",
        "symbol_name": "AsyncResponse",
        "doc_url": "/docs/mirascope/v2/api/llm/responses#async-response"
      },
      {
        "type_str": "AsyncResponse[FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-response"
        },
        "parameters": [
          {
            "type_str": "FormattableT",
            "description": null,
            "kind": "simple",
            "symbol_name": "FormattableT",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>


## <ApiType type="Function" slug="mirascope-llm-calls-calls--async-call-stream" symbolName="stream" /> stream

Generates a streaming response using the LLM asynchronously.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "AsyncStreamResponse[FormattableT] | AsyncStreamResponse",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "AsyncStreamResponse[FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncStreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncStreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-stream-response"
        },
        "parameters": [
          {
            "type_str": "FormattableT",
            "description": null,
            "kind": "simple",
            "symbol_name": "FormattableT",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      },
      {
        "type_str": "AsyncStreamResponse",
        "description": null,
        "kind": "simple",
        "symbol_name": "AsyncStreamResponse",
        "doc_url": "/docs/mirascope/v2/api/llm/responses#async-stream-response"
      }
    ],
    "doc_url": null
  }
}}
/>



## <ApiType type="Class" slug="async-context-call" symbolName="AsyncContextCall" /> AsyncContextCall

An async context-aware call that directly generates LLM responses without requiring a model argument.

Created by decorating an async `ContextMessageTemplate` with `llm.call`. The decorated async
function (with first parameter `'ctx'` of type `Context[DepsT]`) becomes directly callable to generate
responses asynchronously with context dependencies, with the `Model` bundled in.

An `AsyncContextCall` is essentially: async `ContextMessageTemplate` + tools + format + `Model`.
It can be invoked directly: `await call(ctx, *args, **kwargs)` (no model argument needed).

The model can be overridden at runtime using `with llm.model(...)` context manager.

**Bases:** 
<TypeLink type={{"type_str": "BaseCall", "description": null, "kind": "simple", "symbol_name": "BaseCall", "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[P, 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": "P", "description": null, "kind": "simple", "symbol_name": "P", "doc_url": "/docs/mirascope/v2/api/llm/types#p"}, {"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/mirascope/v2/api/llm/formatting#formattable-t"}], "doc_url": null}} />

<AttributesTable
  attributes={[
  {
    "name": "prompt",
    "type_info": {
      "type_str": "AsyncContextPrompt[P, DepsT, FormattableT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "AsyncContextPrompt",
        "description": null,
        "kind": "simple",
        "symbol_name": "AsyncContextPrompt",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "P",
          "description": null,
          "kind": "simple",
          "symbol_name": "P",
          "doc_url": null
        },
        {
          "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": null
        }
      ],
      "doc_url": null
    },
    "description": "The underlying AsyncContextPrompt instance that generates messages with tools and format."
  }
]}
/>

## <ApiType type="Function" slug="mirascope-llm-calls-calls--async-context-call-call" symbolName="call" /> call

Generates a response using the LLM asynchronously.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "ctx",
    "type_info": {
      "type_str": "Context[DepsT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Context",
        "description": null,
        "kind": "simple",
        "symbol_name": "Context",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "DepsT",
          "description": null,
          "kind": "simple",
          "symbol_name": "DepsT",
          "doc_url": null
        }
      ],
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "AsyncContextResponse[DepsT, None] | AsyncContextResponse[DepsT, FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "AsyncContextResponse[DepsT, None]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncContextResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncContextResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-context-response"
        },
        "parameters": [
          {
            "type_str": "DepsT",
            "description": null,
            "kind": "simple",
            "symbol_name": "DepsT",
            "doc_url": null
          },
          {
            "type_str": "None",
            "description": null,
            "kind": "simple",
            "symbol_name": "None",
            "doc_url": "https://docs.python.org/3/library/constants.html#None"
          }
        ],
        "doc_url": null
      },
      {
        "type_str": "AsyncContextResponse[DepsT, FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncContextResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncContextResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-context-response"
        },
        "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/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>


## <ApiType type="Function" slug="mirascope-llm-calls-calls--async-context-call-stream" symbolName="stream" /> stream

Generates a streaming response using the LLM asynchronously.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "ctx",
    "type_info": {
      "type_str": "Context[DepsT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Context",
        "description": null,
        "kind": "simple",
        "symbol_name": "Context",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "DepsT",
          "description": null,
          "kind": "simple",
          "symbol_name": "DepsT",
          "doc_url": null
        }
      ],
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "AsyncContextStreamResponse[DepsT, None] | AsyncContextStreamResponse[DepsT, FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "AsyncContextStreamResponse[DepsT, None]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncContextStreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncContextStreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-context-stream-response"
        },
        "parameters": [
          {
            "type_str": "DepsT",
            "description": null,
            "kind": "simple",
            "symbol_name": "DepsT",
            "doc_url": null
          },
          {
            "type_str": "None",
            "description": null,
            "kind": "simple",
            "symbol_name": "None",
            "doc_url": "https://docs.python.org/3/library/constants.html#None"
          }
        ],
        "doc_url": null
      },
      {
        "type_str": "AsyncContextStreamResponse[DepsT, FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "AsyncContextStreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "AsyncContextStreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#async-context-stream-response"
        },
        "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/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>



## <ApiType type="Class" slug="call" symbolName="Call" /> Call

A call that directly generates LLM responses without requiring a model argument.

Created by decorating a `MessageTemplate` with `llm.call`. The decorated function
becomes directly callable to generate responses, with the `Model` bundled in.

A `Call` is essentially: `MessageTemplate` + tools + format + `Model`.
It can be invoked directly: `call(*args, **kwargs)` (no model argument needed).

The model can be overridden at runtime using `with llm.model(...)` context manager.

**Bases:** 
<TypeLink type={{"type_str": "BaseCall", "description": null, "kind": "simple", "symbol_name": "BaseCall", "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[P, 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": "P", "description": null, "kind": "simple", "symbol_name": "P", "doc_url": "/docs/mirascope/v2/api/llm/types#p"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"}], "doc_url": null}} />

<AttributesTable
  attributes={[
  {
    "name": "prompt",
    "type_info": {
      "type_str": "Prompt[P, FormattableT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Prompt",
        "description": null,
        "kind": "simple",
        "symbol_name": "Prompt",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "P",
          "description": null,
          "kind": "simple",
          "symbol_name": "P",
          "doc_url": null
        },
        {
          "type_str": "FormattableT",
          "description": null,
          "kind": "simple",
          "symbol_name": "FormattableT",
          "doc_url": null
        }
      ],
      "doc_url": null
    },
    "description": "The underlying Prompt instance that generates messages with tools and format."
  }
]}
/>

## <ApiType type="Function" slug="mirascope-llm-calls-calls--call-call" symbolName="call" /> call

Generates a response using the LLM.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "Response | Response[FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "Response",
        "description": null,
        "kind": "simple",
        "symbol_name": "Response",
        "doc_url": "/docs/mirascope/v2/api/llm/responses#response"
      },
      {
        "type_str": "Response[FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "Response",
          "description": null,
          "kind": "simple",
          "symbol_name": "Response",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#response"
        },
        "parameters": [
          {
            "type_str": "FormattableT",
            "description": null,
            "kind": "simple",
            "symbol_name": "FormattableT",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>


## <ApiType type="Function" slug="mirascope-llm-calls-calls--call-stream" symbolName="stream" /> stream

Generates a streaming response using the LLM.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "StreamResponse | StreamResponse[FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "StreamResponse",
        "description": null,
        "kind": "simple",
        "symbol_name": "StreamResponse",
        "doc_url": "/docs/mirascope/v2/api/llm/responses#stream-response"
      },
      {
        "type_str": "StreamResponse[FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "StreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "StreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#stream-response"
        },
        "parameters": [
          {
            "type_str": "FormattableT",
            "description": null,
            "kind": "simple",
            "symbol_name": "FormattableT",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>



## <ApiType type="Class" slug="call-decorator" symbolName="CallDecorator" /> CallDecorator

Decorator for converting a `MessageTemplate` into a `Call`.

Takes a raw prompt function that returns message content and wraps it with tools,
format, and a model to create a `Call` that can be invoked directly without needing
to pass a model argument.

The decorator automatically detects whether the function is async or context-aware
and creates the appropriate `Call` variant (`Call`, `AsyncCall`, `ContextCall`, or `AsyncContextCall`).

Conceptually: `CallDecorator` = `PromptDecorator` + `Model`
Result: `Call` = `MessageTemplate` + tools + format + `Model`

**Bases:** 
<TypeLink type={{"type_str": "Generic[ToolT, 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": "ToolT", "description": null, "kind": "simple", "symbol_name": "ToolT", "doc_url": "/docs/mirascope/v2/api/llm/tools#tool-t"}, {"type_str": "FormattableT", "description": null, "kind": "simple", "symbol_name": "FormattableT", "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"}], "doc_url": null}} />

<AttributesTable
  attributes={[
  {
    "name": "model",
    "type_info": {
      "type_str": "Model",
      "description": null,
      "kind": "simple",
      "symbol_name": "Model",
      "doc_url": null
    },
    "description": "The default model to use with this call. May be overridden."
  },
  {
    "name": "tools",
    "type_info": {
      "type_str": "Sequence[ToolT] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "symbol_name": "Union",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "Sequence[ToolT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "Sequence",
            "description": null,
            "kind": "simple",
            "symbol_name": "Sequence",
            "doc_url": null
          },
          "parameters": [
            {
              "type_str": "ToolT",
              "description": null,
              "kind": "simple",
              "symbol_name": "ToolT",
              "doc_url": null
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "symbol_name": "None",
          "doc_url": null
        }
      ],
      "doc_url": null
    },
    "description": "The tools that are included in the prompt, if any."
  },
  {
    "name": "format",
    "type_info": {
      "type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "symbol_name": "Union",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "type[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "type",
            "description": null,
            "kind": "simple",
            "symbol_name": "type",
            "doc_url": null
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": null
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "Format[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "Format",
            "description": null,
            "kind": "simple",
            "symbol_name": "Format",
            "doc_url": null
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": null
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "OutputParser[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "OutputParser",
            "description": null,
            "kind": "simple",
            "symbol_name": "OutputParser",
            "doc_url": null
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": null
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "symbol_name": "None",
          "doc_url": null
        }
      ],
      "doc_url": null
    },
    "description": "The structured output format off the prompt, if any."
  }
]}
/>


## <ApiType type="Attribute" slug="call-t" symbolName="CallT" /> CallT

**Type:** <TypeLink type={{"type_str": "TypeVar('CallT', bound='BaseCall')", "description": null, "kind": "simple", "symbol_name": null, "doc_url": null}} />


## <ApiType type="Class" slug="context-call" symbolName="ContextCall" /> ContextCall

A context-aware call that directly generates LLM responses without requiring a model argument.

Created by decorating a `ContextMessageTemplate` with `llm.call`. The decorated function
(with first parameter `'ctx'` of type `Context[DepsT]`) becomes directly callable to generate
responses with context dependencies, with the `Model` bundled in.

A `ContextCall` is essentially: `ContextMessageTemplate` + tools + format + `Model`.
It can be invoked directly: `call(ctx, *args, **kwargs)` (no model argument needed).

The model can be overridden at runtime using `with llm.model(...)` context manager.

**Bases:** 
<TypeLink type={{"type_str": "BaseCall", "description": null, "kind": "simple", "symbol_name": "BaseCall", "doc_url": null}} />, <TypeLink type={{"type_str": "Generic[P, 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": "P", "description": null, "kind": "simple", "symbol_name": "P", "doc_url": "/docs/mirascope/v2/api/llm/types#p"}, {"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/mirascope/v2/api/llm/formatting#formattable-t"}], "doc_url": null}} />

<AttributesTable
  attributes={[
  {
    "name": "prompt",
    "type_info": {
      "type_str": "ContextPrompt[P, DepsT, FormattableT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "ContextPrompt",
        "description": null,
        "kind": "simple",
        "symbol_name": "ContextPrompt",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "P",
          "description": null,
          "kind": "simple",
          "symbol_name": "P",
          "doc_url": null
        },
        {
          "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": null
        }
      ],
      "doc_url": null
    },
    "description": "The underlying ContextPrompt instance that generates messages with tools and format."
  }
]}
/>

## <ApiType type="Function" slug="mirascope-llm-calls-calls--context-call-call" symbolName="call" /> call

Generates a response using the LLM.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "ctx",
    "type_info": {
      "type_str": "Context[DepsT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Context",
        "description": null,
        "kind": "simple",
        "symbol_name": "Context",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "DepsT",
          "description": null,
          "kind": "simple",
          "symbol_name": "DepsT",
          "doc_url": null
        }
      ],
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "ContextResponse[DepsT, None] | ContextResponse[DepsT, FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "ContextResponse[DepsT, None]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "ContextResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "ContextResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#context-response"
        },
        "parameters": [
          {
            "type_str": "DepsT",
            "description": null,
            "kind": "simple",
            "symbol_name": "DepsT",
            "doc_url": null
          },
          {
            "type_str": "None",
            "description": null,
            "kind": "simple",
            "symbol_name": "None",
            "doc_url": "https://docs.python.org/3/library/constants.html#None"
          }
        ],
        "doc_url": null
      },
      {
        "type_str": "ContextResponse[DepsT, FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "ContextResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "ContextResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#context-response"
        },
        "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/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>


## <ApiType type="Function" slug="mirascope-llm-calls-calls--context-call-stream" symbolName="stream" /> stream

Generates a streaming response using the LLM.

<ParametersTable
  parameters={[
  {
    "name": "self",
    "type_info": {
      "type_str": "Any",
      "description": null,
      "kind": "simple",
      "symbol_name": null,
      "doc_url": null
    }
  },
  {
    "name": "ctx",
    "type_info": {
      "type_str": "Context[DepsT]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Context",
        "description": null,
        "kind": "simple",
        "symbol_name": "Context",
        "doc_url": null
      },
      "parameters": [
        {
          "type_str": "DepsT",
          "description": null,
          "kind": "simple",
          "symbol_name": "DepsT",
          "doc_url": null
        }
      ],
      "doc_url": null
    }
  },
  {
    "name": "args",
    "type_info": {
      "type_str": "P.args",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.args",
      "doc_url": null
    },
    "default": "()"
  },
  {
    "name": "kwargs",
    "type_info": {
      "type_str": "P.kwargs",
      "description": null,
      "kind": "simple",
      "symbol_name": "P.kwargs",
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "ContextStreamResponse[DepsT, None] | ContextStreamResponse[DepsT, FormattableT]",
    "description": null,
    "kind": "union",
    "base_type": {
      "type_str": "Union",
      "description": null,
      "kind": "simple",
      "symbol_name": "Union",
      "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
    },
    "parameters": [
      {
        "type_str": "ContextStreamResponse[DepsT, None]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "ContextStreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "ContextStreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#context-stream-response"
        },
        "parameters": [
          {
            "type_str": "DepsT",
            "description": null,
            "kind": "simple",
            "symbol_name": "DepsT",
            "doc_url": null
          },
          {
            "type_str": "None",
            "description": null,
            "kind": "simple",
            "symbol_name": "None",
            "doc_url": "https://docs.python.org/3/library/constants.html#None"
          }
        ],
        "doc_url": null
      },
      {
        "type_str": "ContextStreamResponse[DepsT, FormattableT]",
        "description": null,
        "kind": "generic",
        "base_type": {
          "type_str": "ContextStreamResponse",
          "description": null,
          "kind": "simple",
          "symbol_name": "ContextStreamResponse",
          "doc_url": "/docs/mirascope/v2/api/llm/responses#context-stream-response"
        },
        "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/mirascope/v2/api/llm/formatting#formattable-t"
          }
        ],
        "doc_url": null
      }
    ],
    "doc_url": null
  }
}}
/>



## <ApiType type="Function" slug="call_fn" symbolName="call" /> call

Decorates a `MessageTemplate` to create a `Call` that can be invoked directly.

The `llm.call` decorator is the most convenient way to use Mirascope. It transforms
a raw prompt function (that returns message content) into a `Call` object that bundles
the function with tools, format, and a model. The resulting `Call` can be invoked
directly to generate LLM responses without needing to pass a model argument.

The decorator automatically detects the function type:
- If the first parameter is named `'ctx'` with type `llm.Context[T]` (or a subclass thereof),
  creates a `ContextCall`
- If the function is async, creates an `AsyncCall` or `AsyncContextCall`
- Otherwise, creates a regular `Call`

The model specified in the decorator can be overridden at runtime using the
`llm.model()` context manager. When overridden, the context model completely
replaces the decorated model, including all parameters.

Conceptual flow:
- `MessageTemplate`: raw function returning content
- `@llm.prompt`: `MessageTemplate` → `Prompt`
  Includes tools and format, if applicable. Can be called by providing a `Model`.
- `@llm.call`: `MessageTemplate` → `Call`. Includes a model, tools, and format. The
  model may be created on the fly from a model identifier and optional params, or
  provided outright.

Example:

    Regular call:
    ```python
    from mirascope import llm

    @llm.call("openai/gpt-4")
    def recommend_book(genre: str):
        return f"Please recommend a book in {genre}."

    response: llm.Response = recommend_book("fantasy")
    print(response.pretty())
    ```

Example:

    Context call:
    ```python
    from dataclasses import dataclass
    from mirascope import llm

    @dataclass
    class User:
        name: str
        age: int

    @llm.call("openai/gpt-4")
    def recommend_book(ctx: llm.Context[User], genre: str):
        return f"Recommend a {genre} book for {ctx.deps.name}, age {ctx.deps.age}."

    ctx = llm.Context(deps=User(name="Alice", age=15))
    response = recommend_book(ctx, "fantasy")
    print(response.pretty())
    ```

<ParametersTable
  parameters={[
  {
    "name": "model",
    "type_info": {
      "type_str": "ModelId | Model",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "symbol_name": "Union",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "ModelId",
          "description": null,
          "kind": "simple",
          "symbol_name": "ModelId",
          "doc_url": "/docs/mirascope/v2/api/llm/providers#model-id"
        },
        {
          "type_str": "Model",
          "description": null,
          "kind": "simple",
          "symbol_name": "Model",
          "doc_url": "/docs/mirascope/v2/api/llm/models#model"
        }
      ],
      "doc_url": null
    },
    "description": "A model ID string (e.g., \"openai/gpt-4\") or a `Model` instance"
  },
  {
    "name": "tools",
    "type_info": {
      "type_str": "Sequence[ToolT] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "symbol_name": "Union",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "Sequence[ToolT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "Sequence",
            "description": null,
            "kind": "simple",
            "symbol_name": "Sequence",
            "doc_url": "https://docs.python.org/3/library/typing.html#typing.Sequence"
          },
          "parameters": [
            {
              "type_str": "ToolT",
              "description": null,
              "kind": "simple",
              "symbol_name": "ToolT",
              "doc_url": "/docs/mirascope/v2/api/llm/tools#tool-t"
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "symbol_name": "None",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ],
      "doc_url": null
    },
    "default": "None",
    "description": "Optional `Sequence` of tools to make available to the LLM"
  },
  {
    "name": "format",
    "type_info": {
      "type_str": "type[FormattableT] | Format[FormattableT] | OutputParser[FormattableT] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "symbol_name": "Union",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "type[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "type",
            "description": null,
            "kind": "simple",
            "symbol_name": "type",
            "doc_url": "https://docs.python.org/3/library/functions.html#type"
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "Format[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "Format",
            "description": null,
            "kind": "simple",
            "symbol_name": "Format",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#format"
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "OutputParser[FormattableT]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "OutputParser",
            "description": null,
            "kind": "simple",
            "symbol_name": "OutputParser",
            "doc_url": "/docs/mirascope/v2/api/llm/formatting#output-parser"
          },
          "parameters": [
            {
              "type_str": "FormattableT",
              "description": null,
              "kind": "simple",
              "symbol_name": "FormattableT",
              "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
            }
          ],
          "doc_url": null
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "symbol_name": "None",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ],
      "doc_url": null
    },
    "default": "None",
    "description": "Optional response format class (`BaseModel`) or Format instance"
  },
  {
    "name": "params",
    "type_info": {
      "type_str": "Unpack[Params]",
      "description": null,
      "kind": "generic",
      "base_type": {
        "type_str": "Unpack",
        "description": null,
        "kind": "simple",
        "symbol_name": "Unpack",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Unpack"
      },
      "parameters": [
        {
          "type_str": "Params",
          "description": null,
          "kind": "simple",
          "symbol_name": "Params",
          "doc_url": "/docs/mirascope/v2/api/llm/models#params"
        }
      ],
      "doc_url": null
    },
    "default": "{}"
  }
]}
/>

<ReturnTable
  returnType={{
  "type_info": {
    "type_str": "CallDecorator[ToolT, FormattableT]",
    "description": null,
    "kind": "generic",
    "base_type": {
      "type_str": "CallDecorator",
      "description": null,
      "kind": "simple",
      "symbol_name": "CallDecorator",
      "doc_url": "/docs/mirascope/v2/api/llm/calls#call-decorator"
    },
    "parameters": [
      {
        "type_str": "ToolT",
        "description": null,
        "kind": "simple",
        "symbol_name": "ToolT",
        "doc_url": "/docs/mirascope/v2/api/llm/tools#tool-t"
      },
      {
        "type_str": "FormattableT",
        "description": null,
        "kind": "simple",
        "symbol_name": "FormattableT",
        "doc_url": "/docs/mirascope/v2/api/llm/formatting#formattable-t"
      }
    ],
    "doc_url": null
  },
  "description": "A `CallDecorator` that converts prompt functions into `Call` variants"
}}
/>


