Created
December 31, 2024 23:19
-
-
Save elijahbenizzy/63b0446cd9ef3d934f69a974e9c88eb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
action(reads=[], writes=["markdown_content"]) | |
def fetch_webpage(state: State, webpage_url: str) -> State: | |
"""Fetch a webpage and convert it to Markdown.""" | |
try: | |
response = sgai_client.markdownify(website_url=webpage_url) | |
markdown_content = response["result"] | |
print(f"Request ID: {response['request_id']}") | |
print(f"Markdown Content: {markdown_content[:200]}... (truncated)") | |
return state.update(markdown_content=markdown_content) | |
except Exception as e: | |
sgai_logger.error(f"Failed to fetch webpage: {e}") | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment