Skip to content

Commit

Permalink
Merge branch 'main' into brace/generic-chat-model
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul authored Jul 24, 2024
2 parents 25e25b5 + 636c17f commit 7b7bb6e
Show file tree
Hide file tree
Showing 46 changed files with 1,336 additions and 81 deletions.
3 changes: 3 additions & 0 deletions docs/core_docs/docs/concepts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ After that, you can enable it by setting environment variables:
```shell
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls__...

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

## LangChain Expression Language
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/agent_executor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/debugging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ After you sign up at the link above, make sure to set your environment variables
```shell
export LANGCHAIN_TRACING_V2="true"
export LANGCHAIN_API_KEY="..."

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

Let's suppose we have an agent, and want to visualize the actions it takes and tool outputs it receives. Without any debugging, here's what we see:
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/graph_constructing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"Next, we need to define Neo4j credentials.\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/graph_mapping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"Next, we need to define Neo4j credentials.\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/graph_prompting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"Next, we need to define Neo4j credentials.\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/graph_semantic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"Next, we need to define Neo4j credentials.\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Here you'll find answers to “How do I….?” types of questions.
These guides are _goal-oriented_ and _concrete_; they're meant to help you complete a specific task.
For conceptual explanations see [Conceptual Guides](/docs/concepts/).
For end-to-end walkthroughs see [Tutorials](/docs/tutorials).
For comprehensive descriptions of every class and function see [API Reference](https://v2.v02.api.js.langchain.com/).
For comprehensive descriptions of every class and function see [API Reference](https://api.js.langchain.com/).

## Installation

Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/message_history.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ If you do want to use LangSmith, after you sign up at the link above, make sure
```bash
export LANGCHAIN_TRACING_V2="true"
export LANGCHAIN_API_KEY="<your-api-key>"

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

Let's create a simple runnable that takes a dict as input and returns a `BaseMessage`.
Expand Down
5 changes: 4 additions & 1 deletion docs/core_docs/docs/how_to/migrate_agent.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"// process.env.LANGCHAIN_API_KEY = \"ls...\";\n",
"// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";\n",
"// process.env.LANGCHAIN_TRACING_V2 = \"true\";\n",
"// process.env.LANGCHAIN_PROJECT = \"How to migrate: LangGraphJS\";"
"// process.env.LANGCHAIN_PROJECT = \"How to migrate: LangGraphJS\";\n",
"\n",
"// Reduce tracing latency if you are not in a serverless environment\n",
"// process.env.LANGCHAIN_CALLBACKS_BACKGROUND = \"true\";"
]
},
{
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/qa_citations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/qa_per_user.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/qa_sources.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/qa_streaming.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/query_few_shot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/query_high_cardinality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/query_multiple_queries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/query_no_queries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/sql_large_db.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export OPENAI_API_KEY="your api key"
# Uncomment the below to use LangSmith. Not required.
# export LANGCHAIN_API_KEY="your api key"
# export LANGCHAIN_TRACING_V2=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook:
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/sql_prompting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export OPENAI_API_KEY="your api key"
# Uncomment the below to use LangSmith. Not required.
# export LANGCHAIN_API_KEY="your api key"
# export LANGCHAIN_TRACING_V2=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook:
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/sql_query_checking.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export OPENAI_API_KEY="your api key"
# Uncomment the below to use LangSmith. Not required.
# export LANGCHAIN_API_KEY="your api key"
# export LANGCHAIN_TRACING_V2=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

The below example will use a SQLite connection with Chinook database. Follow these [installation steps](https://database.guide/2-sample-databases-sqlite/) to create `Chinook.db` in the same directory as this notebook:
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/how_to/tools_prompting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/agents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ When building with LangChain, all steps will automatically be traced in LangSmit
```bash
export LANGCHAIN_TRACING_V2="true"
export LANGCHAIN_API_KEY="<your-api-key>"

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

## Define tools
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/chatbot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"## Quickstart\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/graph.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"Next, we need to define Neo4j credentials.\n",
Expand Down
5 changes: 4 additions & 1 deletion docs/core_docs/docs/tutorials/llm_chain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand All @@ -76,7 +79,7 @@
"```{=mdx}\n",
"import ChatModelTabs from \"@theme/ChatModelTabs\";\n",
"\n",
"<ChatModelTabs openaiParams={`model: \"gpt-4\"`} />\n",
"<ChatModelTabs openaiParams={`{ model: \"gpt-4\" }`} />\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/local_rag.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
16 changes: 6 additions & 10 deletions docs/core_docs/docs/tutorials/qa_chat_history.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand All @@ -80,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -92,15 +95,8 @@
"import { pull } from \"langchain/hub\";\n",
"import { ChatPromptTemplate } from \"@langchain/core/prompts\";\n",
"import { RunnableSequence, RunnablePassthrough } from \"@langchain/core/runnables\";\n",
"import { StringOutputParser } from \"@langchain/core/output_parsers\";"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import { StringOutputParser } from \"@langchain/core/output_parsers\";\n",
"\n",
"import { createStuffDocumentsChain } from \"langchain/chains/combine_documents\";\n",
"\n",
"const loader = new CheerioWebBaseLoader(\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/query_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```"
]
},
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/rag.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
"```\n",
"\n",
"```{=mdx}\n",
Expand Down
3 changes: 3 additions & 0 deletions docs/core_docs/docs/tutorials/sql_qa.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export OPENAI_API_KEY=<your key>
# Uncomment the below to use LangSmith. Not required, but recommended for debugging and observability.
# export LANGCHAIN_API_KEY=<your key>
# export LANGCHAIN_TRACING_V2=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
```

import CodeBlock from "@theme/CodeBlock";
Expand Down
6 changes: 3 additions & 3 deletions docs/core_docs/src/theme/ChatModelTabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ function InstallationInfo({ children }) {
}

const DEFAULTS = {
openaiParams: `{\n model: "gpt-3.5-turbo",\n temperature: 0\n}`,
openaiParams: `{\n model: "gpt-4o-mini",\n temperature: 0\n}`,
anthropicParams: `{\n model: "claude-3-5-sonnet-20240620",\n temperature: 0\n}`,
fireworksParams: `{\n model: "accounts/fireworks/models/firefunction-v1",\n temperature: 0\n}`,
fireworksParams: `{\n model: "accounts/fireworks/models/llama-v3p1-70b-instruct",\n temperature: 0\n}`,
mistralParams: `{\n model: "mistral-large-latest",\n temperature: 0\n}`,
groqParams: `{\n model: "mixtral-8x7b-32768",\n temperature: 0\n}`,
vertexParams: `{\n model: "gemini-1.5-pro",\n temperature: 0\n}`,
vertexParams: `{\n model: "gemini-1.5-flash",\n temperature: 0\n}`,
};

const MODELS_WSO = ["openai", "anthropic", "mistral", "groq", "vertex"];
Expand Down
Loading

0 comments on commit 7b7bb6e

Please sign in to comment.