# `HuggingfaceClient.Inference.Types`
[🔗](https://github.com/huggingface/huggingface_client/blob/v0.1.0/lib/huggingface_client/inference/types.ex#L1)

Shared type definitions for the HuggingFace Inference API.

All structured response shapes are documented here as Elixir types.
These are primarily for `@spec` annotations and Dialyzer analysis.

Because provider JSON responses use string keys, the runtime values are
`%{String.t() => term()}` maps. The types here document the expected
shape using atoms for readability — see the field name notes in each typedoc.

# `asr_output`

```elixir
@type asr_output() :: map()
```

ASR transcription result: `%{"text" => string}`

# `audio_output`

```elixir
@type audio_output() :: map()
```

Audio-to-audio output element with label, content-type, and base64 blob

# `auth_method`

```elixir
@type auth_method() :: :hf_token | :provider_key | :credentials_include | :none
```

Authentication method resolved from the access token

# `binary_output`

```elixir
@type binary_output() :: binary()
```

Raw binary content (image, audio, or video bytes)

# `bounding_box`

```elixir
@type bounding_box() :: map()
```

Object detection bounding box: xmin, ymin, xmax, ymax

# `chat_completion_chunk`

```elixir
@type chat_completion_chunk() :: map()
```

A streaming chat completion delta chunk

# `chat_completion_output`

```elixir
@type chat_completion_output() :: map()
```

OpenAI-compatible chat completion response.

Keys (at runtime): `"id"`, `"object"`, `"created"`, `"model"`, `"choices"`, `"usage"`.

# `chat_message`

```elixir
@type chat_message() :: map()
```

A message in a chat conversation.

Runtime keys are strings: `"role"`, `"content"`, etc.

# `detection_result`

```elixir
@type detection_result() :: map()
```

Object detection result: label, score, and bounding box

# `embedding`

```elixir
@type embedding() :: [float()] | [[float()]] | [[[float()]]]
```

Dense embedding vector (flat or nested list of floats)

# `fill_mask_prediction`

```elixir
@type fill_mask_prediction() :: map()
```

Fill-mask prediction with score, sequence, token id, and token string

# `image_segment`

```elixir
@type image_segment() :: map()
```

Image segmentation result: label, base64 mask, optional score

# `image_to_text_output`

```elixir
@type image_to_text_output() :: map()
```

Image-to-text / captioning result: `%{"generated_text" => string}`

# `label_score`

```elixir
@type label_score() :: map()
```

Label + confidence score pair: `%{"label" => string, "score" => float}`

# `model_id`

```elixir
@type model_id() :: String.t()
```

A model ID on the HF Hub, e.g. `"meta-llama/Llama-3.1-8B-Instruct"`

# `output_type`

```elixir
@type output_type() :: :blob | :url | :data_url | :json
```

Image / video output format

# `provider`

```elixir
@type provider() :: String.t()
```

A provider identifier, e.g. `"groq"`, `"together"`, `"hf-inference"`

# `provider_mapping_entry`

```elixir
@type provider_mapping_entry() :: %{optional(String.t()) =&gt; term()}
```

A single entry from the HF Hub's inferenceProviderMapping

# `qa_result`

```elixir
@type qa_result() :: map()
```

Extractive QA result: answer, score, start/end character offsets

# `summarization_output`

```elixir
@type summarization_output() :: map()
```

Summarisation result: `%{"summary_text" => string}`

# `table_qa_result`

```elixir
@type table_qa_result() :: map()
```

Table QA result: answer, aggregator type, matched cells, coordinates

# `task`

```elixir
@type task() :: String.t()
```

A task identifier, e.g. `"conversational"`, `"text-to-image"`

# `text_generation_output`

```elixir
@type text_generation_output() :: map()
```

Non-streaming text generation result: `%{"generated_text" => string}`

# `token_classification_entity`

```elixir
@type token_classification_entity() :: map()
```

A named entity span from token classification (NER)

# `tool`

```elixir
@type tool() :: map()
```

A tool definition for function calling

# `tool_call`

```elixir
@type tool_call() :: map()
```

A function tool call returned in an assistant message

# `translation_output`

```elixir
@type translation_output() :: map()
```

Translation result: `%{"translation_text" => string}`

# `usage_stats`

```elixir
@type usage_stats() :: map()
```

Token usage statistics returned by the provider

# `visual_qa_result`

```elixir
@type visual_qa_result() :: map()
```

Visual QA result: answer string and confidence score

---

*Consult [api-reference.md](api-reference.md) for complete listing*
