Skip to main content
Span wrapper for LLM generation calls with model, prompt, completion, and token-usage helpers. Created via FiddlerClient.startGeneration. All setter methods return this for fluent chaining.

Methods

setCompletion(text: string): this

Set the LLM completion/response text. Alias for FiddlerSpan.setOutput — writes to gen_ai.llm.output.
text
string
required
The completion content.
return
this for chaining.

setContext(context: string): this

Set the LLM context (e.g. retrieved RAG context) for this generation.
context
string
required
Context string provided to the LLM.
return
this for chaining.

setMessages(messages: Record<string, unknown>[]): this

Set the full input message history sent to the model.
messages
Record<string, unknown>[]
required
Array of chat messages in OpenAI/Anthropic format.
return
this for chaining.

setModel(model: string): this

Set the model identifier (e.g. "gpt-4o", "claude-3-opus").
model
string
required
Model name or identifier string.
return
this for chaining.

setOutputMessages(messages: Record<string, unknown>[]): this

Set the output messages returned by the model.
messages
Record<string, unknown>[]
required
Array of assistant response messages.
return
this for chaining.

setSystem(system: string): this

Set the LLM provider/system (e.g. "openai", "anthropic").
system
string
required
Provider identifier string.
return
this for chaining.

setSystemPrompt(text: string): this

Set the system prompt text.
text
string
required
The system prompt content.
return
this for chaining.

setToolDefinitions(definitions: Record<string, unknown>[]): this

Set the tool/function definitions available to the model.
definitions
Record<string, unknown>[]
required
Array of tool definition objects.
return
this for chaining.

setUsage(usage: TokenUsage): this

Set token usage statistics for this generation. If totalTokens is not provided it is computed as inputTokens + outputTokens.
usage
TokenUsage
required
Token counts for input, output, and total.
return
this for chaining.

setUserPrompt(text: string): this

Set the user prompt text. Alias for FiddlerSpan.setInput — writes to gen_ai.llm.input.user.
text
string
required
The user prompt content.
return
this for chaining.