mirror of
https://github.com/githubhjs/CLIProxyAPIPlus.git
synced 2026-07-12 01:25:13 +00:00
feat(kiro): implement official reasoningContentEvent and improve metadat
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -222,20 +222,19 @@ func BuildKiroPayload(claudeBody []byte, modelID, profileArn, origin string, isA
|
|||||||
kiroTools := convertClaudeToolsToKiro(tools)
|
kiroTools := convertClaudeToolsToKiro(tools)
|
||||||
|
|
||||||
// Thinking mode implementation:
|
// Thinking mode implementation:
|
||||||
// Kiro API doesn't accept max_tokens for thinking. Instead, thinking mode is enabled
|
// Kiro API supports official thinking/reasoning mode via <thinking_mode> tag.
|
||||||
// by injecting <thinking_mode> and <max_thinking_length> tags into the system prompt.
|
// When set to "enabled", Kiro returns reasoning content as official reasoningContentEvent
|
||||||
// We use a fixed max_thinking_length value since Kiro handles the actual budget internally.
|
// rather than inline <thinking> tags in assistantResponseEvent.
|
||||||
|
// We use a high max_thinking_length to allow extensive reasoning.
|
||||||
if thinkingEnabled {
|
if thinkingEnabled {
|
||||||
thinkingHint := `<thinking_mode>interleaved</thinking_mode>
|
thinkingHint := `<thinking_mode>enabled</thinking_mode>
|
||||||
<max_thinking_length>200000</max_thinking_length>
|
<max_thinking_length>200000</max_thinking_length>`
|
||||||
|
|
||||||
IMPORTANT: You MUST use <thinking>...</thinking> tags to show your reasoning process before providing your final response. Think step by step inside the thinking tags.`
|
|
||||||
if systemPrompt != "" {
|
if systemPrompt != "" {
|
||||||
systemPrompt = thinkingHint + "\n\n" + systemPrompt
|
systemPrompt = thinkingHint + "\n\n" + systemPrompt
|
||||||
} else {
|
} else {
|
||||||
systemPrompt = thinkingHint
|
systemPrompt = thinkingHint
|
||||||
}
|
}
|
||||||
log.Infof("kiro: injected thinking prompt, has_tools: %v", len(kiroTools) > 0)
|
log.Infof("kiro: injected thinking prompt (official mode), has_tools: %v", len(kiroTools) > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process messages and build history
|
// Process messages and build history
|
||||||
|
|||||||
@@ -231,20 +231,19 @@ func BuildKiroPayloadFromOpenAI(openaiBody []byte, modelID, profileArn, origin s
|
|||||||
kiroTools := convertOpenAIToolsToKiro(tools)
|
kiroTools := convertOpenAIToolsToKiro(tools)
|
||||||
|
|
||||||
// Thinking mode implementation:
|
// Thinking mode implementation:
|
||||||
// Kiro API doesn't accept max_tokens for thinking. Instead, thinking mode is enabled
|
// Kiro API supports official thinking/reasoning mode via <thinking_mode> tag.
|
||||||
// by injecting <thinking_mode> and <max_thinking_length> tags into the system prompt.
|
// When set to "enabled", Kiro returns reasoning content as official reasoningContentEvent
|
||||||
// We use a fixed max_thinking_length value since Kiro handles the actual budget internally.
|
// rather than inline <thinking> tags in assistantResponseEvent.
|
||||||
|
// We use a high max_thinking_length to allow extensive reasoning.
|
||||||
if thinkingEnabled {
|
if thinkingEnabled {
|
||||||
thinkingHint := `<thinking_mode>interleaved</thinking_mode>
|
thinkingHint := `<thinking_mode>enabled</thinking_mode>
|
||||||
<max_thinking_length>200000</max_thinking_length>
|
<max_thinking_length>200000</max_thinking_length>`
|
||||||
|
|
||||||
IMPORTANT: You MUST use <thinking>...</thinking> tags to show your reasoning process before providing your final response. Think step by step inside the thinking tags.`
|
|
||||||
if systemPrompt != "" {
|
if systemPrompt != "" {
|
||||||
systemPrompt = thinkingHint + "\n\n" + systemPrompt
|
systemPrompt = thinkingHint + "\n\n" + systemPrompt
|
||||||
} else {
|
} else {
|
||||||
systemPrompt = thinkingHint
|
systemPrompt = thinkingHint
|
||||||
}
|
}
|
||||||
log.Debugf("kiro-openai: injected thinking prompt")
|
log.Debugf("kiro-openai: injected thinking prompt (official mode)")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process messages and build history
|
// Process messages and build history
|
||||||
|
|||||||
Reference in New Issue
Block a user