org.llm4s.llmconnect.model
Members list
Type members
Classlikes
Represents a message from the LLM assistant, which may include text, tool calls or both.
Represents a message from the LLM assistant, which may include text, tool calls or both.
Value parameters
- contentOpt
-
Optional content of the message.
- toolCalls
-
Sequence of tool calls made by the assistant.
Attributes
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
AssistantMessage.type
Audio as mono float32 PCM with sample rate.
Audio as mono float32 PCM with sample rate.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MMInputclass Objecttrait Matchableclass AnyShow all
Delta information for streaming chunks
Delta information for streaming chunks
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ChunkDelta.type
Represents a completion response from an LLM. This includes the ID, creation timestamp, the assistant's message, and optional token usage statistics.
Represents a completion response from an LLM. This includes the ID, creation timestamp, the assistant's message, and optional token usage statistics.
Value parameters
- content
-
The main content of the response.
- created
-
Timestamp of when the completion was created.
- id
-
Unique identifier for the completion.
- message
-
The assistant's message in response to the user's input.
- model
-
The model that generated this completion.
- thinking
-
Optional thinking/reasoning content from extended thinking models. Present when using reasoning modes with Claude or o1/o3 models.
- toolCalls
-
List of tool calls made by the assistant.
- usage
-
Optional token usage statistics for the completion.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a streaming chunk of completion data
Represents a streaming chunk of completion data
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents options for a completion request.
Represents options for a completion request.
Value parameters
- budgetTokens
-
Optional explicit budget for thinking tokens (Anthropic Claude). If set, overrides the default budget from reasoning effort level.
- frequencyPenalty
-
Penalizes new tokens based on their existing frequency in the text so far, discouraging repetition.
- maxTokens
-
Optional maximum number of tokens to generate in the completion.
- presencePenalty
-
Penalizes new tokens based on whether they appear in the text so far, encouraging new topics.
- reasoning
-
Optional reasoning effort level for models that support extended thinking (o1/o3, Claude). For non-reasoning models, this setting is silently ignored.
- temperature
-
Controls the randomness of the output. Higher values make the output more random. Note: Reasoning models (o1/o3) ignore this setting.
- tools
-
Optional sequence of tool function definitions that can be requested by the LLM during a completion.
- topP
-
Controls the diversity of the output. Lower values make the output more focused.
Attributes
- Example
-
import org.llm4s.llmconnect.model._ // Enable high reasoning for complex tasks val options = CompletionOptions() .withReasoning(ReasoningEffort.High) .copy(maxTokens = Some(4096)) // For Anthropic, set explicit thinking budget val anthropicOptions = CompletionOptions() .withBudgetTokens(16000) - Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents the message stream in a conversation. Typically this will be a sequence of system prompt, then a series of user message and assistant responses. After the system message we have a user message. The next message is the assistant response. If the conversation is ongoing, the next message will be a user message, or if the previous AssistantMessage requested one or more tool calls it will be followed by ToolMessages in response to each requested tool.
Represents the message stream in a conversation. Typically this will be a sequence of system prompt, then a series of user message and assistant responses. After the system message we have a user message. The next message is the assistant response. If the conversation is ongoing, the next message will be a user message, or if the previous AssistantMessage requested one or more tool calls it will be followed by ToolMessages in response to each requested tool.
Value parameters
- messages
-
Sequence of messages in the conversation.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
Conversation.type
EmbeddingError represents a structured error returned from an embedding provider (e.g., OpenAI or VoyageAI) or local encoders/extractors.
EmbeddingError represents a structured error returned from an embedding provider (e.g., OpenAI or VoyageAI) or local encoders/extractors.
Value parameters
- code
-
Optional error code, typically an HTTP status (e.g., "401", "400").
- message
-
Human-readable error message from the provider or client.
- provider
-
Source component ("openai", "voyage", "encoder", "extractor", etc.)
Attributes
- Supertypes
-
trait LLMErrortrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Text-only embedding request used by HTTP providers (OpenAI/Voyage).
Text-only embedding request used by HTTP providers (OpenAI/Voyage).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Successful response carrying embedding vectors and lightweight metadata.
Successful response carrying embedding vectors and lightweight metadata.
Value parameters
- dim
-
Optional dimensionality, if convenient to surface at response-level.
- embeddings
-
One vector per input text/chunk (or per item).
- metadata
-
Provider/model info etc. (e.g., "provider" -> "openai", "model" -> "...").
- modality
-
Optional overall modality tag (Text, Audio, Video) when known.
- usage
-
Optional token usage statistics (available from providers like OpenAI). Notes:
- Defaults on
metadata,modality,dim, andusagekeep old call-sites source-compatible. - Providers can set
modality/dim/usagewhen they know it; callers can ignore safely.
- Defaults on
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
EmbeddingResponse.type
Token usage statistics for an embedding request.
Token usage statistics for an embedding request.
Value parameters
- promptTokens
-
Number of tokens in the input text(s).
- totalTokens
-
Total tokens used (same as promptTokens for embeddings).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
ExtractorError represents failures during file/media extraction.
ExtractorError represents failures during file/media extraction.
Value parameters
- message
-
Human-readable explanation of the failure.
- path
-
Optional path to the problematic file for debugging.
- type
-
Coarse category (e.g., "FileNotFound", "UnsupportedType", "PDF", "DOCX", "PlainText", "ImageReadError", "AudioUnsupported", "AudioError", "VideoUnsupported").
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Image as raw bytes (e.g., RGB or BGR interleaved) with basic shape metadata.
Image as raw bytes (e.g., RGB or BGR interleaved) with basic shape metadata.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MMInputclass Objecttrait Matchableclass AnyShow all
Typed payloads for multimedia inputs. Keep lightweight, encode-friendly.
Typed payloads for multimedia inputs. Keep lightweight, encode-friendly.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Represents a message in a conversation with an LLM (Large Language Model).
Represents a message in a conversation with an LLM (Large Language Model).
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
MessageRole.type
Multimedia request (co-located in the same file to avoid new source files). Used by local encoders/facades (e.g., UniversalEncoder). Not sent to HTTP providers.
Multimedia request (co-located in the same file to avoid new source files). Used by local encoders/facades (e.g., UniversalEncoder). Not sent to HTTP providers.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents the level of reasoning effort to request from the LLM.
Represents the level of reasoning effort to request from the LLM.
Different providers implement reasoning in different ways:
- OpenAI o1/o3 models: Uses
reasoning_effortparameter - Anthropic Claude: Uses extended thinking with
budget_tokens
For non-reasoning models, this setting is silently ignored.
Attributes
- Example
-
import org.llm4s.llmconnect.model._ // Use high reasoning for complex tasks val options = CompletionOptions().withReasoning(ReasoningEffort.High) // Parse from string val effort = ReasoningEffort.fromString("medium") - Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Attributes
- Companion
- trait
- Supertypes
-
trait Sumtrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ReasoningEffort.type
Represents a streamed chunk of completion data.
Represents a streamed chunk of completion data.
Value parameters
- content
-
Optional text content delta.
- finishReason
-
Optional reason for stream completion.
- id
-
Unique identifier for the stream.
- thinkingDelta
-
Optional thinking/reasoning content delta. Present when streaming extended thinking content.
- toolCall
-
Optional tool call information.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a system message, which is typically used to set context or instructions for the LLM.
Represents a system message, which is typically used to set context or instructions for the LLM.
A system prompt provides the foundational instructions and behavioral guidelines that shape how the LLM should respond to a user request, including its personality, capabilities, constraints, and communication style. It acts as the model's "operating manual," establishing context about what it should and shouldn't do, how to handle various scenarios, and what information it has access to.
Value parameters
- content
-
Content of the system message.
Attributes
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
SystemMessage.type
Text as pre-chunked strings (optional helper for local text paths).
Text as pre-chunked strings (optional helper for local text paths).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MMInputclass Objecttrait Matchableclass AnyShow all
Token usage statistics for a completion request.
Token usage statistics for a completion request.
Value parameters
- completionTokens
-
Number of tokens in the completion (output).
- promptTokens
-
Number of tokens in the prompt (input).
- thinkingTokens
-
Optional number of tokens used for thinking/reasoning. Present when using reasoning modes with Claude or o1/o3 models. These tokens count toward billing but are separate from completion tokens.
- totalTokens
-
Total tokens (prompt + completion).
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a tool call request from the LLM.
Represents a tool call request from the LLM.
Value parameters
- arguments
-
Arguments passed to the tool in JSON format.
- id
-
Unique identifier for the tool call (generated byt the LLM).
- name
-
Name of the tool being called. (from the list of tools provided to the LLM).
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a message from a tool, typically containing the result of a tool call.
Represents a message from a tool, typically containing the result of a tool call.
Value parameters
- content
-
Content of the tool message, usually the result of the tool execution, e.g. a json response.
- toolCallId
-
Unique identifier for the tool call (as provided by the ToolCall).
Attributes
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
ToolMessage.type
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TraceHelper.type
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
UserMessage.type
Video as a sequence of RGB frames (byte arrays), plus basic shape & fps.
Video as a sequence of RGB frames (byte arrays), plus basic shape & fps.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait MMInputclass Objecttrait Matchableclass AnyShow all