Skip to content

remove default temp#2076

Open
filip-michalsky wants to merge 1 commit intomainfrom
fm/stg-1858-remove-default-temp-general
Open

remove default temp#2076
filip-michalsky wants to merge 1 commit intomainfrom
fm/stg-1858-remove-default-temp-general

Conversation

@filip-michalsky
Copy link
Copy Markdown
Collaborator

@filip-michalsky filip-michalsky commented May 4, 2026

why

Stagehand v3 was setting hard-coded temperature defaults for standard act, extract, and observe inference calls. This forced provider
behavior instead of letting model/provider defaults apply.

what changed

Removed the hard-coded temperature: isGPT5 ? 1 : 0.1 defaults from shared act, extract, and observe inference.

Removed the unused GPT-5 temperature branching in that path.

Updated Groq and Cerebras clients to pass through options.temperature directly instead of defaulting missing values to 0.7, while preserving
explicit temperature: 0.

Added regression tests covering:

  • act, extract, and observe no longer pass temperature by default
  • Groq/Cerebras do not inject default temperature
  • Groq/Cerebras preserve explicit zero temperature

test plan

  • pnpm --filter @browserbasehq/stagehand run typecheck
  • pnpm --filter @browserbasehq/stagehand exec prettier --check lib/inference.ts lib/v3/llm/GroqClient.ts lib/v3/llm/CerebrasClient.ts tests/
    unit/inference-temperature.test.ts tests/unit/openai-compatible-temperature.test.ts
  • pnpm --filter @browserbasehq/stagehand run build:esm
  • pnpm --filter @browserbasehq/stagehand run test:core -- packages/core/dist/esm/tests/unit/inference-temperature.test.js packages/core/
    dist/esm/tests/unit/openai-compatible-temperature.test.js packages/core/dist/esm/tests/unit/aisdk-clients.test.js packages/core/dist/esm/
    tests/unit/anthropic-cua-adaptive-thinking.test.js

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

⚠️ No Changeset found

Latest commit: 7d62aa1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@filip-michalsky filip-michalsky marked this pull request as ready for review May 4, 2026 18:25
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant User as Caller / SDK User
    participant Inf as Inference Logic (act/extract/observe)
    participant Client as LLMClient (Base Interface)
    participant Provider as Groq/Cerebras Client
    participant API as External LLM Provider

    Note over User,Inf: Request starts (e.g. stagehand.act)

    User->>Inf: call(instruction, options)
    
    Inf->>Inf: Build System/User Prompts
    
    Note over Inf: CHANGED: Removed default temperature logic<br/>(Previously forced 0.1 or 1.0 for GPT-5)

    Inf->>Client: createChatCompletion(request)
    
    Client->>Provider: createChatCompletion(request)

    alt NEW: Explicit Temperature Provided
        Provider->>Provider: Map temperature from options
    else NEW: Temperature is Undefined
        Note over Provider: CHANGED: No longer defaults to 0.7<br/>Allows Provider API to use its own default
        Provider->>Provider: temperature = undefined
    end

    Provider->>API: POST /chat/completions (JSON Payload)
    Note right of API: Payload includes temperature ONLY if provided

    API-->>Provider: ChatCompletion Response
    Provider-->>Inf: Structured Data / Action
    Inf-->>User: Final Result
Loading

@miguelg719 miguelg719 added act These changes pertain to the act function extract These changes pertain to the extract function observe These changes pertain to the observe function labels May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

act These changes pertain to the act function extract These changes pertain to the extract function observe These changes pertain to the observe function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants