Raise default agent token budget for reasoning models
The tracker mapping, common-pattern enrichment, and third-party disambiguation agents default to a small max-tokens budget on the premise that their final output is tiny structured JSON. On reasoning models such as the GPT-5 family, reasoning tokens count against max_tokens, so a small budget is consumed by reasoning and the JSON is truncated, surfacing as "unexpected end of JSON input". Raise the defaults to 4096 (1024 -> 4096 for tracker mapping, 512 -> 4096 for disambiguation) to leave headroom for the reasoning phase. Update the bootstrap builder default, its test, and the production values example to match. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -174,7 +174,7 @@ probo:
|
|||||||
# provider: "openai"
|
# provider: "openai"
|
||||||
# modelName: "gpt-4o-mini"
|
# modelName: "gpt-4o-mini"
|
||||||
# temperature: "0.1"
|
# temperature: "0.1"
|
||||||
# maxTokens: "1024"
|
# maxTokens: "4096"
|
||||||
|
|
||||||
# Tracker mapping worker tuning (optional; seconds for interval/agentTimeout).
|
# Tracker mapping worker tuning (optional; seconds for interval/agentTimeout).
|
||||||
# Keep concurrency modest to stay under OpenAI/Firecrawl limits and the DB pool.
|
# Keep concurrency modest to stay under OpenAI/Firecrawl limits and the DB pool.
|
||||||
|
|||||||
@@ -209,11 +209,12 @@ func (b *Builder) Build() (*probodconfig.FullConfig, error) {
|
|||||||
TrackerMapping: probodconfig.LLMAgentConfig{
|
TrackerMapping: probodconfig.LLMAgentConfig{
|
||||||
Provider: b.getEnvOrDefault("AGENT_TRACKER_MAPPING_PROVIDER", ""),
|
Provider: b.getEnvOrDefault("AGENT_TRACKER_MAPPING_PROVIDER", ""),
|
||||||
ModelName: b.getEnvOrDefault("AGENT_TRACKER_MAPPING_MODEL_NAME", ""),
|
ModelName: b.getEnvOrDefault("AGENT_TRACKER_MAPPING_MODEL_NAME", ""),
|
||||||
// The tracker agents emit tiny structured JSON, so
|
// The tracker agents emit tiny structured JSON, but
|
||||||
// they default to a smaller token budget than the
|
// the budget must leave headroom for reasoning
|
||||||
// shared default rather than inheriting it.
|
// models whose reasoning tokens count against
|
||||||
|
// max_tokens; too small a budget truncates the JSON.
|
||||||
Temperature: b.getEnvFloatPtr("AGENT_TRACKER_MAPPING_TEMPERATURE"),
|
Temperature: b.getEnvFloatPtr("AGENT_TRACKER_MAPPING_TEMPERATURE"),
|
||||||
MaxTokens: new(b.getEnvIntOrDefault("AGENT_TRACKER_MAPPING_MAX_TOKENS", 1024)),
|
MaxTokens: new(b.getEnvIntOrDefault("AGENT_TRACKER_MAPPING_MAX_TOKENS", 4096)),
|
||||||
},
|
},
|
||||||
Tools: probodconfig.AgentToolsConfig{
|
Tools: probodconfig.AgentToolsConfig{
|
||||||
FirecrawlAPIKey: b.getEnv("FIRECRAWL_API_KEY"),
|
FirecrawlAPIKey: b.getEnv("FIRECRAWL_API_KEY"),
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ func TestBuilder_Build_Defaults(t *testing.T) {
|
|||||||
assert.Empty(t, cfg.Probod.Agents.TrackerMapping.Provider)
|
assert.Empty(t, cfg.Probod.Agents.TrackerMapping.Provider)
|
||||||
assert.Empty(t, cfg.Probod.Agents.TrackerMapping.ModelName)
|
assert.Empty(t, cfg.Probod.Agents.TrackerMapping.ModelName)
|
||||||
assert.Nil(t, cfg.Probod.Agents.TrackerMapping.Temperature)
|
assert.Nil(t, cfg.Probod.Agents.TrackerMapping.Temperature)
|
||||||
assert.Equal(t, new(1024), cfg.Probod.Agents.TrackerMapping.MaxTokens)
|
assert.Equal(t, new(4096), cfg.Probod.Agents.TrackerMapping.MaxTokens)
|
||||||
|
|
||||||
// Tracker worker tuning — defaults
|
// Tracker worker tuning — defaults
|
||||||
assert.Equal(t, 10, cfg.Probod.TrackerMappingWorker.Interval)
|
assert.Equal(t, 10, cfg.Probod.TrackerMappingWorker.Interval)
|
||||||
|
|||||||
@@ -40,10 +40,14 @@ const (
|
|||||||
defaultMappingMaxTurns = 4
|
defaultMappingMaxTurns = 4
|
||||||
defaultEnrichmentMaxTurns = 3
|
defaultEnrichmentMaxTurns = 3
|
||||||
|
|
||||||
// defaultAgentMaxTokens caps the structured output of the mapping
|
// defaultAgentMaxTokens caps the output of the mapping and
|
||||||
// and enrichment agents when the agent config carries no max-tokens
|
// enrichment agents when the agent config carries no max-tokens
|
||||||
// budget. Both outputs are tiny structured JSON.
|
// budget. Both final outputs are tiny structured JSON, but the
|
||||||
defaultAgentMaxTokens = 1024
|
// budget must leave ample headroom for reasoning models (e.g. the
|
||||||
|
// GPT-5 family): their reasoning tokens count against max_tokens,
|
||||||
|
// so too small a budget gets consumed by reasoning and truncates
|
||||||
|
// the JSON, surfacing as "unexpected end of JSON input".
|
||||||
|
defaultAgentMaxTokens = 4096
|
||||||
|
|
||||||
agentThirdPartyConfidenceThreshold = 0.6
|
agentThirdPartyConfidenceThreshold = 0.6
|
||||||
// agentSourceConfidence is the fixed confidence stored on catalog
|
// agentSourceConfidence is the fixed confidence stored on catalog
|
||||||
|
|||||||
12
pkg/thirdparty/disambiguation_agent.go
vendored
12
pkg/thirdparty/disambiguation_agent.go
vendored
@@ -44,10 +44,14 @@ const (
|
|||||||
// provider, not a real budget.
|
// provider, not a real budget.
|
||||||
defaultDisambiguationTimeout = 45 * time.Second
|
defaultDisambiguationTimeout = 45 * time.Second
|
||||||
|
|
||||||
// defaultDisambiguationMaxTokens caps the agent's structured
|
// defaultDisambiguationMaxTokens caps the agent's output when the
|
||||||
// output when the config carries no max-tokens budget. The output
|
// config carries no max-tokens budget. The final output is tiny (a
|
||||||
// is a single id plus a one-sentence rationale.
|
// single id plus a one-sentence rationale), but the budget must
|
||||||
defaultDisambiguationMaxTokens = 512
|
// leave ample headroom for reasoning models (e.g. the GPT-5
|
||||||
|
// family): their reasoning tokens count against max_tokens, so too
|
||||||
|
// small a budget gets consumed by reasoning and truncates the JSON,
|
||||||
|
// surfacing as "unexpected end of JSON input".
|
||||||
|
defaultDisambiguationMaxTokens = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
// DisambiguationConfig configures the third-party disambiguation
|
// DisambiguationConfig configures the third-party disambiguation
|
||||||
|
|||||||
Reference in New Issue
Block a user