Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbrenno committed Feb 3, 2025
1 parent 54f34ff commit 8664f4d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/webson/_webson.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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(
Expand Down

0 comments on commit 8664f4d

Please sign in to comment.