langchain/templates/extraction-anthropic-functions/extraction_anthropic_functions.ipynb
Erick Friis a1fae1fddd
Readme rewrite (#12615)
Co-authored-by: Lance Martin <lance@langchain.dev>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
2023-10-31 00:06:02 -07:00

77 lines
1.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "4ae4b789",
"metadata": {},
"source": [
"## Document Loading\n",
"\n",
"Load a blog post on agents."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "5d6bd62e",
"metadata": {},
"outputs": [],
"source": [
"from langchain.document_loaders import WebBaseLoader\n",
"\n",
"loader = WebBaseLoader(\"https://lilianweng.github.io/posts/2023-06-23-agent/\")\n",
"text = loader.load()"
]
},
{
"cell_type": "markdown",
"id": "8e21575d",
"metadata": {},
"source": [
"## Run Template\n",
"\n",
"In `server.py`, set -\n",
"```\n",
"add_routes(app, chain_ext, path=\"/extraction-anthropic-functions\")\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5fd794ec-a002-490e-8eb9-06ce3e6c2f14",
"metadata": {},
"outputs": [],
"source": [
"from langserve.client import RemoteRunnable\n",
"\n",
"anthropic_function_model = RemoteRunnable(\n",
" \"http://localhost:8001/extraction-anthropic-functions\"\n",
")\n",
"anthropic_function_model.invoke(text[0].page_content[0:1500])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "langserve",
"language": "python",
"name": "langserve"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
}
},
"nbformat": 4,
"nbformat_minor": 5
}