feat(agent): default temperature to 0 + configurable temperature/top_p/seed (#266) - #267
Merged
Merged
Conversation
…bes (#130) Findings 1-3 from #130 (Finding 4, early ChatUI render, deferred to a browser-verified follow-up): 1. Drop the listTools() health check in MCPClient.ensureConnected() — it added a full round trip to every callTool/listPrompts/getPrompt. Trust the connected flag; callTool's reconnect-and-retry is the real safety net for the only frequent long-lived op, and boot-time prompt reads run right after a fresh connect. 2. listMcpToolsWithRetry now awaits connect() + getTools() (cache) instead of a second listTools() round trip — connect already cached the tools. 3. Fire mcp.connect() and the system-prompt fetch at the top of main(), and Promise.all the catalog walk + map-style load instead of awaiting them serially. The MCP cold-start now overlaps catalog+map+prompt I/O. Tests: mcp-client ensureConnected/onReconnect specs updated for the new no-probe contract (staleness now surfaces via callTool / explicit reconnect). Full suite green (334). main.js boot is browser-bootstrap (0% harness) — verify via the cold-load network waterfall on padus per the issue's validation plan.
…ions (#266) The client sent no sampling params, so the endpoint default applied (0.7 on the NRP proxy) — making repeated identical questions diverge. Add _samplingParams(): resolves temperature, top_p, and seed per-model first, then from a top-level config default, omitting any that are unset so behavior is unchanged when nothing is configured. Factual/analyst deployments can now pin temperature: 0 in config.json. Docs + tests included.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Builds on the configurable sampling params: when neither per-model nor global config sets a temperature, geo-agent now sends temperature: 0 rather than omitting it. geo-agent talks to many OpenAI-compatible endpoints (NRP proxy, OpenRouter, user-supplied keys) whose own defaults vary (0.7+), so reproducibility shouldn't hinge on the endpoint default. A model can still opt back out by setting temperature: null (omits the key, inheriting the endpoint default). top_p/seed stay omitted by default (no sensible universal value). Docs + tests updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #266.
Problem
callLLM()sent notemperature, so the LLM endpoint applied its own default —0.7on the NRP open-llm-proxy. With nothing pinning sampling, the same factual question returns a different answer each turn (the sampling half of the ca-30x30 determinism report; methodology was fixed separately).Change
New
Agent._samplingParams(modelConfig)resolvestemperature,top_p, andseed:config.llm_models[].temperature), thenconfig.temperature), thentemperature: 0.top_p/seedhave no sensible universal default, so they stay omitted unless configured.The resolved params are spread into the
callLLM()payload.Why default temperature to 0 client-side
geo-agent is not bound to our proxy — it talks to any OpenAI-compatible endpoint (NRP llm-proxy, OpenRouter, a visitor's own key on the live demo), and those defaults vary (0.7 and up). Pinning
0in the client means reproducible answers regardless of which endpoint is behind it, rather than inheriting whatever that endpoint happens to default to. (The proxy's own default is being lowered separately, but that only protects clients hitting that proxy.)Escape hatches
temperatureper-model or globally inconfig.json.temperature: null→ the key is omitted and the endpoint default applies.temperature: 0is preserved everywhere (falsy-but-valid).Behavior change note
This is not purely non-breaking: deployments that previously relied on the implicit
0.7will now run at0. That's the intended fix for #266 — factual/analyst use is the common case. Apps wanting the old behavior settemperature: 0.7(ornullto inherit the endpoint default).Tests
Agent._samplingParams— default-to-0, per-model, global fallback, override,temperature: 0, and per-modelnullopt-out cases.Agent.callLLM sampling payload— asserts the outgoing fetch body carriestemperature: 0when unconfigured (notop_p/seed), and the configured values when set.All 343 tests pass.
Docs
Added a "Sampling parameters" subsection to
docs/guide/configuration.mddocumenting the default, the resolution order, thenullopt-out, and the MoE-not-bit-reproducible caveat.