RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: unable to pass Temperature and MaxTokens in agent (#18223)
Haruko386a6f2eac4965f
diff --git a/internal/agent/component/agent.go b/internal/agent/component/agent.goindex 1ac7847dc6..60542569e5 100644--- a/internal/agent/component/agent.go+++ b/internal/agent/component/agent.go@@ -82,7 +82,9 @@ type AgentParam struct {SystemPrompt stringUserPrompt stringThinking string+ MaxTokens *intTopP *float64+ Temperature *float64Tools []string // Agent-visible tool names resolved into Eino BaseTool instancesToolParams map[string]map[string]any // node-level tool constructor params keyed by tool nameSubAgents []SubAgentTool@@ -1041,15 +1043,14 @@ func buildAgentChatModel(ctx context.Context, p AgentParam) (*models.EinoChatModapiKey := p.APIKeycfg := &models.APIConfig{ApiKey: &apiKey}cm := models.NewChatModel(d, &modelID, cfg)- // ChatConfig construction is conditional on TopP being set, unlike- // the LLM path which always builds a ChatConfig (Temperature/MaxTokens- // pass-through). The asymmetry is intentional: AgentParam has no- // Temperature/MaxTokens yet, so building a zero-config ChatConfig- // would be dead weight. When AgentParam grows Temperature/- // MaxTokens, switch to always-build.+ // Build ChatConfig when a generation parameter or Thinking is set.var chatCfg *models.ChatConfig- if p.TopP != nil || p.Thinking != "" {- chatCfg = &models.ChatConfig{TopP: p.TopP}+ if p.TopP != nil || p.Thinking != "" || p.MaxTokens != nil || p.Temperature != nil {+ chatCfg = &models.ChatConfig{+ TopP: p.TopP,+ MaxTokens: p.MaxTokens,+ Temperature: p.Temperature,+ }switch p.Thinking {case "enabled":t := true@@ -1370,6 +1371,14 @@ func mergeAgentParam(base AgentParam, inputs map[string]any) AgentParam {f := vp.TopP = &f}+ if v, ok := intFrom(inputs, "max_tokens"); ok {+ f := v+ p.MaxTokens = &f+ }+ if v, ok := floatFrom(inputs, "temperature"); ok {+ f := v+ p.Temperature = &f+ }if v, ok := stringFrom(inputs, "thinking"); ok && v != "" && v != "default" {p.Thinking = v}