From 477cc2b5d99291b1feda7ec07be77bf4e545894f Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 15:55:42 -0800 Subject: [PATCH 01/13] nbdoc -> quarto --- docs/.local_build.sh | 2 +- docs/vercel_build.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/.local_build.sh b/docs/.local_build.sh index 203c23eee5cf90..190aaa0fb591da 100755 --- a/docs/.local_build.sh +++ b/docs/.local_build.sh @@ -12,7 +12,7 @@ mkdir -p ../_dist rsync -ruv . ../_dist cd ../_dist poetry run python scripts/model_feat_table.py -poetry run nbdoc_build --srcdir docs --pause 0 +quarto render docs/ cp ../cookbook/README.md src/pages/cookbook.mdx cp ../.github/CONTRIBUTING.md docs/contributing.md mkdir -p docs/templates diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 3793a77123ce1d..28542ea6219340 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -28,7 +28,7 @@ if ! version_compare $openssl_version $required_openssl_version && ! version_com # 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 gcc bzip2-devel libffi-devel zlib-devel wget tar gzip -y yum install openssl11 -y yum install openssl11-devel -y @@ -42,6 +42,12 @@ if ! version_compare $openssl_version $required_openssl_version && ! version_com cd .. fi +# install quarto +wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-arm64.tar.gz +tar -xvzf quarto-1.3.450-linux-arm64.tar.gz +export PATH=$PATH:/quarto-1.3.450/bin/ + + python3.11 -m venv .venv source .venv/bin/activate python3.11 -m pip install --upgrade pip @@ -53,5 +59,5 @@ python3.11 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 +quarto render docs/ python3.11 scripts/generate_api_reference_links.py From ad5c74be0764e315b55330d47236f5fd753ec4c4 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:02:01 -0800 Subject: [PATCH 02/13] debug --- docs/vercel_build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 28542ea6219340..42928f506f0362 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,5 +1,7 @@ #!/bin/bash +pwd + version_compare() { local v1=(${1//./ }) local v2=(${2//./ }) From bdc49608f9deaaf8b1b559bc3e47d097d8e29249 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:04:09 -0800 Subject: [PATCH 03/13] x --- docs/vercel_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 42928f506f0362..4ced5be3645866 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,6 +1,7 @@ #!/bin/bash pwd +exit version_compare() { local v1=(${1//./ }) From 5b9fd4557f7ca3cba45573e211a689cae9fa834d Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:04:59 -0800 Subject: [PATCH 04/13] x --- docs/vercel_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 4ced5be3645866..097bf81240a6d6 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,6 +1,6 @@ #!/bin/bash -pwd +echo $(pwd) exit version_compare() { From 65f4594e7160c6485ad4108d5eb119864620365f Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:06:07 -0800 Subject: [PATCH 05/13] x --- docs/vercel_build.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 097bf81240a6d6..b052bf0d2e88c6 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,8 +1,5 @@ #!/bin/bash -echo $(pwd) -exit - version_compare() { local v1=(${1//./ }) local v2=(${2//./ }) @@ -48,7 +45,7 @@ fi # install quarto wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-arm64.tar.gz tar -xvzf quarto-1.3.450-linux-arm64.tar.gz -export PATH=$PATH:/quarto-1.3.450/bin/ +export PATH=$PATH:$(pwd)/quarto-1.3.450/bin/ python3.11 -m venv .venv From 22d8b7b271b93c9159a7b8cf772fd3059251ef03 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:13:42 -0800 Subject: [PATCH 06/13] x --- docs/vercel_build.sh | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index b052bf0d2e88c6..059afe5a19fadb 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -28,36 +28,27 @@ if ! version_compare $openssl_version $required_openssl_version && ! version_com # 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 gzip -y + yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip python38 -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 # install quarto -wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-arm64.tar.gz -tar -xvzf quarto-1.3.450-linux-arm64.tar.gz +wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz +tar -xvzf quarto-1.3.450-linux-amd64.tar.gz export PATH=$PATH:$(pwd)/quarto-1.3.450/bin/ -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 quarto render docs/ -python3.11 scripts/generate_api_reference_links.py +python3.8 scripts/generate_api_reference_links.py From 807c484a2628c62565af7e597ded4646e9f303f1 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:17:04 -0800 Subject: [PATCH 07/13] remove nbdoc --- docs/vercel_requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/vercel_requirements.txt b/docs/vercel_requirements.txt index 6b44d4069b798a..0dde88068df69a 100644 --- a/docs/vercel_requirements.txt +++ b/docs/vercel_requirements.txt @@ -1,3 +1,2 @@ -e ../libs/langchain -e ../libs/core -nbdoc \ No newline at end of file From cac127923dcad2c0e7e6e9b1f64637f6750e6a0b Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:22:53 -0800 Subject: [PATCH 08/13] x --- docs/vercel_build.sh | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 059afe5a19fadb..ae21d5f1c4867d 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,37 +1,14 @@ #!/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 -} - -openssl_version=$(openssl version | awk '{print $2}') -required_openssl_version="1.1.1" - -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 gzip python38 -y - yum install openssl11 -y - yum install openssl11-devel -y -fi +yum -y update +yum remove openssl-devel -y +yum install gcc bzip2-devel libffi-devel zlib-devel wget tar gzip -y +amazon-linux-extras install python3.8 -y +yum install openssl11 -y +yum install openssl11-devel -y # install quarto wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz From 6ae1fff7ec9a73108fd41825c656586d6d9a1637 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:26:19 -0800 Subject: [PATCH 09/13] quiet output --- docs/vercel_build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index ae21d5f1c4867d..661de721e4446f 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -11,7 +11,7 @@ yum install openssl11 -y yum install openssl11-devel -y # install quarto -wget https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz +wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz tar -xvzf quarto-1.3.450-linux-amd64.tar.gz export PATH=$PATH:$(pwd)/quarto-1.3.450/bin/ @@ -26,6 +26,6 @@ cp ../templates/docs/INDEX.md docs/templates/index.md 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 +wget -q https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md quarto render docs/ python3.8 scripts/generate_api_reference_links.py From 781b5b19337714e0f394c0a470cdcb0eb70c06ab Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:27:33 -0800 Subject: [PATCH 10/13] quieter --- docs/vercel_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 661de721e4446f..0813c8690e62bd 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -12,7 +12,7 @@ yum install openssl11-devel -y # 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 -xvzf 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/ From b449e553087157336e967217d0c40e1d55886cb4 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 16:39:38 -0800 Subject: [PATCH 11/13] py3.8 --- docs/vercel_build.sh | 6 ------ docs/vercel_requirements.txt | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 0813c8690e62bd..3351234cdf40a0 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -1,14 +1,8 @@ #!/bin/bash -### 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 gzip -y amazon-linux-extras install python3.8 -y -yum install openssl11 -y -yum install openssl11-devel -y # install quarto wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v1.3.450/quarto-1.3.450-linux-amd64.tar.gz diff --git a/docs/vercel_requirements.txt b/docs/vercel_requirements.txt index 0dde88068df69a..bffe000f94e354 100644 --- a/docs/vercel_requirements.txt +++ b/docs/vercel_requirements.txt @@ -1,2 +1,3 @@ -e ../libs/langchain -e ../libs/core +urllib3==1.26.18 From 9a4654ab050497f27c4e36a4a55601426fcc2c9e Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 17:14:32 -0800 Subject: [PATCH 12/13] fix image links --- docs/docs/guides/debugging.md | 2 +- docs/docs/guides/local_llms.ipynb | 6 +++--- docs/docs/modules/chains/document/map_reduce.ipynb | 2 +- docs/docs/modules/chains/document/map_rerank.ipynb | 2 +- docs/docs/modules/chains/document/refine.ipynb | 2 +- docs/docs/modules/chains/document/stuff.ipynb | 2 +- docs/docs/use_cases/apis.ipynb | 8 ++++---- docs/docs/use_cases/chatbots.ipynb | 4 ++-- docs/docs/use_cases/extraction.ipynb | 14 ++++++++++---- docs/docs/use_cases/qa_structured/sql.ipynb | 8 ++++---- .../question_answering/code_understanding.ipynb | 4 ++-- docs/docs/use_cases/question_answering/index.ipynb | 4 ++-- docs/docs/use_cases/summarization.ipynb | 6 +++--- docs/docs/use_cases/tagging.ipynb | 4 ++-- docs/docs/use_cases/web_scraping.ipynb | 6 +++--- 15 files changed, 40 insertions(+), 34 deletions(-) diff --git a/docs/docs/guides/debugging.md b/docs/docs/guides/debugging.md index 6fefa9fa5bf265..a0ac5a5e894bf7 100644 --- a/docs/docs/guides/debugging.md +++ b/docs/docs/guides/debugging.md @@ -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` diff --git a/docs/docs/guides/local_llms.ipynb b/docs/docs/guides/local_llms.ipynb index 60e271463d5989..5541d1d608f990 100644 --- a/docs/docs/guides/local_llms.ipynb +++ b/docs/docs/guides/local_llms.ipynb @@ -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", @@ -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", - "![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", @@ -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", - "![Image description](/img/llama_t_put.png)\n", + "![Image description](../../static/img/llama_t_put.png)\n", "\n", "## Quickstart\n", "\n", diff --git a/docs/docs/modules/chains/document/map_reduce.ipynb b/docs/docs/modules/chains/document/map_reduce.ipynb index 2214fa75c4438f..126ce5c8fa8478 100644 --- a/docs/docs/modules/chains/document/map_reduce.ipynb +++ b/docs/docs/modules/chains/document/map_reduce.ipynb @@ -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)" ] }, { diff --git a/docs/docs/modules/chains/document/map_rerank.ipynb b/docs/docs/modules/chains/document/map_rerank.ipynb index 1367b7abeedbfe..dd6445decae5a0 100644 --- a/docs/docs/modules/chains/document/map_rerank.ipynb +++ b/docs/docs/modules/chains/document/map_rerank.ipynb @@ -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)" ] }, { diff --git a/docs/docs/modules/chains/document/refine.ipynb b/docs/docs/modules/chains/document/refine.ipynb index 6869336021036f..d84724def4df35 100644 --- a/docs/docs/modules/chains/document/refine.ipynb +++ b/docs/docs/modules/chains/document/refine.ipynb @@ -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" ] }, { diff --git a/docs/docs/modules/chains/document/stuff.ipynb b/docs/docs/modules/chains/document/stuff.ipynb index e97da5bceb630f..92798440fcbc80 100644 --- a/docs/docs/modules/chains/document/stuff.ipynb +++ b/docs/docs/modules/chains/document/stuff.ipynb @@ -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)" ] }, { diff --git a/docs/docs/use_cases/apis.ipynb b/docs/docs/use_cases/apis.ipynb index 0c8d3cb2394407..a051fc250f73a8 100644 --- a/docs/docs/use_cases/apis.ipynb +++ b/docs/docs/use_cases/apis.ipynb @@ -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)" ] }, { @@ -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)." ] @@ -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)" ] }, { diff --git a/docs/docs/use_cases/chatbots.ipynb b/docs/docs/use_cases/chatbots.ipynb index 68a1ffc6de19c1..711dedd7a44c6c 100644 --- a/docs/docs/use_cases/chatbots.ipynb +++ b/docs/docs/use_cases/chatbots.ipynb @@ -30,7 +30,7 @@ "id": "56615b45", "metadata": {}, "source": [ - "![Image description](/img/chat_use_case.png)" + "![Image description](../../static/img/chat_use_case.png)" ] }, { @@ -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)" ] }, { diff --git a/docs/docs/use_cases/extraction.ipynb b/docs/docs/use_cases/extraction.ipynb index 4b5d580b5d905a..7fdf12694defd6 100644 --- a/docs/docs/use_cases/extraction.ipynb +++ b/docs/docs/use_cases/extraction.ipynb @@ -34,7 +34,7 @@ "id": "178dbc59", "metadata": {}, "source": [ - "![Image description](/img/extraction.png)" + "![Image description](../../static/img/extraction.png)" ] }, { @@ -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", - "![Image description](/img/extraction_trace_function.png)\n", + "![Image description](../../static/img/extraction_trace_function.png)\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", - "![Image description](/img/extraction_trace_function_2.png)\n", + "![Image description](../../static/img/extraction_trace_function_2.png)\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", - "![Image description](/img/extraction_trace_joke.png)\n", + "![Image description](../../static/img/extraction_trace_joke.png)\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": { diff --git a/docs/docs/use_cases/qa_structured/sql.ipynb b/docs/docs/use_cases/qa_structured/sql.ipynb index 32718d4e1a7577..3f5b0981d05046 100644 --- a/docs/docs/use_cases/qa_structured/sql.ipynb +++ b/docs/docs/use_cases/qa_structured/sql.ipynb @@ -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", - "![sql_usecase.png](/img/sql_usecase.png)\n", + "![sql_usecase.png](../../../static/img/sql_usecase.png)\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", - "![sql_usecase.png](/img/create_sql_query_chain.png)\n", + "![sql_usecase.png](../../../static/img/create_sql_query_chain.png)\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", - "![sql_usecase.png](/img/sqldbchain_trace.png)\n", + "![sql_usecase.png](../../../static/img/sqldbchain_trace.png)\n", "\n", "**Improvements**\n", "\n", @@ -661,7 +661,7 @@ "\n", "* It finally executes the generated query using tool `sql_db_query`\n", "\n", - "![sql_usecase.png](/img/SQLDatabaseToolkit.png)" + "![sql_usecase.png](../../../static/img/SQLDatabaseToolkit.png)" ] }, { diff --git a/docs/docs/use_cases/question_answering/code_understanding.ipynb b/docs/docs/use_cases/question_answering/code_understanding.ipynb index 9d1823abafab23..d848db2c9d57ce 100644 --- a/docs/docs/use_cases/question_answering/code_understanding.ipynb +++ b/docs/docs/use_cases/question_answering/code_understanding.ipynb @@ -24,7 +24,7 @@ "- Using LLMs for suggesting refactors or improvements\n", "- Using LLMs for documenting the code\n", "\n", - "![Image description](/img/code_understanding.png)\n", + "![Image description](../../../static/img/code_understanding.png)\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", - "![Image description](/img/code_retrieval.png)" + "![Image description](../../../static/img/code_retrieval.png)" ] }, { diff --git a/docs/docs/use_cases/question_answering/index.ipynb b/docs/docs/use_cases/question_answering/index.ipynb index b1264e11952ad8..8e5fbe2a2c14de 100644 --- a/docs/docs/use_cases/question_answering/index.ipynb +++ b/docs/docs/use_cases/question_answering/index.ipynb @@ -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", - "![index_diagram](/img/rag_indexing.png)\n", + "![index_diagram](../../../static/img/rag_indexing.png)\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", - "![retrieval_diagram](/img/rag_retrieval_generation.png)" + "![retrieval_diagram](../../../static/img/rag_retrieval_generation.png)" ] }, { diff --git a/docs/docs/use_cases/summarization.ipynb b/docs/docs/use_cases/summarization.ipynb index 82a5b16c667bcd..a04c0ba50328f0 100644 --- a/docs/docs/use_cases/summarization.ipynb +++ b/docs/docs/use_cases/summarization.ipynb @@ -32,7 +32,7 @@ "id": "8e233997", "metadata": {}, "source": [ - "![Image description](/img/summarization_use_case_1.png)" + "![Image description](../../static/img/summarization_use_case_1.png)" ] }, { @@ -56,7 +56,7 @@ "id": "08ec66bc", "metadata": {}, "source": [ - "![Image description](/img/summarization_use_case_2.png)" + "![Image description](../../static/img/summarization_use_case_2.png)" ] }, { @@ -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", - "![Image description](/img/summarization_use_case_3.png)" + "![Image description](../../static/img/summarization_use_case_3.png)" ] }, { diff --git a/docs/docs/use_cases/tagging.ipynb b/docs/docs/use_cases/tagging.ipynb index cffa8bebfd32d0..94435ed20e7b6c 100644 --- a/docs/docs/use_cases/tagging.ipynb +++ b/docs/docs/use_cases/tagging.ipynb @@ -28,7 +28,7 @@ "- covered topics\n", "- political tendency\n", "\n", - "![Image description](/img/tagging.png)\n", + "![Image description](../../static/img/tagging.png)\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", - "![Image description](/img/tagging_trace.png)" + "![Image description](../../static/img/tagging_trace.png)" ] }, { diff --git a/docs/docs/use_cases/web_scraping.ipynb b/docs/docs/use_cases/web_scraping.ipynb index 62d64d1b333251..c536e5136f30ca 100644 --- a/docs/docs/use_cases/web_scraping.ipynb +++ b/docs/docs/use_cases/web_scraping.ipynb @@ -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", - "![Image description](/img/web_scraping.png)\n", + "![Image description](../../static/img/web_scraping.png)\n", " \n", "## Overview\n", "\n", @@ -443,7 +443,7 @@ "source": [ "We can compare the headlines scraped to the page:\n", "\n", - "![Image description](/img/wsj_page.png)\n", + "![Image description](../../static/img/wsj_page.png)\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", - "![Image description](/img/web_research.png)\n", + "![Image description](../../static/img/web_research.png)\n", "\n", "Copy requirements [from here](https://github.com/langchain-ai/web-explorer/blob/main/requirements.txt):\n", "\n", From fa468334a29e4dff442abb4ee53fcfa72389c3b4 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 1 Dec 2023 17:43:12 -0800 Subject: [PATCH 13/13] fix local build --- docs/.local_build.sh | 8 ++++---- docs/vercel_build.sh | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/.local_build.sh b/docs/.local_build.sh index 190aaa0fb591da..0c67d35024a702 100755 --- a/docs/.local_build.sh +++ b/docs/.local_build.sh @@ -12,12 +12,12 @@ mkdir -p ../_dist rsync -ruv . ../_dist cd ../_dist poetry run python scripts/model_feat_table.py -quarto render docs/ 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 diff --git a/docs/vercel_build.sh b/docs/vercel_build.sh index 3351234cdf40a0..145a7e9acbc625 100755 --- a/docs/vercel_build.sh +++ b/docs/vercel_build.sh @@ -22,4 +22,3 @@ cp ../cookbook/README.md src/pages/cookbook.mdx cp ../.github/CONTRIBUTING.md docs/contributing.md wget -q https://raw.githubusercontent.com/langchain-ai/langserve/main/README.md -O docs/langserve.md quarto render docs/ -python3.8 scripts/generate_api_reference_links.py