From ef88105eb7c9b63c2189e8302cc30b7740802ea6 Mon Sep 17 00:00:00 2001 From: leenfhd Date: Mon, 8 Jun 2026 15:38:47 +0300 Subject: [PATCH] remove rating form schema and remove emoji --- python-examples/stagehand/api/get-books.py | 8 +++----- typescript-examples/stagehand/api/get-books.ts | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/python-examples/stagehand/api/get-books.py b/python-examples/stagehand/api/get-books.py index ccebec10..ba0484e6 100644 --- a/python-examples/stagehand/api/get-books.py +++ b/python-examples/stagehand/api/get-books.py @@ -14,7 +14,6 @@ class Params(TypedDict): class BookDetails(BaseModel): title: str price: str - rating: str | None = None availability: str | None = None @@ -76,7 +75,7 @@ async def automation(page: Page, params: Params, **_kwargs): ) session_id = session.data.session_id print(f"✅ Session started: {session_id}") - print("\nInitialized 🤘 Stagehand") + print("\nInitialized Stagehand") category = params.get("category") all_books: list[BookDetails] = [] @@ -113,7 +112,7 @@ async def automation(page: Page, params: Params, **_kwargs): # Extract all book details from the current page using simple JSON schema result = await client.sessions.extract( id=session_id, - instruction="Extract all books on this page including title, price, rating and availability for each book", + instruction="Extract all books on this page including title, price and availability for each book", options={"model": model_config}, schema={ "type": "object", @@ -125,7 +124,6 @@ async def automation(page: Page, params: Params, **_kwargs): "properties": { "title": {"type": "string"}, "price": {"type": "string"}, - "rating": {"type": "string"}, "availability": {"type": "string"}, }, "required": ["title", "price"], @@ -172,7 +170,7 @@ async def automation(page: Page, params: Params, **_kwargs): break finally: # Cleanup Stagehand - print("\nClosing 🤘 Stagehand...") + print("\nClosing Stagehand...") await client.sessions.end(session_id) print("✅ Session ended") diff --git a/typescript-examples/stagehand/api/get-books.ts b/typescript-examples/stagehand/api/get-books.ts index ceca03c9..f8f69e04 100644 --- a/typescript-examples/stagehand/api/get-books.ts +++ b/typescript-examples/stagehand/api/get-books.ts @@ -13,7 +13,6 @@ const bookDetailsSchema = z.object({ z.object({ title: z.string(), price: z.string(), - rating: z.string().optional(), availability: z.string().optional(), }) ), @@ -71,7 +70,7 @@ export default async function handler( } }); await stagehand.init(); - console.log("\nInitialized 🤘 Stagehand"); + console.log("\nInitialized Stagehand"); await page.setViewportSize({ width: 1280, height: 800 }); @@ -100,7 +99,7 @@ export default async function handler( // Extract all book details from the current page const result = await stagehand.extract( - "Extract all books visible on the page with their complete details including title, price, rating, and availability", + "Extract all books visible on the page with their complete details including title, price and availability", bookDetailsSchema, ); allBooks.push(...result.books ?? []); @@ -138,7 +137,7 @@ export default async function handler( } } finally { // Cleanup Stagehand - console.log("\nClosing 🤘 Stagehand..."); + console.log("\nClosing Stagehand..."); await stagehand.close(); }