{ "cells": [ { "attachments": {}, "cell_type": "markdown", "id": "9faf648c-541e-4368-82a8-96287dbf34de", "metadata": {}, "source": [ "## Document Loading\n", "\n", "Load a blog post on agents." ] }, { "cell_type": "code", "execution_count": 1, "id": "662a843a-49e8-40ec-bd32-0f44bc4159a1", "metadata": {}, "outputs": [], "source": [ "from langchain.document_loaders import WebBaseLoader\n", "loader = WebBaseLoader(\"https://lilianweng.github.io/posts/2023-06-23-agent/\")\n", "text = loader.load()" ] }, { "attachments": {}, "cell_type": "markdown", "id": "67306dbd-d79c-4723-825e-7d88edb811ba", "metadata": {}, "source": [ "## Run Template\n", "\n", "In `server.py`, set -\n", "```\n", "add_routes(app, chain_ext, path=\"/llama2_functions\")\n", "```" ] }, { "cell_type": "code", "execution_count": null, "id": "3668ba4b-254e-4a3b-bfb5-53242572cb1b", "metadata": {}, "outputs": [], "source": [ "from langserve.client import RemoteRunnable\n", "llama2_function = RemoteRunnable('http://0.0.0.0:8001/llama2_functions')\n", "llama2_function.invoke({\"input\":text[0].page_content[0:1500]})" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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 }