diff --git a/llm/provider.go b/llm/provider.go index 1031ad8..70c84a7 100644 --- a/llm/provider.go +++ b/llm/provider.go @@ -109,11 +109,7 @@ type GenerationOptions struct { ThinkingMode string ThinkingDisplay string ThinkingEnabled *bool - // GLMThinkingEnabled toggles GLM/Z.ai extended reasoning via the provider's - // non-OpenAI thinking={"type":"enabled"|"disabled"} request parameter. Only - // applied for OpenAI-compatible providers whose compat config sets - // ThinkingFormat to "zai". When nil the parameter is omitted and the model - // uses its default (GLM defaults to enabled). + // GLMThinkingEnabled is a deprecated alias of ThinkingEnabled (Z.AI-era). GLMThinkingEnabled *bool VirtualKeyID string KimiContextCacheID string diff --git a/llm/types.go b/llm/types.go index cac9387..5447020 100644 --- a/llm/types.go +++ b/llm/types.go @@ -99,11 +99,10 @@ type ChatOptions struct { ThinkingMode string `json:"thinking_mode,omitempty"` ThinkingDisplay string `json:"thinking_display,omitempty"` ThinkingEnabled *bool `json:"thinking_enabled,omitempty"` - // GLMThinkingEnabled toggles GLM/Z.ai extended reasoning via the provider's - // non-OpenAI thinking={"type":"enabled"|"disabled"} request parameter. Only - // applied for OpenAI-compatible providers whose compat config sets - // ThinkingFormat to "zai". When nil the parameter is omitted and the model - // uses its default (GLM defaults to enabled). + // GLMThinkingEnabled is a deprecated alias of ThinkingEnabled kept for + // older Z.AI call sites. New code should set ThinkingEnabled. Adapters + // accept either field; wire encoding is selected per provider via + // OpenAICompatConfig.ThinkingFormat ("zai", "longcat", "agnes", …). GLMThinkingEnabled *bool `json:"glm_thinking_enabled,omitempty"` VirtualKeyID string `json:"virtual_key_id,omitempty"` KimiContextCacheID string `json:"kimi_context_cache_id,omitempty"` @@ -128,6 +127,38 @@ type ChatOptions struct { AudioConfig string `json:"audio_config,omitempty"` Prediction string `json:"prediction,omitempty"` WebSearchOptions string `json:"web_search_options,omitempty"` + PromptCacheOptions *PromptCacheOpts `json:"prompt_cache_options,omitempty"` + CacheControl *CacheControl `json:"cache_control,omitempty"` + // Responses API extensions (Concentrate) + PreviousResponseID string `json:"previous_response_id,omitempty"` + Include []string `json:"include,omitempty"` + Routing *RoutingConfig `json:"routing,omitempty"` + MaxToolCalls *int `json:"max_tool_calls,omitempty"` + ContextManagement []ContextManagement `json:"context_management,omitempty"` + SafetyIdentifier *string `json:"safety_identifier,omitempty"` + Background *bool `json:"background,omitempty"` + Truncation *string `json:"truncation,omitempty"` + Conversation interface{} `json:"conversation,omitempty"` +} + +type PromptCacheOpts struct { + Mode string `json:"mode,omitempty"` + TTL string `json:"ttl,omitempty"` +} + +type CacheControl struct { + Type string `json:"type"` + TTL string `json:"ttl,omitempty"` +} + +type RoutingConfig struct { + Model interface{} `json:"model,omitempty"` + Strategy string `json:"strategy,omitempty"` // "min" or "max" + Metric string `json:"metric,omitempty"` // "cost", "latency", "quality" +} + +type ContextManagement struct { + Type string `json:"type"` // "compact_20260112", "clear_thinking_20251015", etc. } // ContinuationConfig controls output continuation behavior.