mirror of
https://github.com/hwchase17/langchain.git
synced 2026-02-04 16:20:16 +00:00
Compare commits
29 Commits
bagatur/st
...
erick/docs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03370bc85b | ||
|
|
ae7732f8cb | ||
|
|
14463f00fb | ||
|
|
fa468334a2 | ||
|
|
9a4654ab05 | ||
|
|
b449e55308 | ||
|
|
781b5b1933 | ||
|
|
6ae1fff7ec | ||
|
|
cac127923d | ||
|
|
807c484a26 | ||
|
|
22d8b7b271 | ||
|
|
65f4594e71 | ||
|
|
5b9fd4557f | ||
|
|
bdc49608f9 | ||
|
|
ad5c74be07 | ||
|
|
477cc2b5d9 | ||
|
|
1cc751ba06 | ||
|
|
06707e55da | ||
|
|
1f095f8515 | ||
|
|
543f163c23 | ||
|
|
0cfb4d9b90 | ||
|
|
5d16d107e9 | ||
|
|
c5e731a73f | ||
|
|
7919ee2c9b | ||
|
|
65ae6b8bbf | ||
|
|
4e7b1110e6 | ||
|
|
26d7b8581e | ||
|
|
2395e230d9 | ||
|
|
894f7a7748 |
@@ -9,17 +9,15 @@ SCRIPT_DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||
cd "${SCRIPT_DIR}"
|
||||
|
||||
mkdir -p ../_dist
|
||||
rsync -ruv . ../_dist
|
||||
rsync -ruv --exclude ./node_modules . ../_dist
|
||||
cd ../_dist
|
||||
poetry run python scripts/model_feat_table.py
|
||||
poetry run nbdoc_build --srcdir docs --pause 0
|
||||
mkdir docs/templates
|
||||
cp ../templates/docs/INDEX.md docs/templates/index.md
|
||||
cp ../cookbook/README.md src/pages/cookbook.mdx
|
||||
cp ../.github/CONTRIBUTING.md docs/contributing.md
|
||||
mkdir -p docs/templates
|
||||
cp ../templates/docs/INDEX.md docs/templates/index.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
|
||||
yarn install
|
||||
yarn start
|
||||
|
||||
yarn
|
||||
|
||||
quarto preview docs
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
"sidebar_position: 0.5\n",
|
||||
"title: Why use LCEL\n",
|
||||
"---\n",
|
||||
"\n",
|
||||
"import { ColumnContainer, Column } from '@theme/Columns';"
|
||||
"```{=mdx}\n",
|
||||
"import {ColumnContainer, Column} from '@theme/Columns';\n",
|
||||
"```"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -18,7 +19,8 @@
|
||||
"id": "919a5ae2-ed21-4923-b98f-723c111bac67",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
":::tip We recommend reading the LCEL [Get started](/docs/expression_language/get_started) section first.\n",
|
||||
":::tip \n",
|
||||
"We recommend reading the LCEL [Get started](/docs/expression_language/get_started) section first.\n",
|
||||
":::"
|
||||
]
|
||||
},
|
||||
@@ -62,11 +64,12 @@
|
||||
"In the simplest case, we just want to pass in a topic string and get back a joke string:\n",
|
||||
"\n",
|
||||
"<ColumnContainer>\n",
|
||||
"\n",
|
||||
"<Column>\n",
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -76,6 +79,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"from typing import List\n",
|
||||
"\n",
|
||||
"import openai\n",
|
||||
@@ -111,7 +115,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -156,7 +160,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -201,7 +205,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -233,7 +237,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -265,7 +269,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -296,7 +300,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -337,7 +341,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>\n",
|
||||
"<div style=\"zoom:80%\">\n",
|
||||
"\n",
|
||||
"```python\n",
|
||||
"chain.ainvoke(\"ice cream\")\n",
|
||||
@@ -362,7 +366,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -398,7 +402,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -439,7 +443,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -481,7 +485,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -522,7 +526,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -607,7 +611,7 @@
|
||||
"\n",
|
||||
"#### With LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -677,7 +681,7 @@
|
||||
"\n",
|
||||
"We'll `print` intermediate steps for illustrative purposes\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -711,7 +715,7 @@
|
||||
"#### LCEL\n",
|
||||
"Every component has built-in integrations with LangSmith. If we set the following two environment variables, all chain traces are logged to LangSmith.\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -757,7 +761,7 @@
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -804,7 +808,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -845,7 +849,7 @@
|
||||
"\n",
|
||||
"#### Without LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -1029,7 +1033,7 @@
|
||||
"\n",
|
||||
"#### LCEL\n",
|
||||
"\n",
|
||||
"<div style={{ zoom: \"80%\" }}>"
|
||||
"<div style=\"zoom:80%\">"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -151,7 +151,9 @@ chat_model.invoke(messages)
|
||||
# >> AIMessage(content="Socks O'Color")
|
||||
```
|
||||
|
||||
<details> <summary>Go deeper</summary>
|
||||
<details>
|
||||
|
||||
<summary>Go deeper</summary>
|
||||
|
||||
`LLM.invoke` and `ChatModel.invoke` actually both support as input any of `Union[str, List[BaseMessage], PromptValue]`.
|
||||
`PromptValue` is an object that defines it's own custom logic for returning it's inputs either as a string or as messages.
|
||||
|
||||
@@ -12,7 +12,7 @@ Platforms with tracing capabilities like [LangSmith](/docs/langsmith/) and [Wand
|
||||
|
||||
For anyone building production-grade LLM applications, we highly recommend using a platform like this.
|
||||
|
||||

|
||||

|
||||
|
||||
## `set_debug` and `set_verbose`
|
||||
|
||||
@@ -58,7 +58,9 @@ set_debug(True)
|
||||
agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?")
|
||||
```
|
||||
|
||||
<details> <summary>Console output</summary>
|
||||
<details>
|
||||
|
||||
<summary>Console output</summary>
|
||||
|
||||
<CodeOutputBlock lang="python">
|
||||
|
||||
@@ -250,13 +252,13 @@ agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is
|
||||
{
|
||||
"question": "52*365",
|
||||
"stop": [
|
||||
"```output"
|
||||
"\`\`\`output"
|
||||
]
|
||||
}
|
||||
[llm/start] [1:RunTypeEnum.chain:AgentExecutor > 10:RunTypeEnum.tool:Calculator > 11:RunTypeEnum.chain:LLMMathChain > 12:RunTypeEnum.chain:LLMChain > 13:RunTypeEnum.llm:ChatOpenAI] Entering LLM run with input:
|
||||
{
|
||||
"prompts": [
|
||||
"Human: Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${Question with math problem.}\n```text\n${single line mathematical expression that solves the problem}\n```\n...numexpr.evaluate(text)...\n```output\n${Output of running the code}\n```\nAnswer: ${Answer}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n```text\n37593 * 67\n```\n...numexpr.evaluate(\"37593 * 67\")...\n```output\n2518731\n```\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n```text\n37593**(1/5)\n```\n...numexpr.evaluate(\"37593**(1/5)\")...\n```output\n8.222831614237718\n```\nAnswer: 8.222831614237718\n\nQuestion: 52*365"
|
||||
"Human: Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.\n\nQuestion: ${Question with math problem.}\n\`\`\`text\n${single line mathematical expression that solves the problem}\n\`\`\`\n...numexpr.evaluate(text)...\n\`\`\`output\n${Output of running the code}\n\`\`\`\nAnswer: ${Answer}\n\nBegin.\n\nQuestion: What is 37593 * 67?\n\`\`\`text\n37593 * 67\n\`\`\`\n...numexpr.evaluate(\"37593 * 67\")...\n\`\`\`output\n2518731\n\`\`\`\nAnswer: 2518731\n\nQuestion: 37593^(1/5)\n\`\`\`text\n37593**(1/5)\n\`\`\`\n...numexpr.evaluate(\"37593**(1/5)\")...\n\`\`\`output\n8.222831614237718\n\`\`\`\nAnswer: 8.222831614237718\n\nQuestion: 52*365"
|
||||
]
|
||||
}
|
||||
[llm/end] [1:RunTypeEnum.chain:AgentExecutor > 10:RunTypeEnum.tool:Calculator > 11:RunTypeEnum.chain:LLMMathChain > 12:RunTypeEnum.chain:LLMChain > 13:RunTypeEnum.llm:ChatOpenAI] [2.89s] Exiting LLM run with output:
|
||||
@@ -264,7 +266,7 @@ agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is
|
||||
"generations": [
|
||||
[
|
||||
{
|
||||
"text": "```text\n52*365\n```\n...numexpr.evaluate(\"52*365\")...\n",
|
||||
"text": "\`\`\`text\n52*365\n\`\`\`\n...numexpr.evaluate(\"52*365\")...\n",
|
||||
"generation_info": {
|
||||
"finish_reason": "stop"
|
||||
},
|
||||
@@ -278,7 +280,7 @@ agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is
|
||||
"AIMessage"
|
||||
],
|
||||
"kwargs": {
|
||||
"content": "```text\n52*365\n```\n...numexpr.evaluate(\"52*365\")...\n",
|
||||
"content": "\`\`\`text\n52*365\n\`\`\`\n...numexpr.evaluate(\"52*365\")...\n",
|
||||
"additional_kwargs": {}
|
||||
}
|
||||
}
|
||||
@@ -297,7 +299,7 @@ agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is
|
||||
}
|
||||
[chain/end] [1:RunTypeEnum.chain:AgentExecutor > 10:RunTypeEnum.tool:Calculator > 11:RunTypeEnum.chain:LLMMathChain > 12:RunTypeEnum.chain:LLMChain] [2.89s] Exiting Chain run with output:
|
||||
{
|
||||
"text": "```text\n52*365\n```\n...numexpr.evaluate(\"52*365\")...\n"
|
||||
"text": "\`\`\`text\n52*365\n\`\`\`\n...numexpr.evaluate(\"52*365\")...\n"
|
||||
}
|
||||
[chain/end] [1:RunTypeEnum.chain:AgentExecutor > 10:RunTypeEnum.tool:Calculator > 11:RunTypeEnum.chain:LLMMathChain] [2.90s] Exiting Chain run with output:
|
||||
{
|
||||
@@ -388,9 +390,8 @@ set_verbose(True)
|
||||
|
||||
agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?")
|
||||
```
|
||||
|
||||
<details> <summary>Console output</summary>
|
||||
|
||||
<details>
|
||||
<summary>Console output</summary>
|
||||
<CodeOutputBlock lang="python">
|
||||
|
||||
```
|
||||
@@ -507,44 +508,44 @@ agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is
|
||||
Translate a math problem into a expression that can be executed using Python's numexpr library. Use the output of running this code to answer the question.
|
||||
|
||||
Question: ${Question with math problem.}
|
||||
```text
|
||||
\`\`\`text
|
||||
${single line mathematical expression that solves the problem}
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate(text)...
|
||||
```output
|
||||
\`\`\`output
|
||||
${Output of running the code}
|
||||
```
|
||||
\`\`\`
|
||||
Answer: ${Answer}
|
||||
|
||||
Begin.
|
||||
|
||||
Question: What is 37593 * 67?
|
||||
```text
|
||||
\`\`\`text
|
||||
37593 * 67
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate("37593 * 67")...
|
||||
```output
|
||||
\`\`\`output
|
||||
2518731
|
||||
```
|
||||
\`\`\`
|
||||
Answer: 2518731
|
||||
|
||||
Question: 37593^(1/5)
|
||||
```text
|
||||
\`\`\`text
|
||||
37593**(1/5)
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate("37593**(1/5)")...
|
||||
```output
|
||||
\`\`\`output
|
||||
8.222831614237718
|
||||
```
|
||||
\`\`\`
|
||||
Answer: 8.222831614237718
|
||||
|
||||
Question: (2023 - 1970) * 365
|
||||
|
||||
|
||||
> Finished chain.
|
||||
```text
|
||||
\`\`\`text
|
||||
(2023 - 1970) * 365
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate("(2023 - 1970) * 365")...
|
||||
|
||||
Answer: 19345
|
||||
@@ -619,38 +620,40 @@ agent = initialize_agent(
|
||||
agent.run("Who directed the 2023 film Oppenheimer and what is their age? What is their age in days (assume 365 days per year)?")
|
||||
```
|
||||
|
||||
<details> <summary>Console output</summary>
|
||||
<details>
|
||||
|
||||
<CodeOutputBlock lang="python">
|
||||
<summary>Console output</summary>
|
||||
|
||||
```
|
||||
> Entering new AgentExecutor chain...
|
||||
First, I need to find out who directed the film Oppenheimer in 2023 and their birth date. Then, I can calculate their age in years and days.
|
||||
Action: duckduckgo_search
|
||||
Action Input: "Director of 2023 film Oppenheimer"
|
||||
Observation: Oppenheimer: Directed by Christopher Nolan. With Cillian Murphy, Emily Blunt, Robert Downey Jr., Alden Ehrenreich. The story of American scientist J. Robert Oppenheimer and his role in the development of the atomic bomb. In Christopher Nolan's new film, "Oppenheimer," Cillian Murphy stars as J. Robert Oppenheimer, the American physicist who oversaw the Manhattan Project in Los Alamos, N.M. Universal Pictures... J Robert Oppenheimer was the director of the secret Los Alamos Laboratory. It was established under US president Franklin D Roosevelt as part of the Manhattan Project to build the first atomic bomb. He oversaw the first atomic bomb detonation in the New Mexico desert in July 1945, code-named "Trinity". A Review of Christopher Nolan's new film 'Oppenheimer' , the story of the man who fathered the Atomic Bomb. Cillian Murphy leads an all star cast ... Release Date: July 21, 2023. Director ... For his new film, "Oppenheimer," starring Cillian Murphy and Emily Blunt, director Christopher Nolan set out to build an entire 1940s western town.
|
||||
Thought:The director of the 2023 film Oppenheimer is Christopher Nolan. Now I need to find out his birth date to calculate his age.
|
||||
Action: duckduckgo_search
|
||||
Action Input: "Christopher Nolan birth date"
|
||||
Observation: July 30, 1970 (age 52) London England Notable Works: "Dunkirk" "Tenet" "The Prestige" See all related content → Recent News Jul. 13, 2023, 11:11 AM ET (AP) Cillian Murphy, playing Oppenheimer, finally gets to lead a Christopher Nolan film Christopher Edward Nolan CBE (born 30 July 1970) is a British and American filmmaker. Known for his Hollywood blockbusters with complex storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of many accolades, he has been nominated for five Academy Awards, five BAFTA Awards and six Golden Globe Awards. Christopher Nolan is currently 52 according to his birthdate July 30, 1970 Sun Sign Leo Born Place Westminster, London, England, United Kingdom Residence Los Angeles, California, United States Nationality Education Chris attended Haileybury and Imperial Service College, in Hertford Heath, Hertfordshire. Christopher Nolan's next movie will study the man who developed the atomic bomb, J. Robert Oppenheimer. Here's the release date, plot, trailers & more. Date of Birth: 30 July 1970 . ... Christopher Nolan is a British-American film director, producer, and screenwriter. His films have grossed more than US$5 billion worldwide, and have garnered 11 Academy Awards from 36 nominations. ...
|
||||
Thought:Christopher Nolan was born on July 30, 1970. Now I can calculate his age in years and then in days.
|
||||
Action: Calculator
|
||||
Action Input: {"operation": "subtract", "operands": [2023, 1970]}
|
||||
Observation: Answer: 53
|
||||
Thought:Christopher Nolan is 53 years old in 2023. Now I need to calculate his age in days.
|
||||
Action: Calculator
|
||||
Action Input: {"operation": "multiply", "operands": [53, 365]}
|
||||
Observation: Answer: 19345
|
||||
Thought:I now know the final answer
|
||||
Final Answer: The director of the 2023 film Oppenheimer is Christopher Nolan. He is 53 years old in 2023, which is approximately 19345 days.
|
||||
|
||||
> Finished chain.
|
||||
<CodeOutputBlock lang="python">
|
||||
|
||||
```
|
||||
> Entering new AgentExecutor chain...
|
||||
First, I need to find out who directed the film Oppenheimer in 2023 and their birth date. Then, I can calculate their age in years and days.
|
||||
Action: duckduckgo_search
|
||||
Action Input: "Director of 2023 film Oppenheimer"
|
||||
Observation: Oppenheimer: Directed by Christopher Nolan. With Cillian Murphy, Emily Blunt, Robert Downey Jr., Alden Ehrenreich. The story of American scientist J. Robert Oppenheimer and his role in the development of the atomic bomb. In Christopher Nolan's new film, "Oppenheimer," Cillian Murphy stars as J. Robert Oppenheimer, the American physicist who oversaw the Manhattan Project in Los Alamos, N.M. Universal Pictures... J Robert Oppenheimer was the director of the secret Los Alamos Laboratory. It was established under US president Franklin D Roosevelt as part of the Manhattan Project to build the first atomic bomb. He oversaw the first atomic bomb detonation in the New Mexico desert in July 1945, code-named "Trinity". A Review of Christopher Nolan's new film 'Oppenheimer' , the story of the man who fathered the Atomic Bomb. Cillian Murphy leads an all star cast ... Release Date: July 21, 2023. Director ... For his new film, "Oppenheimer," starring Cillian Murphy and Emily Blunt, director Christopher Nolan set out to build an entire 1940s western town.
|
||||
Thought:The director of the 2023 film Oppenheimer is Christopher Nolan. Now I need to find out his birth date to calculate his age.
|
||||
Action: duckduckgo_search
|
||||
Action Input: "Christopher Nolan birth date"
|
||||
Observation: July 30, 1970 (age 52) London England Notable Works: "Dunkirk" "Tenet" "The Prestige" See all related content → Recent News Jul. 13, 2023, 11:11 AM ET (AP) Cillian Murphy, playing Oppenheimer, finally gets to lead a Christopher Nolan film Christopher Edward Nolan CBE (born 30 July 1970) is a British and American filmmaker. Known for his Hollywood blockbusters with complex storytelling, Nolan is considered a leading filmmaker of the 21st century. His films have grossed $5 billion worldwide. The recipient of many accolades, he has been nominated for five Academy Awards, five BAFTA Awards and six Golden Globe Awards. Christopher Nolan is currently 52 according to his birthdate July 30, 1970 Sun Sign Leo Born Place Westminster, London, England, United Kingdom Residence Los Angeles, California, United States Nationality Education Chris attended Haileybury and Imperial Service College, in Hertford Heath, Hertfordshire. Christopher Nolan's next movie will study the man who developed the atomic bomb, J. Robert Oppenheimer. Here's the release date, plot, trailers & more. Date of Birth: 30 July 1970 . ... Christopher Nolan is a British-American film director, producer, and screenwriter. His films have grossed more than US$5 billion worldwide, and have garnered 11 Academy Awards from 36 nominations. ...
|
||||
Thought:Christopher Nolan was born on July 30, 1970. Now I can calculate his age in years and then in days.
|
||||
Action: Calculator
|
||||
Action Input: {"operation": "subtract", "operands": [2023, 1970]}
|
||||
Observation: Answer: 53
|
||||
Thought:Christopher Nolan is 53 years old in 2023. Now I need to calculate his age in days.
|
||||
Action: Calculator
|
||||
Action Input: {"operation": "multiply", "operands": [53, 365]}
|
||||
Observation: Answer: 19345
|
||||
Thought:I now know the final answer
|
||||
Final Answer: The director of the 2023 film Oppenheimer is Christopher Nolan. He is 53 years old in 2023, which is approximately 19345 days.
|
||||
|
||||
> Finished chain.
|
||||
|
||||
|
||||
'The director of the 2023 film Oppenheimer is Christopher Nolan. He is 53 years old in 2023, which is approximately 19345 days.'
|
||||
```
|
||||
'The director of the 2023 film Oppenheimer is Christopher Nolan. He is 53 years old in 2023, which is approximately 19345 days.'
|
||||
```
|
||||
|
||||
</CodeOutputBlock>
|
||||
</CodeOutputBlock>
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@@ -196,7 +196,13 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<a name=\"cite_note-1\"></a><i>1. Note: When it comes to semantic similarity, this often gives better results than older string distance metrics (such as those in the [StringDistanceEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.StringDistanceEvalChain.html#langchain.evaluation.string_distance.base.StringDistanceEvalChain)), though it tends to be less reliable than evaluators that use the LLM directly (such as the [QAEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.qa.eval_chain.QAEvalChain.html#langchain.evaluation.qa.eval_chain.QAEvalChain) or [LabeledCriteriaEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain.html#langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain)) </i>"
|
||||
"<a name=\"cite_note-1\"></a>\n",
|
||||
"\n",
|
||||
"<i>\n",
|
||||
"\n",
|
||||
"1. Note: When it comes to semantic similarity, this often gives better results than older string distance metrics (such as those in the [StringDistanceEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.string_distance.base.StringDistanceEvalChain.html#langchain.evaluation.string_distance.base.StringDistanceEvalChain)), though it tends to be less reliable than evaluators that use the LLM directly (such as the [QAEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.qa.eval_chain.QAEvalChain.html#langchain.evaluation.qa.eval_chain.QAEvalChain) or [LabeledCriteriaEvalChain](https://api.python.langchain.com/en/latest/evaluation/langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain.html#langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain))\n",
|
||||
"\n",
|
||||
"</i>"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"1. `Base model`: What is the base-model and how was it trained?\n",
|
||||
"2. `Fine-tuning approach`: Was the base-model fine-tuned and, if so, what [set of instructions](https://cameronrwolfe.substack.com/p/beyond-llama-the-power-of-open-llms#%C2%A7alpaca-an-instruction-following-llama-model) was used?\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"The relative performance of these models can be assessed using several leaderboards, including:\n",
|
||||
"\n",
|
||||
@@ -55,7 +55,7 @@
|
||||
"\n",
|
||||
"In particular, see [this excellent post](https://finbarr.ca/how-is-llama-cpp-possible/) on the importance of quantization.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"With less precision, we radically decrease the memory needed to store the LLM in memory.\n",
|
||||
"\n",
|
||||
@@ -63,7 +63,7 @@
|
||||
"\n",
|
||||
"A Mac M2 Max is 5-6x faster than a M1 for inference due to the larger GPU memory bandwidth.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Quickstart\n",
|
||||
"\n",
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
"\n",
|
||||
"DeepEval also offers other features such as being able to [automatically create unit tests](https://docs.confident-ai.com/docs/quickstart/synthetic-data-creation), [tests for hallucination](https://docs.confident-ai.com/docs/measuring_llm_performance/factual_consistency).\n",
|
||||
"\n",
|
||||
"If you are interested, check out our Github repository here [https://github.com/confident-ai/deepeval](https://github.com/confident-ai/deepeval). We welcome any PRs and discussions on how to improve LLM performance."
|
||||
"If you are interested, check out our Github repository [here](https://github.com/confident-ai/deepeval). We welcome any PRs and discussions on how to improve LLM performance."
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"source": [
|
||||
"# Baichuan Chat\n",
|
||||
"\n",
|
||||
"Baichuan chat models API by Baichuan Intelligent Technology. For more information, see [https://platform.baichuan-ai.com/docs/api](https://platform.baichuan-ai.com/docs/api)"
|
||||
"Baichuan chat models API by Baichuan Intelligent Technology. For more information, see [https://platform.baichuan-ai.com/docs/api](https://platform.baichuan-ai.com/docs/api/)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -63,7 +63,9 @@
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "AIMessage(content='首先,我们需要确定闰年的二月有多少天。闰年的二月有29天。\\n\\n然后,我们可以计算你的月薪:\\n\\n日薪 = 月薪 / (当月天数)\\n\\n所以,你的月薪 = 日薪 * 当月天数\\n\\n将数值代入公式:\\n\\n月薪 = 8元/天 * 29天 = 232元\\n\\n因此,你在闰年的二月的月薪是232元。')"
|
||||
"text/plain": [
|
||||
"AIMessage(content='首先,我们需要确定闰年的二月有多少天。闰年的二月有29天。\\n\\n然后,我们可以计算你的月薪:\\n\\n日薪 = 月薪 / (当月天数)\\n\\n所以,你的月薪 = 日薪 * 当月天数\\n\\n将数值代入公式:\\n\\n月薪 = 8元/天 * 29天 = 232元\\n\\n因此,你在闰年的二月的月薪是232元。')"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
@@ -76,16 +78,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"## For ChatBaichuan with Streaming"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
"source": [
|
||||
"## For ChatBaichuan with Streaming"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-10-17T15:14:25.870044Z",
|
||||
"start_time": "2023-10-17T15:14:25.863381Z"
|
||||
},
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"chat = ChatBaichuan(\n",
|
||||
@@ -93,22 +102,24 @@
|
||||
" baichuan_secret_key=\"YOUR_SECRET_KEY\",\n",
|
||||
" streaming=True,\n",
|
||||
")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-10-17T15:14:25.870044Z",
|
||||
"start_time": "2023-10-17T15:14:25.863381Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-10-17T15:14:27.153546Z",
|
||||
"start_time": "2023-10-17T15:14:25.868470Z"
|
||||
},
|
||||
"collapsed": false
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "AIMessageChunk(content='首先,我们需要确定闰年的二月有多少天。闰年的二月有29天。\\n\\n然后,我们可以计算你的月薪:\\n\\n日薪 = 月薪 / (当月天数)\\n\\n所以,你的月薪 = 日薪 * 当月天数\\n\\n将数值代入公式:\\n\\n月薪 = 8元/天 * 29天 = 232元\\n\\n因此,你在闰年的二月的月薪是232元。')"
|
||||
"text/plain": [
|
||||
"AIMessageChunk(content='首先,我们需要确定闰年的二月有多少天。闰年的二月有29天。\\n\\n然后,我们可以计算你的月薪:\\n\\n日薪 = 月薪 / (当月天数)\\n\\n所以,你的月薪 = 日薪 * 当月天数\\n\\n将数值代入公式:\\n\\n月薪 = 8元/天 * 29天 = 232元\\n\\n因此,你在闰年的二月的月薪是232元。')"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
@@ -117,14 +128,7 @@
|
||||
],
|
||||
"source": [
|
||||
"chat([HumanMessage(content=\"我日薪8块钱,请问在闰年的二月,我月薪多少\")])"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2023-10-17T15:14:27.153546Z",
|
||||
"start_time": "2023-10-17T15:14:25.868470Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -65,9 +65,9 @@ mrkl.run("Who is Leo DiCaprio's girlfriend? What is her current age raised to th
|
||||
|
||||
> Entering new LLMMathChain chain...
|
||||
21^0.43
|
||||
```text
|
||||
\`\`\`text
|
||||
21**0.43
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate("21**0.43")...
|
||||
|
||||
Answer: 3.7030049853137306
|
||||
@@ -173,29 +173,29 @@ mrkl.run("Who is Leo DiCaprio's girlfriend? What is her current age raised to th
|
||||
> Entering new AgentExecutor chain...
|
||||
Thought: The first question requires a search, while the second question requires a calculator.
|
||||
Action:
|
||||
```
|
||||
\`\`\`
|
||||
{
|
||||
"action": "Search",
|
||||
"action_input": "Leo DiCaprio girlfriend"
|
||||
}
|
||||
```
|
||||
\`\`\`
|
||||
|
||||
Observation: Gigi Hadid: 2022 Leo and Gigi were first linked back in September 2022, when a source told Us Weekly that Leo had his “sights set" on her (alarming way to put it, but okay).
|
||||
Thought:For the second question, I need to calculate the age raised to the 0.43 power. I will use the calculator tool.
|
||||
Action:
|
||||
```
|
||||
\`\`\`
|
||||
{
|
||||
"action": "Calculator",
|
||||
"action_input": "((2022-1995)^0.43)"
|
||||
}
|
||||
```
|
||||
\`\`\`
|
||||
|
||||
|
||||
> Entering new LLMMathChain chain...
|
||||
((2022-1995)^0.43)
|
||||
```text
|
||||
\`\`\`text
|
||||
(2022-1995)**0.43
|
||||
```
|
||||
\`\`\`
|
||||
...numexpr.evaluate("(2022-1995)**0.43")...
|
||||
|
||||
Answer: 4.125593352125936
|
||||
@@ -225,22 +225,22 @@ mrkl.run("What is the full name of the artist who recently released an album cal
|
||||
Question: What is the full name of the artist who recently released an album called 'The Storm Before the Calm' and are they in the FooBar database? If so, what albums of theirs are in the FooBar database?
|
||||
Thought: I should use the Search tool to find the answer to the first part of the question and then use the FooBar DB tool to find the answer to the second part.
|
||||
Action:
|
||||
```
|
||||
\`\`\`
|
||||
{
|
||||
"action": "Search",
|
||||
"action_input": "Who recently released an album called 'The Storm Before the Calm'"
|
||||
}
|
||||
```
|
||||
\`\`\`
|
||||
|
||||
Observation: Alanis Morissette
|
||||
Thought:Now that I know the artist's name, I can use the FooBar DB tool to find out if they are in the database and what albums of theirs are in it.
|
||||
Action:
|
||||
```
|
||||
\`\`\`
|
||||
{
|
||||
"action": "FooBar DB",
|
||||
"action_input": "What albums does Alanis Morissette have in the database?"
|
||||
}
|
||||
```
|
||||
\`\`\`
|
||||
|
||||
|
||||
> Entering new SQLDatabaseChain chain...
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"\n",
|
||||
"The map reduce documents chain first applies an LLM chain to each document individually (the Map step), treating the chain output as a new document. It then passes all the new documents to a separate combine documents chain to get a single output (the Reduce step). It can optionally first compress, or collapse, the mapped documents to make sure that they fit in the combine documents chain (which will often pass them to an LLM). This compression step is performed recursively if necessary.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"\n",
|
||||
"The map re-rank documents chain runs an initial prompt on each document, that not only tries to complete a task but also gives a score for how certain it is in its answer. The highest scoring response is returned.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"The obvious tradeoff is that this chain will make far more LLM calls than, for example, the Stuff documents chain.\n",
|
||||
"There are also certain tasks which are difficult to accomplish iteratively. For example, the Refine chain can perform poorly when documents frequently cross-reference one another or when a task requires detailed information from many documents.\n",
|
||||
"\n",
|
||||
"\n"
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"\n",
|
||||
"This chain is well-suited for applications where documents are small and only a few are passed in for most calls.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
"source": [
|
||||
"### Prerequisites\n",
|
||||
"\n",
|
||||
"* Tecton Deployment (sign up at [https://tecton.ai](https://tecton.ai))\n",
|
||||
"* Tecton Deployment (sign up at [https://tecton.ai](https://tecton.ai/))\n",
|
||||
"* `TECTON_API_KEY` environment variable set to a valid Service Account key"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"* `Functions`: For example, [OpenAI functions](https://platform.openai.com/docs/guides/gpt/function-calling) is one popular means of doing this.\n",
|
||||
"* `LLM-generated interface`: Use an LLM with access to API documentation to create an interface.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -188,7 +188,7 @@
|
||||
" }\n",
|
||||
" ```\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"* This `Dict` above split and the [API is called here](https://github.com/langchain-ai/langchain/blob/7fc07ba5df99b9fa8bef837b0fafa220bc5c932c/libs/langchain/langchain/chains/openai_functions/openapi.py#L215)."
|
||||
]
|
||||
@@ -293,12 +293,12 @@
|
||||
"\n",
|
||||
"* The `api_request_chain` produces the API url from our question and the API documentation:\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"* [Here](https://github.com/langchain-ai/langchain/blob/bbd22b9b761389a5e40fc45b0570e1830aabb707/libs/langchain/langchain/chains/api/base.py#L82) we make the API request with the API url.\n",
|
||||
"* The `api_answer_chain` takes the response from the API and provides us with a natural language response:\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"id": "56615b45",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -546,7 +546,7 @@
|
||||
"source": [
|
||||
"We can see the chat history preserved in the prompt using the [LangSmith trace](https://smith.langchain.com/public/dce34c57-21ca-4283-9020-a8e0d78a59de/r).\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"id": "178dbc59",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -139,7 +139,7 @@
|
||||
"\n",
|
||||
"The [LangSmith trace](https://smith.langchain.com/public/72bc3205-7743-4ca6-929a-966a9d4c2a77/r) shows that we call the function `information_extraction` on the input string, `inp`.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"This `information_extraction` function is defined [here](https://github.com/langchain-ai/langchain/blob/master/libs/langchain/langchain/chains/openai_functions/extraction.py) and returns a dict.\n",
|
||||
"\n",
|
||||
@@ -497,7 +497,7 @@
|
||||
"source": [
|
||||
"We can see from the [LangSmith trace](https://smith.langchain.com/public/8e3aa858-467e-46a5-aa49-5db65f0a2b9a/r) that we get the same output as above.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"We can see that we provide a two-shot prompt in order to instruct the LLM to output in our desired format.\n",
|
||||
"\n",
|
||||
@@ -577,7 +577,7 @@
|
||||
"\n",
|
||||
"We can look at the [LangSmith trace](https://smith.langchain.com/public/69f11d41-41be-4319-93b0-6d0eda66e969/r) to see exactly what is going on under the hood.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"### Going deeper\n",
|
||||
"\n",
|
||||
@@ -587,6 +587,12 @@
|
||||
"* [JSONFormer](/docs/integrations/llms/jsonformer_experimental) offers another way for structured decoding of a subset of the JSON Schema.\n",
|
||||
"* [Kor](https://eyurtsev.github.io/kor/) is another library for extraction where schema and examples can be provided to the LLM."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "aab95ecf",
|
||||
"metadata": {},
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"2. `Query a SQL database` using chains for query creation and execution\n",
|
||||
"3. `Interact with a SQL database` using agents for robust and flexible querying \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Quickstart\n",
|
||||
"\n",
|
||||
@@ -240,7 +240,7 @@
|
||||
"* Followed by three example rows in a `SELECT` statement\n",
|
||||
"\n",
|
||||
"`create_sql_query_chain` adopts this the best practice (see more in this [blog](https://blog.langchain.dev/llms-and-sql/)). \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"**Improvements**\n",
|
||||
"\n",
|
||||
@@ -397,7 +397,7 @@
|
||||
"\n",
|
||||
"* Then, it executes the query and passes the results to an LLM for synthesis.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"**Improvements**\n",
|
||||
"\n",
|
||||
@@ -661,7 +661,7 @@
|
||||
"\n",
|
||||
"* It finally executes the generated query using tool `sql_db_query`\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"- Using LLMs for suggesting refactors or improvements\n",
|
||||
"- Using LLMs for documenting the code\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
@@ -339,7 +339,7 @@
|
||||
"* In particular, the code well structured and kept together in the retrieval output\n",
|
||||
"* The retrieved code and chat history are passed to the LLM for answer distillation\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -58,13 +58,13 @@
|
||||
"2. **Split**: [Text splitters](/docs/modules/data_connection/document_transformers/) break large `Documents` into smaller chunks. This is useful both for indexing data and for passing it in to a model, since large chunks are harder to search over and won't in a model's finite context window.\n",
|
||||
"3. **Store**: We need somewhere to store and index our splits, so that they can later be searched over. This is often done using a [VectorStore](/docs/modules/data_connection/vectorstores/) and [Embeddings](/docs/modules/data_connection/text_embedding/) model.\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"#### Retrieval and generation\n",
|
||||
"4. **Retrieve**: Given a user input, relevant splits are retrieved from storage using a [Retriever](/docs/modules/data_connection/retrievers/).\n",
|
||||
"5. **Generate**: A [ChatModel](/docs/modules/model_io/chat_models) / [LLM](/docs/modules/model_io/llms/) produces an answer using a prompt that includes the question and the retrieved data\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
"id": "8e233997",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -56,7 +56,7 @@
|
||||
"id": "08ec66bc",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -514,7 +514,7 @@
|
||||
"* The blog post and associated [repo](https://github.com/mendableai/QA_clustering) also introduce clustering as a means of summarization.\n",
|
||||
"* This opens up a third path beyond the `stuff` or `map-reduce` approaches that is worth considering.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"- covered topics\n",
|
||||
"- political tendency\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
@@ -293,7 +293,7 @@
|
||||
"* As with [extraction](/docs/use_cases/extraction), we call the `information_extraction` function [here](https://github.com/langchain-ai/langchain/blob/269f85b7b7ffd74b38cd422d4164fc033388c3d0/libs/langchain/langchain/chains/openai_functions/extraction.py#L20) on the input string.\n",
|
||||
"* This OpenAI function extraction information based upon the provided schema.\n",
|
||||
"\n",
|
||||
""
|
||||
""
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"* Users have [highlighted it](https://twitter.com/GregKamradt/status/1679913813297225729?s=20) as one of his top desired AI tools. \n",
|
||||
"* OSS repos like [gpt-researcher](https://github.com/assafelovic/gpt-researcher) are growing in popularity. \n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"## Overview\n",
|
||||
"\n",
|
||||
@@ -443,7 +443,7 @@
|
||||
"source": [
|
||||
"We can compare the headlines scraped to the page:\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Looking at the [LangSmith trace](https://smith.langchain.com/public/c3070198-5b13-419b-87bf-3821cdf34fa6/r), we can see what is going on under the hood:\n",
|
||||
"\n",
|
||||
@@ -463,7 +463,7 @@
|
||||
"\n",
|
||||
"We can automate the process of [web research](https://blog.langchain.dev/automating-web-research/) using a retriever, such as the `WebResearchRetriever` ([docs](https://python.langchain.com/docs/modules/data_connection/retrievers/web_research)).\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"Copy requirements [from here](https://github.com/langchain-ai/web-explorer/blob/main/requirements.txt):\n",
|
||||
"\n",
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
const { ProvidePlugin } = require("webpack");
|
||||
const path = require("path");
|
||||
|
||||
const baseLightCodeBlockTheme = require("prism-react-renderer/themes/vsLight");
|
||||
const baseDarkCodeBlockTheme = require("prism-react-renderer/themes/vsDark");
|
||||
const {themes} = require('prism-react-renderer');
|
||||
const {vsLight: baseLightCodeBlockTheme, vsDark: baseDarkCodeBlockTheme} = themes;
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
@@ -29,6 +29,9 @@ const config = {
|
||||
themes: ["@docusaurus/theme-mermaid"],
|
||||
markdown: {
|
||||
mermaid: true,
|
||||
preprocessor: ({filePath, fileContent}) => {
|
||||
return fileContent.replaceAll(/<([^>@]*@[^@])>/g, '$1').replaceAll(/<([^:>]:\/\/[^>]*)>/g, '$1')
|
||||
}
|
||||
},
|
||||
|
||||
plugins: [
|
||||
@@ -105,7 +108,7 @@ const config = {
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
remarkPlugins: [require("@docusaurus/remark-plugin-npm2yarn")],
|
||||
remarkPlugins: [require("@docusaurus/remark-plugin-npm2yarn"), require('remark-heading-id'), require('remark-inline-links')],
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve("./src/css/custom.css"),
|
||||
|
||||
16336
docs/package-lock.json
generated
16336
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -19,17 +19,21 @@
|
||||
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,mdx}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "2.4.0",
|
||||
"@docusaurus/preset-classic": "2.4.0",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "^2.4.0",
|
||||
"@docusaurus/theme-mermaid": "2.4.0",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"@docusaurus/core": "^3.0.1",
|
||||
"@docusaurus/preset-classic": "^3.0.1",
|
||||
"@docusaurus/remark-plugin-npm2yarn": "^3.0.1",
|
||||
"@docusaurus/theme-mermaid": "^3.0.1",
|
||||
"@mdx-js/react": "^3",
|
||||
"@mendable/search": "^0.0.160",
|
||||
"clsx": "^1.2.1",
|
||||
"json-loader": "^0.5.7",
|
||||
"prism-react-renderer": "^2.1.0",
|
||||
"process": "^0.11.10",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"remark-heading-id": "^1.0.1",
|
||||
"remark-inline-links": "^7.0.0",
|
||||
"typescript": "^5.1.3",
|
||||
"webpack": "^5.75.0"
|
||||
},
|
||||
|
||||
@@ -1,57 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
version_compare() {
|
||||
local v1=(${1//./ })
|
||||
local v2=(${2//./ })
|
||||
for i in {0..2}; do
|
||||
if (( ${v1[i]} < ${v2[i]} )); then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
yum -y update
|
||||
yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip -y
|
||||
amazon-linux-extras install python3.8 -y
|
||||
|
||||
openssl_version=$(openssl version | awk '{print $2}')
|
||||
required_openssl_version="1.1.1"
|
||||
# install quarto
|
||||
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz
|
||||
tar -xzf quarto-1.3.450-linux-amd64.tar.gz
|
||||
export PATH=$PATH:$(pwd)/quarto-1.3.450/bin/
|
||||
|
||||
python_version=$(python3 --version 2>&1 | awk '{print $2}')
|
||||
required_python_version="3.10"
|
||||
|
||||
echo "OpenSSL Version"
|
||||
echo $openssl_version
|
||||
echo "Python Version"
|
||||
echo $python_version
|
||||
# If openssl version is less than 1.1.1 AND python version is less than 3.10
|
||||
if ! version_compare $openssl_version $required_openssl_version && ! version_compare $python_version $required_python_version; then
|
||||
### See: https://github.com/urllib3/urllib3/issues/2168
|
||||
# Requests lib breaks for old SSL versions,
|
||||
# which are defaults on Amazon Linux 2 (which Vercel uses for builds)
|
||||
yum -y update
|
||||
yum remove openssl-devel -y
|
||||
yum install gcc bzip2-devel libffi-devel zlib-devel wget tar -y
|
||||
yum install openssl11 -y
|
||||
yum install openssl11-devel -y
|
||||
|
||||
wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz
|
||||
tar xzf Python-3.11.4.tgz
|
||||
cd Python-3.11.4
|
||||
./configure
|
||||
make altinstall
|
||||
echo "Python Version"
|
||||
python3.11 --version
|
||||
cd ..
|
||||
fi
|
||||
|
||||
python3.11 -m venv .venv
|
||||
python3.8 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
python3.11 -m pip install --upgrade pip
|
||||
python3.11 -m pip install -r vercel_requirements.txt
|
||||
python3.11 scripts/model_feat_table.py
|
||||
python3.8 -m pip install --upgrade pip
|
||||
python3.8 -m pip install -r vercel_requirements.txt
|
||||
python3.8 scripts/model_feat_table.py
|
||||
mkdir docs/templates
|
||||
cp ../templates/docs/INDEX.md docs/templates/index.md
|
||||
python3.11 scripts/copy_templates.py
|
||||
python3.8 scripts/copy_templates.py
|
||||
cp ../cookbook/README.md src/pages/cookbook.mdx
|
||||
cp ../.github/CONTRIBUTING.md docs/contributing.md
|
||||
wget https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md
|
||||
nbdoc_build --srcdir docs --pause 0
|
||||
python3.11 scripts/generate_api_reference_links.py
|
||||
wget -q https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md
|
||||
quarto render docs/
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
-e ../libs/langchain
|
||||
-e ../libs/core
|
||||
nbdoc
|
||||
urllib3==1.26.18
|
||||
|
||||
10390
docs/yarn.lock
Normal file
10390
docs/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,6 @@ toml = "^0.10.2"
|
||||
myst-nb = "^0.17.1"
|
||||
linkchecker = "^10.2.1"
|
||||
sphinx-copybutton = "^0.5.1"
|
||||
nbdoc = "^0.0.82"
|
||||
|
||||
[tool.poetry.group.lint.dependencies]
|
||||
ruff = "^0.1.5"
|
||||
|
||||
Reference in New Issue
Block a user