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
| # Commented out IPython magic to ensure Python compatibility. | |
| # %pip install -q langgraph | |
| # %pip install -q langgraph-checkpoint-sqlite | |
| # Demo notebook: https://colab.research.google.com/drive/16V9TpOsLMOuU655ryerni7Hc7mni6hcU?usp=sharing | |
| import os | |
| from google.colab import drive | |
| DRIVE_MOUNT_POINT = "/content/drive" | |
| drive.mount(DRIVE_MOUNT_POINT) |
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
| # -*- coding: utf-8 -*- | |
| """LBKE Anthropic batch runner.ipynb | |
| ## Demo of calling Anthropic Batch API from a LangGraph graph | |
| Improvements: | |
| - an interrupt should be prefered to ending the chart when the work is pending => currently each new run to check if the batch is there will send a new message to the thread since we re-invoke the chart | |
| - better processing responses, maybe using a MessageState/add reducer to treat the response as an assistant message added to a conversation | |
| - as a bonus, polling the chart on a predefined frequence (useful for a quick run) | |
| - test if it still works after the notebook is closed thanks to gdrive checkpointing |
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
| // npm install turndown cheerio | |
| import TurndownService from "turndown" | |
| import { load } from "cheerio" | |
| async function downloadUrlAsMarkdown(url: string, selector?: string) { | |
| try { | |
| const res = await fetch(url) | |
| if (!res.ok) { | |
| throw new Error(`${url} ${res.status} ${res.statusText}`) |
OlderNewer