mirror of
https://github.com/hwchase17/langchain
synced 2024-11-18 09:25:54 +00:00
fa5d49f2c1
ran ```bash g grep -l "langchain.vectorstores" | xargs -L 1 sed -i '' "s/langchain\.vectorstores/langchain_community.vectorstores/g" g grep -l "langchain.document_loaders" | xargs -L 1 sed -i '' "s/langchain\.document_loaders/langchain_community.document_loaders/g" g grep -l "langchain.chat_loaders" | xargs -L 1 sed -i '' "s/langchain\.chat_loaders/langchain_community.chat_loaders/g" g grep -l "langchain.document_transformers" | xargs -L 1 sed -i '' "s/langchain\.document_transformers/langchain_community.document_transformers/g" g grep -l "langchain\.graphs" | xargs -L 1 sed -i '' "s/langchain\.graphs/langchain_community.graphs/g" g grep -l "langchain\.memory\.chat_message_histories" | xargs -L 1 sed -i '' "s/langchain\.memory\.chat_message_histories/langchain_community.chat_message_histories/g" gco master libs/langchain/tests/unit_tests/*/test_imports.py gco master libs/langchain/tests/unit_tests/**/test_public_api.py ```
77 lines
1.6 KiB
Plaintext
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_community.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
|
|
}
|