Documentation
¶
Overview ¶
Package transform provides IR-level request transformers (system prompt injection, role mapping, thinking pass-through/strip) that the relay pipeline applies between inbound decode and outbound encode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyRoleMapping ¶
ApplyRoleMapping applies role mapping to a list of IR messages. Messages are modified in place. Unknown roles are preserved.
func ApplyThinkingPassthrough ¶ added in v0.0.8
ApplyThinkingPassthrough 给"带 tool_calls 但无 thinking block"的 assistant 消息 补一个空文本占位 thinking block。逻辑从 ThinkingPassthroughTransformer 抽出,行为不变。
Types ¶
type RoleMappingConfig ¶
type RoleMappingConfig struct {
// Default mappings applied to all models in this channel
Default map[llmkit.Role]llmkit.Role `json:"default,omitempty"`
// Per-model mappings; keys support wildcard patterns (e.g., "claude-*")
Models map[string]map[llmkit.Role]llmkit.Role `json:"models,omitempty"`
}
RoleMappingConfig represents the role mapping configuration for a channel.
func ParseRoleMapping ¶
func ParseRoleMapping(raw string) *RoleMappingConfig
ParseRoleMapping parses a JSON string into a RoleMappingConfig. Returns nil if the input is empty or invalid.
func (*RoleMappingConfig) ResolveRoleMapping ¶
ResolveRoleMapping returns the applicable role mapping for a given model name. Priority: exact model match > wildcard match > default. Returns nil if no mapping applies.