mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix: Templates update (#485)
* fix: add MaxTokens and Temperature fields to AgentInstance and update related logic * feat: add MaxTokens and Temperature options to SubagentManager and update tool loop logic * feat: add default temperature handling and update related tests * feat: allow temperature 0 and distinguish unset * fix: format MockLLMProvider struct in subagent_tool_test.go
This commit is contained in:
+15
-1
@@ -21,6 +21,8 @@ type AgentInstance struct {
|
||||
Fallbacks []string
|
||||
Workspace string
|
||||
MaxIterations int
|
||||
MaxTokens int
|
||||
Temperature float64
|
||||
ContextWindow int
|
||||
Provider providers.LLMProvider
|
||||
Sessions *session.SessionManager
|
||||
@@ -76,6 +78,16 @@ func NewAgentInstance(
|
||||
maxIter = 20
|
||||
}
|
||||
|
||||
maxTokens := defaults.MaxTokens
|
||||
if maxTokens == 0 {
|
||||
maxTokens = 8192
|
||||
}
|
||||
|
||||
temperature := 0.7
|
||||
if defaults.Temperature != nil {
|
||||
temperature = *defaults.Temperature
|
||||
}
|
||||
|
||||
// Resolve fallback candidates
|
||||
modelCfg := providers.ModelConfig{
|
||||
Primary: model,
|
||||
@@ -90,7 +102,9 @@ func NewAgentInstance(
|
||||
Fallbacks: fallbacks,
|
||||
Workspace: workspace,
|
||||
MaxIterations: maxIter,
|
||||
ContextWindow: defaults.MaxTokens,
|
||||
MaxTokens: maxTokens,
|
||||
Temperature: temperature,
|
||||
ContextWindow: maxTokens,
|
||||
Provider: provider,
|
||||
Sessions: sessionsManager,
|
||||
ContextBuilder: contextBuilder,
|
||||
|
||||
Reference in New Issue
Block a user