Harrison/docs smith serve (#12898)

Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
Harrison Chase 2023-11-06 07:07:25 -08:00 committed by GitHub
parent 53f453f01a
commit 1a92d2245d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 77 additions and 44 deletions

View File

@ -15,7 +15,7 @@ poetry run python scripts/model_feat_table.py
poetry run nbdoc_build --srcdir docs poetry run nbdoc_build --srcdir docs
cp ../cookbook/README.md src/pages/cookbook.mdx cp ../cookbook/README.md src/pages/cookbook.mdx
cp ../.github/CONTRIBUTING.md docs/contributing.md cp ../.github/CONTRIBUTING.md docs/contributing.md
wget https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/guides/deployments/langserve.md wget https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md
poetry run python scripts/generate_api_reference_links.py poetry run python scripts/generate_api_reference_links.py
yarn install yarn install
yarn start yarn start

View File

@ -8,11 +8,31 @@ sidebar_position: 0
- **Are context-aware**: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.) - **Are context-aware**: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
- **Reason**: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.) - **Reason**: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)
The main value props of LangChain are: This framework consists of several parts.
1. **Components**: abstractions for working with language models, along with a collection of implementations for each abstraction. Components are modular and easy-to-use, whether you are using the rest of the LangChain framework or not You can see how the parts interact with each other below:
2. **Off-the-shelf chains**: a structured assembly of components for accomplishing specific higher-level tasks
![LangChain Diagram](/img/langchain_stack.jpg)
These parts include:
- **[LangChain Packages]**: The Python and JavaScript packages. Contains interfaces and integrations for a myriad of components, a basic run time for combining these components into chains and agents, and off-the-shelf implementations of chains and agents.
- **[LangChain Templates](https://github.com/langchain-ai/langchain/tree/master/templates)**: A collection of easily deployable reference architectures for a wide variety of tasks.
- **[LangServe](https://github.com/langchain-ai/langserve)**: A library for deploying LangChain chains as a REST API.
- **[LangSmith](https://smith.langchain.com/)**: A developer platform that lets you debug, test, evaluate, and monitor chains built on any LLM framework and seamlessly integrates with LangChain.
Together, these products simplify the entire application lifecycle:
- **Develop**: Write your applications in LangChain/LangChain.js. Hit the ground running using Templates for reference.
- **Productionize**: Use LangSmith to inspect, test and monitor your chains, so that you can constantly improve and deploy with confidence.
- **Deploy**: Turn any chain into an API with LangServe.
## LangChain Packages
The main value props of the LangChain packages are:
1. **Components**: composable tools and integrations for working with language models. Components are modular and easy-to-use, whether you are using the rest of the LangChain framework or not
2. **Off-the-shelf chains**: built-in assemblages of components for accomplishing higher-level tasks
Off-the-shelf chains make it easy to get started. Components make it easy to customize existing chains and build new ones.
Off-the-shelf chains make it easy to get started. For complex applications, components make it easy to customize existing chains and build new ones.
## Get started ## Get started
@ -20,11 +40,9 @@ Off-the-shelf chains make it easy to get started. For complex applications, comp
We recommend following our [Quickstart](/docs/get_started/quickstart) guide to familiarize yourself with the framework by building your first LangChain application. We recommend following our [Quickstart](/docs/get_started/quickstart) guide to familiarize yourself with the framework by building your first LangChain application.
_**Note**: These docs are for the LangChain [Python package](https://github.com/langchain-ai/langchain). For documentation on [LangChain.js](https://github.com/langchain-ai/langchainjs), the JS/TS version, [head here](https://js.langchain.com/docs)._
## Modules ## Modules
LangChain provides standard, extendable interfaces and external integrations for the following modules, listed from least to most complex: LangChain provides standard, extendable interfaces and integrations for the following modules, listed from least to most complex:
#### [Model I/O](/docs/modules/model_io/) #### [Model I/O](/docs/modules/model_io/)
Interface with language models Interface with language models
@ -41,21 +59,18 @@ Log and stream intermediate steps of any chain
## Examples, ecosystem, and resources ## Examples, ecosystem, and resources
### [Use cases](/docs/use_cases/question_answering/) ### [Use cases](/docs/use_cases/question_answering/)
Walkthroughs and best-practices for common end-to-end use cases, like: Walkthroughs and techniques for common end-to-end use cases, like:
- [Document question answering](/docs/use_cases/question_answering/) - [Document question answering](/docs/use_cases/question_answering/)
- [Chatbots](/docs/use_cases/chatbots/) - [Chatbots](/docs/use_cases/chatbots/)
- [Analyzing structured data](/docs/use_cases/qa_structured/sql/) - [Analyzing structured data](/docs/use_cases/qa_structured/sql/)
- and much more... - and much more...
### [Guides](/docs/guides/) ### [Guides](/docs/guides/)
Learn best practices for developing with LangChain. Best practices for developing with LangChain.
### [Ecosystem](/docs/integrations/providers/) ### [Ecosystem](/docs/integrations/providers/)
LangChain is part of a rich ecosystem of tools that integrate with our framework and build on top of it. Check out our growing list of [integrations](/docs/integrations/providers/) and [dependent repos](/docs/additional_resources/dependents). LangChain is part of a rich ecosystem of tools that integrate with our framework and build on top of it. Check out our growing list of [integrations](/docs/integrations/providers/) and [dependent repos](/docs/additional_resources/dependents).
### [Additional resources](/docs/additional_resources/)
Our community is full of prolific developers, creative builders, and fantastic teachers. Check out [YouTube tutorials](/docs/additional_resources/youtube) for great tutorials from folks in the community, and [Gallery](https://github.com/kyrolabs/awesome-langchain) for a list of awesome LangChain projects, compiled by the folks at [KyroLabs](https://kyrolabs.com).
### [Community](/docs/community) ### [Community](/docs/community)
Head to the [Community navigator](/docs/community) to find places to ask questions, share feedback, meet other developers, and dream about the future of LLMs. Head to the [Community navigator](/docs/community) to find places to ask questions, share feedback, meet other developers, and dream about the future of LLMs.

View File

@ -44,6 +44,19 @@ from langchain.llms import OpenAI
llm = OpenAI(openai_api_key="...") llm = OpenAI(openai_api_key="...")
``` ```
## LangSmith Setup
Many of the applications you build with LangChain will contain multiple steps with multiple invocations of LLM calls.
As these applications get more and more complex, it becomes crucial to be able to inspect what exactly is going on inside your chain or agent.
The best way to do this is with [LangSmith](smith.langchain.com).
Note that LangSmith is not needed, but it is helpful.
If you do want to use LangSmith, after you sign up at the link above, make sure to set your environment variables to start logging traces:
```shell
export LANGCHAIN_TRACING_V2="true"
export LANGCHAIN_API_KEY=...
```
## Building an application ## Building an application

View File

Before

Width:  |  Height:  |  Size: 766 KiB

After

Width:  |  Height:  |  Size: 766 KiB

View File

Before

Width:  |  Height:  |  Size: 815 KiB

After

Width:  |  Height:  |  Size: 815 KiB

View File

@ -1,11 +1,13 @@
# LangSmith ---
sidebar_class_name: hidden
---
import DocCardList from "@theme/DocCardList"; # LangSmith
[LangSmith](https://smith.langchain.com) helps you trace and evaluate your language model applications and intelligent agents to help you [LangSmith](https://smith.langchain.com) helps you trace and evaluate your language model applications and intelligent agents to help you
move from prototype to production. move from prototype to production.
Check out the [interactive walkthrough](/docs/guides/langsmith/walkthrough) below to get started. Check out the [interactive walkthrough](/docs/guides/langsmith/walkthrough) to get started.
For more information, please refer to the [LangSmith documentation](https://docs.smith.langchain.com/). For more information, please refer to the [LangSmith documentation](https://docs.smith.langchain.com/).
@ -18,5 +20,3 @@ check out the [LangSmith Cookbook](https://github.com/langchain-ai/langsmith-coo
- How to fine-tune a LLM on real usage data ([link](https://github.com/langchain-ai/langsmith-cookbook/blob/main/fine-tuning-examples/export-to-openai/fine-tuning-on-chat-runs.ipynb)). - How to fine-tune a LLM on real usage data ([link](https://github.com/langchain-ai/langsmith-cookbook/blob/main/fine-tuning-examples/export-to-openai/fine-tuning-on-chat-runs.ipynb)).
- How to use the [LangChain Hub](https://smith.langchain.com/hub) to version your prompts ([link](https://github.com/langchain-ai/langsmith-cookbook/blob/main/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb)) - How to use the [LangChain Hub](https://smith.langchain.com/hub) to version your prompts ([link](https://github.com/langchain-ai/langsmith-cookbook/blob/main/hub-examples/retrieval-qa-chain/retrieval-qa.ipynb))
<DocCardList />

View File

@ -7,7 +7,7 @@
"tags": [] "tags": []
}, },
"source": [ "source": [
"# LangSmith Walkthrough\n", "# Walkthrough\n",
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/langsmith/walkthrough.ipynb)\n", "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/langchain-ai/langchain/blob/master/docs/docs/guides/langsmith/walkthrough.ipynb)\n",
"\n", "\n",
"LangChain makes it easy to prototype LLM applications and Agents. However, delivering LLM applications to production can be deceptively difficult. You will likely have to heavily customize and iterate on your prompts, chains, and other components to create a high-quality product.\n", "LangChain makes it easy to prototype LLM applications and Agents. However, delivering LLM applications to production can be deceptively difficult. You will likely have to heavily customize and iterate on your prompts, chains, and other components to create a high-quality product.\n",
@ -790,7 +790,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.2" "version": "3.9.1"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -159,6 +159,12 @@ const config = {
sidebarId: "integrations", sidebarId: "integrations",
label: "Integrations", label: "Integrations",
}, },
{
type: "docSidebar",
position: "left",
sidebarId: "guides",
label: "Guides",
},
{ {
href: "https://api.python.langchain.com", href: "https://api.python.langchain.com",
label: "API", label: "API",
@ -192,30 +198,31 @@ const config = {
{ label: "Gallery", href: "https://github.com/kyrolabs/awesome-langchain" } { label: "Gallery", href: "https://github.com/kyrolabs/awesome-langchain" }
] ]
}, },
{
href: "https://chat.langchain.com",
label: "Chat our docs",
position: "right",
},
{ {
type: "dropdown", type: "dropdown",
label: "Also by LangChain", label: "Also by LangChain",
position: "right", position: "right",
items: [ items: [
{
href: "https://chat.langchain.com",
label: "Chat our docs",
},
{ {
href: "https://smith.langchain.com", href: "https://smith.langchain.com",
label: "LangSmith", label: "LangSmith",
}, },
{
href: "https://github.com/langchain-ai/langserve",
label: "LangServe GitHub",
},
{ {
href: "https://smith.langchain.com/hub", href: "https://smith.langchain.com/hub",
label: "LangChain Hub", label: "LangChain Hub",
}, },
{ {
href: "https://github.com/langchain-ai/langserve", href: "https://js.langchain.com",
label: "LangServe", label: "JS/TS Docs",
},
{
href: "https://js.langchain.com/docs",
label: "JS/TS",
}, },
] ]
}, },

View File

@ -26,7 +26,7 @@ module.exports = {
label: "Get started", label: "Get started",
collapsed: false, collapsed: false,
collapsible: false, collapsible: false,
items: [{ type: "autogenerated", dirName: "get_started" }], items: [{ type: "autogenerated", dirName: "get_started" }, "security"],
link: { link: {
type: 'generated-index', type: 'generated-index',
description: 'Get started with LangChain', description: 'Get started with LangChain',
@ -46,29 +46,24 @@ module.exports = {
{ {
type: "category", type: "category",
label: "Modules", label: "Modules",
collapsed: false, collapsed: true,
items: [{ type: "autogenerated", dirName: "modules" } ], items: [{ type: "autogenerated", dirName: "modules" } ],
link: { link: {
type: 'doc', type: 'doc',
id: "modules/index" id: "modules/index"
}, },
}, },
{ {type: "doc", id: "langserve", label: "LangServe"},
type: "doc",
label: "Security",
id: "security",
},
{ {
type: "category", type: "category",
label: "Guides", label: "LangSmith",
collapsed: true, collapsed: true,
items: [{ type: "autogenerated", dirName: "guides" }], items: [{ type: "autogenerated", dirName: "langsmith" } ],
link: { link: {
type: 'generated-index', type: 'doc',
description: 'Design guides for key parts of the development process', id: "langsmith/index"
slug: "guides",
}, },
} },
], ],
integrations: [ integrations: [
{ {
@ -111,4 +106,7 @@ module.exports = {
use_cases: [ use_cases: [
{type: "autogenerated", dirName: "use_cases" } {type: "autogenerated", dirName: "use_cases" }
], ],
guides: [
{type: "autogenerated", dirName: "guides" }
],
}; };

BIN
docs/static/img/langchain_stack.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

View File

@ -50,5 +50,5 @@ python3.11 scripts/model_feat_table.py
nbdoc_build --srcdir docs nbdoc_build --srcdir docs
cp ../cookbook/README.md src/pages/cookbook.mdx cp ../cookbook/README.md src/pages/cookbook.mdx
cp ../.github/CONTRIBUTING.md docs/contributing.md cp ../.github/CONTRIBUTING.md docs/contributing.md
wget https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/guides/deployments/langserve.md wget https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md
python3.11 scripts/generate_api_reference_links.py python3.11 scripts/generate_api_reference_links.py