Skip to content

Commit

Permalink
nbdoc -> quarto (#14156)
Browse files Browse the repository at this point in the history
Switches to a more maintained solution for building ipynb -> md files
(`quarto`)

Also bumps us down to python3.8 because it's significantly faster in the
vercel build step. Uses default openssl version instead of upgrading as
well.
  • Loading branch information
efriis committed Dec 4, 2023
1 parent eecfa3f commit f6d68d7
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 110 deletions.
10 changes: 4 additions & 6 deletions docs/.local_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ mkdir -p ../_dist
rsync -ruv . ../_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
47 changes: 25 additions & 22 deletions docs/docs/expression_language/why.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
"title: Why use LCEL\n",
"---\n",
"\n",
"import { ColumnContainer, Column } from '@theme/Columns';"
"{ import { ColumnContainer, Column } from \"@theme/Columns\"; }"
]
},
{
"cell_type": "markdown",
"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",
":::"
]
},
Expand Down Expand Up @@ -62,11 +63,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%\">"
]
},
{
Expand All @@ -76,6 +78,7 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from typing import List\n",
"\n",
"import openai\n",
Expand Down Expand Up @@ -111,7 +114,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -156,7 +159,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -201,7 +204,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -233,7 +236,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -265,7 +268,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -296,7 +299,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -337,7 +340,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>\n",
"<div style=\"zoom:80%\">\n",
"\n",
"```python\n",
"chain.ainvoke(\"ice cream\")\n",
Expand All @@ -362,7 +365,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -398,7 +401,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -439,7 +442,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -481,7 +484,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -522,7 +525,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -607,7 +610,7 @@
"\n",
"#### With LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -677,7 +680,7 @@
"\n",
"We'll `print` intermediate steps for illustrative purposes\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -711,7 +714,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%\">"
]
},
{
Expand Down Expand Up @@ -757,7 +760,7 @@
"#### Without LCEL\n",
"\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -804,7 +807,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -845,7 +848,7 @@
"\n",
"#### Without LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down Expand Up @@ -1029,7 +1032,7 @@
"\n",
"#### LCEL\n",
"\n",
"<div style={{ zoom: \"80%\" }}>"
"<div style=\"zoom:80%\">"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

![LangSmith run](/img/run_details.png)
![LangSmith run](../../static/img/run_details.png)

## `set_debug` and `set_verbose`

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/local_llms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![Image description](/img/OSS_LLM_overview.png)\n",
"![Image description](../../static/img/OSS_LLM_overview.png)\n",
"\n",
"The relative performance of these models can be assessed using several leaderboards, including:\n",
"\n",
Expand All @@ -55,15 +55,15 @@
"\n",
"In particular, see [this excellent post](https://finbarr.ca/how-is-llama-cpp-possible/) on the importance of quantization.\n",
"\n",
"![Image description](/img/llama-memory-weights.png)\n",
"![Image description](../../static/img/llama-memory-weights.png)\n",
"\n",
"With less precision, we radically decrease the memory needed to store the LLM in memory.\n",
"\n",
"In addition, we can see the importance of GPU memory bandwidth [sheet](https://docs.google.com/spreadsheets/d/1OehfHHNSn66BP2h3Bxp2NJTVX97icU0GmCXF6pK23H8/edit#gid=0)!\n",
"\n",
"A Mac M2 Max is 5-6x faster than a M1 for inference due to the larger GPU memory bandwidth.\n",
"\n",
"![Image description](/img/llama_t_put.png)\n",
"![Image description](../../static/img/llama_t_put.png)\n",
"\n",
"## Quickstart\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/modules/chains/document/map_reduce.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![map_reduce_diagram](/img/map_reduce.jpg)"
"![map_reduce_diagram](../../../../static/img/map_reduce.jpg)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/modules/chains/document/map_rerank.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![map_rerank_diagram](/img/map_rerank.jpg)"
"![map_rerank_diagram](../../../../static/img/map_rerank.jpg)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/modules/chains/document/refine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![refine_diagram](/img/refine.jpg)\n"
"![refine_diagram](../../../../static/img/refine.jpg)\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/modules/chains/document/stuff.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![stuff_diagram](/img/stuff.jpg)"
"![stuff_diagram](../../../../static/img/stuff.jpg)"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/use_cases/apis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"![Image description](/img/api_use_case.png)"
"![Image description](../../static/img/api_use_case.png)"
]
},
{
Expand Down Expand Up @@ -188,7 +188,7 @@
" }\n",
" ```\n",
" \n",
"![Image description](/img/api_function_call.png)\n",
"![Image description](../../static/img/api_function_call.png)\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)."
]
Expand Down Expand Up @@ -293,12 +293,12 @@
"\n",
"* The `api_request_chain` produces the API url from our question and the API documentation:\n",
"\n",
"![Image description](/img/api_chain.png)\n",
"![Image description](../../static/img/api_chain.png)\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",
"![Image description](/img/api_chain_response.png)"
"![Image description](../../static/img/api_chain_response.png)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/use_cases/chatbots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"id": "56615b45",
"metadata": {},
"source": [
"![Image description](/img/chat_use_case.png)"
"![Image description](../../static/img/chat_use_case.png)"
]
},
{
Expand Down Expand Up @@ -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",
"![Image description](/img/chat_use_case_2.png)"
"![Image description](../../static/img/chat_use_case_2.png)"
]
},
{
Expand Down
Loading

0 comments on commit f6d68d7

Please sign in to comment.