> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# FiddlerGeneration

> Wrapper for LLM generation spans with semantic convention helpers.

Wrapper for LLM generation spans with semantic convention helpers.

Initialize LLM generation wrapper.

## **enter**()

Enter context and set LLM type.

### Returns

`FiddlerGeneration`

## set\_model()

Set the LLM model name (gen\_ai.request.model).

## set\_system()

Set the LLM system/provider (gen\_ai.system).

## set\_system\_prompt()

Set the system prompt (gen\_ai.llm.input.system).

## set\_user\_prompt()

Set the user prompt (gen\_ai.llm.input.user).

### Parameters

<ParamField path="text" type="str | list[dict]" required={true}>
  Plain text string, or a list of content parts in OpenAI
  multimodal format (e.g. `[&#123;'type': 'text', 'text': '...'},
        &#123;'type': 'image_url', 'image_url': &#123;'url': 'data:...'}}]`).
  Lists are auto-serialized to JSON.
</ParamField>

## set\_completion()

Set the LLM completion/output (gen\_ai.llm.output).

## set\_usage()

Set token usage information (gen\_ai.usage.\*).

### Parameters

<ParamField path="input_tokens" type="int" required={true}>
  Number of input/prompt tokens.
</ParamField>

<ParamField path="output_tokens" type="int" required={true}>
  Number of output/completion tokens.
</ParamField>

<ParamField path="total_tokens" type="int | None" required={false} default="None">
  Total tokens; computed from input + output when omitted.
</ParamField>

## set\_context()

Set additional context (gen\_ai.llm.context).

## set\_messages()

Set input messages in OpenAI chat format (gen\_ai.input.messages).

Accepts simple format: `[{'role': 'user', 'content': '...'}]`
Auto-converts to OTel format with `parts`.

## set\_output\_messages()

Set output messages in OpenAI chat format (gen\_ai.output.messages).

Accepts simple format: `[{'role': 'assistant', 'content': '...'}]`
Auto-converts to OTel format with `parts`.

## set\_tool\_definitions()

Set available tool definitions for this LLM call (gen\_ai.tool.definitions).
