Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new scrims to docs #3050

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/docs/additional_resources/tutorials/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ introduction to LangChain and a great first project for learning how to use Lang
- [The basics (PromptTemplate + LLM)](https://scrimba.com/scrim/c6rD6Nt9)
- [Adding an output parser](https://scrimba.com/scrim/co6ae44248eacc1abd87ae3dc)
- [Attaching function calls to a model](https://scrimba.com/scrim/cof5449f5bc972f8c90be6a82)
- [Composing multiple chains](https://scrimba.com/scrim/co14344c29595bfb29c41f12a)
- [Retrieval chains](https://scrimba.com/scrim/co0e040d09941b4000244db46)
- [Conversational retrieval chains ("Chat with Docs")](https://scrimba.com/scrim/co3ed4a9eb4c6c6d0361a507c)

### Deeper dives

Expand Down
1 change: 1 addition & 0 deletions docs/docs/expression_language/cookbook/adding_memory.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 4
title: Adding memory
hide_table_of_contents: true
---

# Adding memory
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/expression_language/cookbook/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ import DocCardList from "@theme/DocCardList";

Example code for accomplishing common tasks with the LangChain Expression Language (LCEL). These examples show how to compose different Runnable (the core LCEL interface) components to achieve various tasks. If you're just getting acquainted with LCEL, the [Prompt + LLM](/docs/expression_language/cookbook/prompt_llm_parser) page is a good place to start.

Several pages in this section include embedded interactive screencasts from [Scrimba](https://scrimba.com).
They're a great resource for getting started - you can edit the included code whenever you want, just as if you were pair programming with a teacher!

<DocCardList />
16 changes: 14 additions & 2 deletions docs/docs/expression_language/cookbook/multiple_chains.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
---
sidebar_position: 2
sidebar_position: 1
title: Multiple chains
hide_table_of_contents: true
---

# Multiple chains

Runnables can easily be used to combine multiple Chains:
Runnables can be used to combine multiple Chains together:

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/co14344c29595bfb29c41f12a?embed=langchain,mini-header"
width="100%"
height="600px"
></iframe>
</details>

import CodeBlock from "@theme/CodeBlock";

Expand Down
26 changes: 16 additions & 10 deletions docs/docs/expression_language/cookbook/prompt_llm_parser.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ One of the most foundational Expression Language compositions is taking:

Almost all other chains you build will use this building block.

## Interactive walkthrough

The below scrim from [Scrimba](https://scrimba.com/scrim/c6rD6Nt9) interactively walks through a simple prompt template + LLM chain.
You can update and run the code **as it's being written in the video**:

<iframe
src="https://scrimba.com/scrim/c6rD6Nt9?embed=langchain,mini-header"
width="100%"
height="600px"
></iframe>
<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/c6rD6Nt9?embed=langchain,mini-header"
width="100%"
height="600px"
></iframe>
</details>

## PromptTemplate + LLM

Expand All @@ -39,6 +39,8 @@ Often times we want to attach kwargs to the model that's passed in. To do this,

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/co9704e389428fe2193eb955c?embed=langchain,mini-header"
width="100%"
Expand All @@ -54,6 +56,8 @@ import StopSequenceExample from "@examples/guides/expression_language/cookbook_s

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/cof5449f5bc972f8c90be6a82?embed=langchain,mini-header"
width="100%"
Expand All @@ -69,6 +73,8 @@ import FunctionCallExample from "@examples/guides/expression_language/cookbook_f

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/co6ae44248eacc1abd87ae3dc?embed=langchain,mini-header"
width="100%"
Expand Down
25 changes: 24 additions & 1 deletion docs/docs/expression_language/cookbook/retrieval.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
---
sidebar_position: 1
sidebar_position: 2
title: Retrieval augmented generation (RAG)
hide_table_of_contents: true
---

# RAG

Let's now look at adding in a retrieval step to a prompt and an LLM, which adds up to a "retrieval-augmented generation" chain:

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/co0e040d09941b4000244db46?embed=langchain,mini-header"
width="100%"
height="600px"
></iframe>
</details>

import CodeBlock from "@theme/CodeBlock";
import RetrieverExample from "@examples/guides/expression_language/cookbook_retriever.ts";

Expand All @@ -17,6 +29,17 @@ import RetrieverExample from "@examples/guides/expression_language/cookbook_retr
Because `RunnableSequence.from` and `runnable.pipe` both accept runnable-like objects, including single-argument functions, we can add in conversation history via a formatting function.
This allows us to recreate the popular `ConversationalRetrievalQAChain` to "chat with data":

<details>
<summary>Interactive tutorial</summary>
The screencast below interactively walks through a simple prompt template + LLM
chain. You can update and run the code as it's being written in the video!
<iframe
src="https://scrimba.com/scrim/co3ed4a9eb4c6c6d0361a507c?embed=langchain,mini-header"
width="100%"
height="600px"
></iframe>
</details>

import ConversationalRetrievalExample from "@examples/guides/expression_language/cookbook_conversational_retrieval.ts";

<CodeBlock language="typescript">{ConversationalRetrievalExample}</CodeBlock>
Expand Down
1 change: 1 addition & 0 deletions docs/docs/expression_language/cookbook/sql_db.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 3
title: Querying a SQL DB
hide_table_of_contents: true
---

# Querying a SQL DB
Expand Down
1 change: 1 addition & 0 deletions docs/docs/expression_language/cookbook/tools.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
sidebar_position: 5
title: Using tools
hide_table_of_contents: true
---

# Using tools
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/expression_language/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ hide_table_of_contents: true
LangChain Expression Language or LCEL is a declarative way to easily compose chains together.
Any chain constructed this way will automatically have full sync, async, and streaming support.

If you're looking for a good place to get started, check out the [Cookbook section](/docs/expression_language/cookbook) - it shows off
the various Expression Language pieces in order from simple to more complex.

#### [Interface](/docs/expression_language/interface)

The base interface shared by all LCEL objects
Expand Down
5 changes: 5 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ module.exports = {
id: "modules/index",
},
},
{
type: "doc",
label: "Security",
id: "security",
},
{
type: "category",
label: "Guides",
Expand Down