From 8664f4d74b26b5ccca452a8fd7d16430d996c9a5 Mon Sep 17 00:00:00 2001 From: Arthur Brenno <64020210+arthurbrenno@users.noreply.github.com> Date: Mon, 3 Feb 2025 17:46:57 -0300 Subject: [PATCH] . --- src/webson/_webson.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/webson/_webson.py b/src/webson/_webson.py index f1a4a8e..a1f36f0 100644 --- a/src/webson/_webson.py +++ b/src/webson/_webson.py @@ -168,7 +168,7 @@ async def _get_contents_with_browser(self, url: str, browser: Browser) -> str: await page.close() def cast[T: msgspec.Struct]( - self, typ: type[T], url: str, *, browser: Browser | None = None, extra_detail: str | None = None + self, typ: type[T], url: str, *, browser: Browser | None = None, details: str | None = None ) -> T: """ Synchronously casts a webpage's content into a structured output. @@ -191,10 +191,10 @@ def cast[T: msgspec.Struct]( >>> data = webson.cast("https://example.com", to=PageData) >>> print(data.title) """ - return run_sync(self.cast_async, typ, url, browser=browser, extra_detail=extra_detail) + return run_sync(self.cast_async, typ, url, browser=browser, details=details) async def cast_async[T: msgspec.Struct]( - self, typ: type[T], url: str, *, browser: Browser | None = None, extra_detail: str | None = None + self, typ: type[T], url: str, *, browser: Browser | None = None, details: str | None = None ) -> T: """ Asynchronously casts a webpage's content into a structured output. @@ -221,7 +221,7 @@ async def cast_async[T: msgspec.Struct]( # Convert the HTML to markdown for easier parsing. page_md = cast(str, md(page_contents)) - extra = f"## Extra details: \n\n {extra_detail}" if extra_detail else "" + extra = f"## Extra details: \n\n {details}" if details else "" # Use the LLM to generate a structured response based on the markdown. completion = await self.llm.complete_async(