---
# AUTO-GENERATED API DOCUMENTATION - DO NOT EDIT
title: mirascope.core.cohere.call_response_chunk
description: API documentation for mirascope.core.cohere.call_response_chunk
---

# mirascope.core.cohere.call_response_chunk

This module contains the `CohereCallResponseChunk` class.

<Info title="Usage">

[Streams](/docs/v1/learn/streams#handling-streamed-responses)

</Info>

## <ApiType type="Class" path="core/cohere/call_response_chunk" symbolName="CohereCallResponseChunk" /> CohereCallResponseChunk

A convenience wrapper around the Cohere `ChatCompletionChunk` streamed chunks.

When calling the Cohere API using a function decorated with `cohere_call` and
`stream` set to `True`, the stream will contain `CohereResponseChunk` instances with
properties that allow for more convenient access to commonly used attributes.

Example:

```python
from mirascope.core import prompt_template
from mirascope.core.cohere import cohere_call


@cohere_call("command-r-plus", stream=True)
def recommend_book(genre: str) -> str:
    return f"Recommend a {genre} book"


stream = recommend_book("fantasy")  # response is an `CohereStream`
for chunk, _ in stream:
    print(chunk.content, end="", flush=True)
```

**Bases:** 
<TypeLink type={{"type_str": "BaseCallResponseChunk[SkipValidation[StreamedChatResponse], ChatStreamEndEventFinishReason]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseCallResponseChunk", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/base/call_response_chunk#basecallresponsechunk"}, "parameters": [{"type_str": "SkipValidation[StreamedChatResponse]", "description": null, "kind": "generic", "base_type": {"type_str": "SkipValidation", "description": null, "kind": "simple", "doc_url": "https://docs.pydantic.dev/latest/api/functional_validators/#pydantic.functional_validators.SkipValidation"}, "parameters": [{"type_str": "StreamedChatResponse", "description": null, "kind": "simple", "doc_identifier": "StreamedChatResponse"}]}, {"type_str": "ChatStreamEndEventFinishReason", "description": null, "kind": "simple", "doc_identifier": "ChatStreamEndEventFinishReason"}]}} />

<AttributesTable
  attributes={[
  {
    "name": "content",
    "type_info": {
      "type_str": "str",
      "description": null,
      "kind": "simple",
      "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
    },
    "description": "Returns the content for the 0th choice delta."
  },
  {
    "name": "finish_reasons",
    "type_info": {
      "type_str": "list[ChatStreamEndEventFinishReason] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "list[ChatStreamEndEventFinishReason]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "list",
            "description": null,
            "kind": "simple",
            "doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
          },
          "parameters": [
            {
              "type_str": "ChatStreamEndEventFinishReason",
              "description": null,
              "kind": "simple",
              "doc_identifier": "ChatStreamEndEventFinishReason"
            }
          ]
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the finish reasons of the response."
  },
  {
    "name": "model",
    "type_info": {
      "type_str": "str | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "str",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the name of the response model.\n\nCohere does not return model, so we return None"
  },
  {
    "name": "id",
    "type_info": {
      "type_str": "str | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "str",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the id of the response."
  },
  {
    "name": "usage",
    "type_info": {
      "type_str": "ApiMetaBilledUnits | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "ApiMetaBilledUnits",
          "description": null,
          "kind": "simple",
          "doc_identifier": "ApiMetaBilledUnits"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the usage of the response."
  },
  {
    "name": "input_tokens",
    "type_info": {
      "type_str": "float | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "float",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/functions.html#float"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the number of input tokens."
  },
  {
    "name": "cached_tokens",
    "type_info": {
      "type_str": "float | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "float",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/functions.html#float"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the number of cached tokens."
  },
  {
    "name": "output_tokens",
    "type_info": {
      "type_str": "float | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "float",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/functions.html#float"
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    },
    "description": "Returns the number of output tokens."
  },
  {
    "name": "cost_metadata",
    "type_info": {
      "type_str": "CostMetadata",
      "description": null,
      "kind": "simple",
      "doc_url": "/docs/v1/api/core/base/types#costmetadata"
    },
    "description": "Returns the cost metadata."
  },
  {
    "name": "common_finish_reasons",
    "type_info": {
      "type_str": "list[types.FinishReason] | None",
      "description": null,
      "kind": "union",
      "base_type": {
        "type_str": "Union",
        "description": null,
        "kind": "simple",
        "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
      },
      "parameters": [
        {
          "type_str": "list[types.FinishReason]",
          "description": null,
          "kind": "generic",
          "base_type": {
            "type_str": "list",
            "description": null,
            "kind": "simple",
            "doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
          },
          "parameters": [
            {
              "type_str": "types.FinishReason",
              "description": null,
              "kind": "simple",
              "doc_identifier": "types.FinishReason"
            }
          ]
        },
        {
          "type_str": "None",
          "description": null,
          "kind": "simple",
          "doc_url": "https://docs.python.org/3/library/constants.html#None"
        }
      ]
    }
  }
]}
/>


