Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/whole-goats-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@browserbasehq/stagehand": minor
---

Default model providers don't seem to be working correctly in Stagehand V3 when a model isn't specified - this diff should fix that and fix the associated logging
16 changes: 13 additions & 3 deletions packages/core/lib/v3/v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ export class V3 {
? typeof options?.model === "string"
? { value: options.model, type: "string" }
: { value: options.model.modelName, type: "string" }
: { value: this.llmClient.modelName, type: "string" },
: { value: this.modelName, type: "string" },
systemPrompt: { value: options?.systemPrompt ?? "", type: "string" },
tools: { value: JSON.stringify(options?.tools ?? {}), type: "object" },
...(options?.integrations && {
Expand Down Expand Up @@ -1473,8 +1473,13 @@ export class V3 {
try {
if (this.apiClient && !this.experimental) {
const page = await this.ctx!.awaitActivePage();
// Ensure model is set for API calls - use the resolved modelName
const agentConfigWithModel: AgentConfig = {
...options,
model: options?.model || modelName,
};
result = await this.apiClient.agentExecute(
options,
agentConfigWithModel,
resolvedOptions,
page.mainFrameId(),
);
Expand Down Expand Up @@ -1576,8 +1581,13 @@ export class V3 {
try {
if (this.apiClient && !this.experimental) {
const page = await this.ctx!.awaitActivePage();
// Ensure model is set for API calls - default to V3's modelName if not specified
const agentConfigWithModel: AgentConfig = {
...options,
model: options?.model || this.modelName,
};
result = await this.apiClient.agentExecute(
options,
agentConfigWithModel,
resolvedOptions,
page.mainFrameId(),
);
Expand Down