DefaultRequestTransformer

org.llm4s.model.DefaultRequestTransformer
class DefaultRequestTransformer(overrides: Map[String, ModelCapabilities]) extends RequestTransformer

Default implementation that uses ModelRegistry for capability lookups.

Value parameters

overrides

Optional map of model-specific capability overrides

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

override def getDisallowedParams(modelId: String): Set[String]

Get the set of parameters that are not supported by this model.

Get the set of parameters that are not supported by this model.

Value parameters

modelId

The model identifier

Attributes

Returns

Set of disallowed parameter names, empty if all are allowed

Definition Classes
override def requiresFakeStreaming(modelId: String): Boolean

Check if streaming needs to be faked for this model.

Check if streaming needs to be faked for this model.

Some models (like O1) don't support native streaming and require the client to simulate streaming by returning the full response as a single chunk.

Value parameters

modelId

The model identifier

Attributes

Returns

true if the model requires fake streaming

Definition Classes
override def transformMessages(modelId: String, messages: Seq[Message]): Seq[Message]

Transform messages for model-specific requirements.

Transform messages for model-specific requirements.

For example, O-series models that don't support system messages will have their system messages converted to user messages with a "[System]:" prefix.

Value parameters

messages

The messages to transform

modelId

The model identifier

Attributes

Returns

Transformed messages

Definition Classes
override def transformOptions(modelId: String, options: CompletionOptions, dropUnsupported: Boolean): Result[CompletionOptions]

Validate and transform completion options for a specific model.

Validate and transform completion options for a specific model.

Checks model capabilities and either drops unsupported parameters or returns validation errors, depending on the dropUnsupported flag.

Value parameters

dropUnsupported

If true, silently drop/adjust unsupported params; if false, return error

modelId

The model identifier (e.g., "o1", "gpt-4o", "claude-3-7-sonnet")

options

The completion options to transform

Attributes

Returns

Transformed options or validation error

Definition Classes