Skip to content

Regression on Stagehand 2.2.1: Text extraction on links sometimes grabs an incorrect number #771

Open
@jds2501-cs

Description

@jds2501-cs

This code previously worked on stagehand 2.1:

    const { count } = await page.extract({
      instruction: `Extract the ${widgetTitle} link's value`,
      schema: z.object({
        count: z.number(),
      }),
    });

This would consistently produce a target number. Now we're getting inconsistent numbers with the 2.2.1 upgrade. The workaround we implemented that works consistently is:

    const [action] = await page.observe({
      instruction: `Extract the ${widgetTitle} link's value`,
    });

    const { count } = await page.extract({
      selector: action.selector,
      schema: z.object({
        count: z.number(),
      }),
    });

Which tells me it's a problem around how we're processing instructions in extract (observe is consistently accurate, extract is not).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions