Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: langchain-ai/langchainjs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9cb74a121440edd69ccc4cc5adae6608edf76773
Choose a base ref
...
head repository: langchain-ai/langchainjs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d727338816f2b3c6da01f8816da76da3792ca950
Choose a head ref

Commits on Dec 31, 2024

  1. release(core): 0.3.27 (#7455)

    jacoblee93 authored Dec 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2577ec0 View commit details
  2. release(google): 0.1.6 (#7456)

    jacoblee93 authored Dec 31, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7f729c9 View commit details

Commits on Jan 2, 2025

  1. feat(cerebras): Adds Cerebras chat model integration (#7457)

    jacoblee93 authored Jan 2, 2025

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5dde37f View commit details
  2. release(cerebras): 0.0.1 (#7459)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    461f791 View commit details
  3. Release 0.3.9 (#7460)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    4d82ce9 View commit details
  4. fix(create-langchain-integration): Update integration template (#7458)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    f7846d5 View commit details
  5. release(create-langchain-integration): 0.0.12 (#7461)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    12fdf3f View commit details
  6. docs: Fix API ref link (#7462)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    769cc4e View commit details
  7. docs: Update provider docs page (#7463)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    074681c View commit details
  8. fix(community): Relax community deps (#7464)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    d0fb84f View commit details
  9. feat(community): add mmr search to pgvector (#7438)

    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    anadi45 and jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    c132cf9 View commit details
  10. feat(community): Add VercelKVcache (#7447)

    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    Zamoca42 and jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    fc14443 View commit details
  11. fix(community, docs): Update PGVector instructions, fix test (#7465)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    0916a30 View commit details
  12. release(community): 0.3.22 (#7466)

    jacoblee93 authored Jan 2, 2025
    Copy the full SHA
    81e50a8 View commit details

Commits on Jan 7, 2025

  1. feat: Add google-vertexai-web to initChatModel (#7473)

    bracesproul authored Jan 7, 2025
    Copy the full SHA
    8bddcc2 View commit details
  2. Release 0.3.10 (#7474)

    bracesproul authored Jan 7, 2025
    Copy the full SHA
    2cae4e9 View commit details
  3. fix: Add test for running google web initChatModel (#7475)

    bracesproul authored Jan 7, 2025
    Copy the full SHA
    2b43011 View commit details

Commits on Jan 9, 2025

  1. fix(groq): Fix Max Retries for Groq (#7481)

    weakit authored Jan 9, 2025
    Copy the full SHA
    67e00e0 View commit details
  2. fix(community): togetherai response different format handling (#7488)

    Co-authored-by: An Xie <an.xie@upfeat.com>
    axe-me and an-upfeat authored Jan 9, 2025
    Copy the full SHA
    a30c2fa View commit details
  3. groq: populate more params and user agent (#7489)

    Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
    efriis and jacoblee93 authored Jan 9, 2025
    Copy the full SHA
    06b45d1 View commit details
  4. docs: Add docs for Upstash Vector built-in embeddings support (#7485)

    Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
    ytkimirti and jacoblee93 authored Jan 9, 2025
    Copy the full SHA
    60335e0 View commit details
  5. docs(community): remove docs for Watsonx IBM deprecated implementation (

    #7306)
    
    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    FilipZmijewski and jacoblee93 authored Jan 9, 2025
    Copy the full SHA
    bd89717 View commit details
  6. Copy the full SHA
    a471516 View commit details
  7. fix(community): update YoutubeLoader implementation (#7477)

    Co-authored-by: jacoblee93 <jacoblee93@gmail.com>
    sinedied and jacoblee93 authored Jan 9, 2025
    Copy the full SHA
    d92af44 View commit details
  8. Copy the full SHA
    3884417 View commit details

Commits on Jan 10, 2025

  1. Copy the full SHA
    8bb980e View commit details
  2. Copy the full SHA
    d727338 View commit details
Showing with 3,202 additions and 459 deletions.
  1. +2 βˆ’2 cookbook/basic_critique_revise.ipynb
  2. +1 βˆ’2 deno.json
  3. +2 βˆ’2 docs/core_docs/docs/how_to/agent_executor.ipynb
  4. +58 βˆ’0 docs/core_docs/docs/how_to/chat_model_caching.mdx
  5. +2 βˆ’2 docs/core_docs/docs/how_to/debugging.mdx
  6. +1 βˆ’1 docs/core_docs/docs/how_to/graph_constructing.ipynb
  7. +1 βˆ’1 docs/core_docs/docs/how_to/graph_mapping.ipynb
  8. +1 βˆ’1 docs/core_docs/docs/how_to/graph_prompting.ipynb
  9. +1 βˆ’1 docs/core_docs/docs/how_to/graph_semantic.ipynb
  10. +16 βˆ’0 docs/core_docs/docs/how_to/llm_caching.mdx
  11. +4 βˆ’4 docs/core_docs/docs/how_to/migrate_agent.ipynb
  12. +2 βˆ’2 docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb
  13. +2 βˆ’2 docs/core_docs/docs/how_to/qa_citations.ipynb
  14. +1 βˆ’1 docs/core_docs/docs/how_to/qa_per_user.ipynb
  15. +2 βˆ’2 docs/core_docs/docs/how_to/qa_sources.ipynb
  16. +2 βˆ’2 docs/core_docs/docs/how_to/qa_streaming.ipynb
  17. +1 βˆ’1 docs/core_docs/docs/how_to/query_few_shot.ipynb
  18. +1 βˆ’1 docs/core_docs/docs/how_to/query_high_cardinality.ipynb
  19. +1 βˆ’1 docs/core_docs/docs/how_to/query_multiple_queries.ipynb
  20. +1 βˆ’1 docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb
  21. +1 βˆ’1 docs/core_docs/docs/how_to/query_no_queries.ipynb
  22. +2 βˆ’2 docs/core_docs/docs/how_to/sql_large_db.mdx
  23. +2 βˆ’2 docs/core_docs/docs/how_to/sql_prompting.mdx
  24. +2 βˆ’2 docs/core_docs/docs/how_to/sql_query_checking.mdx
  25. +1 βˆ’1 docs/core_docs/docs/how_to/tools_prompting.ipynb
  26. +2 βˆ’2 docs/core_docs/docs/integrations/chat/anthropic.ipynb
  27. +2 βˆ’2 docs/core_docs/docs/integrations/chat/azure.ipynb
  28. +2 βˆ’2 docs/core_docs/docs/integrations/chat/bedrock.ipynb
  29. +2 βˆ’2 docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb
  30. +339 βˆ’0 docs/core_docs/docs/integrations/chat/cerebras.ipynb
  31. +2 βˆ’2 docs/core_docs/docs/integrations/chat/cohere.ipynb
  32. +2 βˆ’2 docs/core_docs/docs/integrations/chat/fireworks.ipynb
  33. +2 βˆ’2 docs/core_docs/docs/integrations/chat/google_generativeai.ipynb
  34. +2 βˆ’2 docs/core_docs/docs/integrations/chat/google_vertex_ai.ipynb
  35. +2 βˆ’2 docs/core_docs/docs/integrations/chat/groq.ipynb
  36. +2 βˆ’2 docs/core_docs/docs/integrations/chat/ibm.ipynb
  37. +2 βˆ’2 docs/core_docs/docs/integrations/chat/mistral.ipynb
  38. +2 βˆ’2 docs/core_docs/docs/integrations/chat/ollama.ipynb
  39. +2 βˆ’2 docs/core_docs/docs/integrations/chat/openai.ipynb
  40. +2 βˆ’2 docs/core_docs/docs/integrations/chat/togetherai.ipynb
  41. +2 βˆ’2 docs/core_docs/docs/integrations/chat/xai.ipynb
  42. +8 βˆ’8 docs/core_docs/docs/integrations/document_compressors/ibm.ipynb
  43. +2 βˆ’2 docs/core_docs/docs/integrations/document_loaders/web_loaders/firecrawl.ipynb
  44. +2 βˆ’2 docs/core_docs/docs/integrations/document_loaders/web_loaders/pdf.ipynb
  45. +2 βˆ’2 docs/core_docs/docs/integrations/document_loaders/web_loaders/recursive_url_loader.ipynb
  46. +2 βˆ’2 docs/core_docs/docs/integrations/document_loaders/web_loaders/web_cheerio.ipynb
  47. +2 βˆ’2 docs/core_docs/docs/integrations/document_loaders/web_loaders/web_puppeteer.ipynb
  48. +3 βˆ’4 docs/core_docs/docs/integrations/document_loaders/web_loaders/youtube.mdx
  49. +2 βˆ’2 docs/core_docs/docs/integrations/llms/azure.ipynb
  50. +2 βˆ’2 docs/core_docs/docs/integrations/llms/bedrock.ipynb
  51. +2 βˆ’2 docs/core_docs/docs/integrations/llms/cohere.ipynb
  52. +2 βˆ’2 docs/core_docs/docs/integrations/llms/fireworks.ipynb
  53. +2 βˆ’2 docs/core_docs/docs/integrations/llms/google_vertex_ai.ipynb
  54. +2 βˆ’2 docs/core_docs/docs/integrations/llms/ibm.ipynb
  55. +2 βˆ’2 docs/core_docs/docs/integrations/llms/mistral.ipynb
  56. +2 βˆ’2 docs/core_docs/docs/integrations/llms/ollama.ipynb
  57. +2 βˆ’2 docs/core_docs/docs/integrations/llms/openai.ipynb
  58. +2 βˆ’2 docs/core_docs/docs/integrations/llms/together.ipynb
  59. +0 βˆ’40 docs/core_docs/docs/integrations/llms/watsonx_ai.mdx
  60. +4 βˆ’1 docs/core_docs/docs/integrations/platforms/index.mdx
  61. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/azure_openai.ipynb
  62. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/bedrock.ipynb
  63. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/cloudflare_ai.ipynb
  64. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/cohere.ipynb
  65. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/fireworks.ipynb
  66. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/google_generativeai.ipynb
  67. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/google_vertex_ai.ipynb
  68. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/ibm.ipynb
  69. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/mistralai.ipynb
  70. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/ollama.ipynb
  71. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/openai.ipynb
  72. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/pinecone.ipynb
  73. +2 βˆ’2 docs/core_docs/docs/integrations/text_embedding/togetherai.ipynb
  74. +2 βˆ’2 docs/core_docs/docs/integrations/toolkits/openapi.ipynb
  75. +2 βˆ’2 docs/core_docs/docs/integrations/toolkits/sql.ipynb
  76. +2 βˆ’2 docs/core_docs/docs/integrations/toolkits/vectorstore.ipynb
  77. +2 βˆ’2 docs/core_docs/docs/integrations/tools/duckduckgo_search.ipynb
  78. +2 βˆ’2 docs/core_docs/docs/integrations/tools/exa_search.ipynb
  79. +2 βˆ’2 docs/core_docs/docs/integrations/tools/google_scholar.ipynb
  80. +2 βˆ’2 docs/core_docs/docs/integrations/tools/serpapi.ipynb
  81. +2 βˆ’2 docs/core_docs/docs/integrations/tools/tavily_search.ipynb
  82. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/chroma.ipynb
  83. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/elasticsearch.ipynb
  84. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/faiss.ipynb
  85. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/hnswlib.ipynb
  86. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/memory.ipynb
  87. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/mongodb_atlas.ipynb
  88. +5 βˆ’8 docs/core_docs/docs/integrations/vectorstores/pgvector.ipynb
  89. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/pinecone.ipynb
  90. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/qdrant.ipynb
  91. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/redis.ipynb
  92. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/supabase.ipynb
  93. +43 βˆ’3 docs/core_docs/docs/integrations/vectorstores/upstash.ipynb
  94. +2 βˆ’2 docs/core_docs/docs/integrations/vectorstores/weaviate.ipynb
  95. +2 βˆ’2 docs/core_docs/docs/tutorials/chatbot.ipynb
  96. +2 βˆ’2 docs/core_docs/docs/tutorials/extraction.ipynb
  97. +1 βˆ’1 docs/core_docs/docs/tutorials/graph.ipynb
  98. +2 βˆ’2 docs/core_docs/docs/tutorials/llm_chain.ipynb
  99. +2 βˆ’2 docs/core_docs/docs/tutorials/qa_chat_history.ipynb
  100. +2 βˆ’2 docs/core_docs/docs/tutorials/rag.ipynb
  101. +2 βˆ’2 docs/core_docs/docs/tutorials/retrievers.ipynb
  102. +2 βˆ’2 docs/core_docs/docs/tutorials/sql_qa.ipynb
  103. +2 βˆ’2 docs/core_docs/docs/tutorials/summarization.ipynb
  104. +4 βˆ’0 docs/core_docs/vercel.json
  105. +1 βˆ’1 examples/package.json
  106. +17 βˆ’0 examples/src/cache/chat_models/vercel_kv.ts
  107. +14 βˆ’0 examples/src/cache/vercel_kv.ts
  108. +0 βˆ’18 examples/src/llms/watsonx_ai.ts
  109. +1 βˆ’1 langchain-core/package.json
  110. +14 βˆ’1 langchain-core/src/prompts/base.ts
  111. +11 βˆ’1 langchain/package.json
  112. +13 βˆ’0 langchain/src/chat_models/tests/universal.int.test.ts
  113. +12 βˆ’0 langchain/src/chat_models/universal.ts
  114. +17 βˆ’2 langchain/src/hub.ts
  115. +4 βˆ’4 langchain/src/tests/hub.int.test.ts
  116. +2 βˆ’2 libs/create-langchain-integration/package.json
  117. +2 βˆ’0 libs/create-langchain-integration/template/.env.example
  118. +12 βˆ’6 libs/create-langchain-integration/template/package.json
  119. +26 βˆ’4 libs/create-langchain-integration/template/src/chat_models.ts
  120. +74 βˆ’0 libs/langchain-cerebras/.eslintrc.cjs
  121. +7 βˆ’0 libs/langchain-cerebras/.gitignore
  122. +19 βˆ’0 libs/langchain-cerebras/.prettierrc
  123. +10 βˆ’0 libs/langchain-cerebras/.release-it.json
  124. +21 βˆ’0 libs/langchain-cerebras/LICENSE
  125. +76 βˆ’0 libs/langchain-cerebras/README.md
  126. +21 βˆ’0 libs/langchain-cerebras/jest.config.cjs
  127. +12 βˆ’0 libs/langchain-cerebras/jest.env.cjs
  128. +22 βˆ’0 libs/langchain-cerebras/langchain.config.js
  129. +92 βˆ’0 libs/langchain-cerebras/package.json
  130. +9 βˆ’0 libs/langchain-cerebras/scripts/jest-setup-after-env.js
  131. +826 βˆ’0 libs/langchain-cerebras/src/chat_models.ts
  132. +1 βˆ’0 libs/langchain-cerebras/src/index.ts
  133. +284 βˆ’0 libs/langchain-cerebras/src/tests/chat_models.int.test.ts
  134. +39 βˆ’0 libs/langchain-cerebras/src/tests/chat_models.standard.int.test.ts
  135. +44 βˆ’0 libs/langchain-cerebras/src/tests/chat_models.standard.test.ts
  136. +226 βˆ’0 libs/langchain-cerebras/src/utils.ts
  137. +8 βˆ’0 libs/langchain-cerebras/tsconfig.cjs.json
  138. +23 βˆ’0 libs/langchain-cerebras/tsconfig.json
  139. +11 βˆ’0 libs/langchain-cerebras/turbo.json
  140. +4 βˆ’0 libs/langchain-community/.gitignore
  141. +4 βˆ’0 libs/langchain-community/langchain.config.js
  142. +20 βˆ’12 libs/langchain-community/package.json
  143. +34 βˆ’0 libs/langchain-community/src/caches/tests/vercel_kv.int.test.ts
  144. +87 βˆ’0 libs/langchain-community/src/caches/vercel_kv.ts
  145. +21 βˆ’0 libs/langchain-community/src/document_loaders/tests/youtube.int.test.ts
  146. +17 βˆ’14 libs/langchain-community/src/document_loaders/web/youtube.ts
  147. +11 βˆ’3 libs/langchain-community/src/llms/togetherai.ts
  148. +1 βˆ’0 libs/langchain-community/src/load/import_map.ts
  149. +2 βˆ’1 libs/langchain-community/src/storage/vercel_kv.ts
  150. +76 βˆ’7 libs/langchain-community/src/vectorstores/pgvector.ts
  151. +2 βˆ’5 libs/langchain-community/src/vectorstores/tests/pgvector/docker-compose.yml
  152. +95 βˆ’14 libs/langchain-community/src/vectorstores/tests/pgvector/pgvector.int.test.ts
  153. +1 βˆ’1 libs/langchain-google-common/package.json
  154. +2 βˆ’2 libs/langchain-google-gauth/package.json
  155. +2 βˆ’2 libs/langchain-google-vertexai-web/package.json
  156. +2 βˆ’2 libs/langchain-google-vertexai/package.json
  157. +2 βˆ’2 libs/langchain-google-webauth/package.json
  158. +1 βˆ’1 libs/langchain-groq/package.json
  159. +39 βˆ’0 libs/langchain-groq/src/chat_models.ts
  160. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/chat.ipynb
  161. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/llms.ipynb
  162. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/text_embedding.ipynb
  163. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/toolkits.ipynb
  164. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/tools.ipynb
  165. +2 βˆ’2 libs/langchain-scripts/src/cli/docs/templates/vectorstores.ipynb
  166. +139 βˆ’99 yarn.lock
4 changes: 2 additions & 2 deletions cookbook/basic_critique_revise.ipynb
Original file line number Diff line number Diff line change
@@ -20,8 +20,8 @@
"outputs": [],
"source": [
"Deno.env.set(\"OPENAI_API_KEY\", \"\");\n",
"Deno.env.set(\"LANGCHAIN_API_KEY\", \"\");\n",
"Deno.env.set(\"LANGCHAIN_TRACING_V2\", \"true\");\n",
"Deno.env.set(\"LANGSMITH_API_KEY\", \"\");\n",
"Deno.env.set(\"LANGSMITH_TRACING\", \"true\");\n",
"\n",
"import { z } from \"npm:zod\";\n",
"\n",
3 changes: 1 addition & 2 deletions deno.json
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@
"readline": "https://deno.land/x/readline@v1.1.0/mod.ts",
"uuid": "npm:/uuid",
"youtubei.js": "npm:/youtubei.js",
"youtube-transcript": "npm:/youtube-transcript",
"neo4j-driver": "npm:/neo4j-driver",
"axios": "npm:/axios",
"@mendable/firecrawl-js": "npm:/@mendable/firecrawl-js",
@@ -40,4 +39,4 @@
"@smithy/util-utf8": "npm:/@smithy/util-utf8",
"@aws-sdk/types": "npm:/@aws-sdk/types"
}
}
}
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/agent_executor.ipynb
Original file line number Diff line number Diff line change
@@ -65,8 +65,8 @@
"After you sign up at the link above, make sure to set your environment variables to start logging traces:\n",
"\n",
"```shell\n",
"export LANGCHAIN_TRACING_V2=\"true\"\n",
"export LANGCHAIN_API_KEY=\"...\"\n",
"export LANGSMITH_TRACING=\"true\"\n",
"export LANGSMITH_API_KEY=\"...\"\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
58 changes: 58 additions & 0 deletions docs/core_docs/docs/how_to/chat_model_caching.mdx
Original file line number Diff line number Diff line change
@@ -98,6 +98,64 @@ import RedisCacheExample from "@examples/cache/chat_models/redis.ts";

<CodeBlock language="typescript">{RedisCacheExample}</CodeBlock>

## Caching with Upstash Redis

LangChain provides an Upstash Redis-based cache. Like the Redis-based cache, this cache is useful if you want to share the cache across multiple processes or servers. The Upstash Redis client uses HTTP and supports edge environments. To use it, you'll need to install the `@upstash/redis` package:

```bash npm2yarn
npm install @upstash/redis
```

You'll also need an [Upstash account](https://docs.upstash.com/redis#create-account) and a [Redis database](https://docs.upstash.com/redis#create-a-database) to connect to. Once you've done that, retrieve your REST URL and REST token.

Then, you can pass a `cache` option when you instantiate the LLM. For example:

import UpstashRedisCacheExample from "@examples/cache/chat_models/upstash_redis.ts";

<CodeBlock language="typescript">{UpstashRedisCacheExample}</CodeBlock>

You can also directly pass in a previously created [@upstash/redis](https://docs.upstash.com/redis/sdks/javascriptsdk/overview) client instance:

import AdvancedUpstashRedisCacheExample from "@examples/cache/chat_models/upstash_redis_advanced.ts";

<CodeBlock language="typescript">{AdvancedUpstashRedisCacheExample}</CodeBlock>

## Caching with Vercel KV

LangChain provides an Vercel KV-based cache. Like the Redis-based cache, this cache is useful if you want to share the cache across multiple processes or servers. The Vercel KV client uses HTTP and supports edge environments. To use it, you'll need to install the `@vercel/kv` package:

```bash npm2yarn
npm install @vercel/kv
```

You'll also need an Vercel account and a [KV database](https://vercel.com/docs/storage/vercel-kv/kv-reference) to connect to. Once you've done that, retrieve your REST URL and REST token.

Then, you can pass a `cache` option when you instantiate the LLM. For example:

import VercelKVCacheExample from "@examples/cache/chat_models/vercel_kv.ts";

<CodeBlock language="typescript">{VercelKVCacheExample}</CodeBlock>

## Caching with Cloudflare KV

:::info
This integration is only supported in Cloudflare Workers.
:::

If you're deploying your project as a Cloudflare Worker, you can use LangChain's Cloudflare KV-powered LLM cache.

For information on how to set up KV in Cloudflare, see [the official documentation](https://developers.cloudflare.com/kv/).

**Note:** If you are using TypeScript, you may need to install types if they aren't already present:

```bash npm2yarn
npm install -S @cloudflare/workers-types
```

import CloudflareExample from "@examples/cache/chat_models/cloudflare_kv.ts";

<CodeBlock language="typescript">{CloudflareExample}</CodeBlock>

## Caching on the File System

:::warning
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/debugging.mdx
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@ The best way to do this is with [LangSmith](https://smith.langchain.com).
After you sign up at the link above, make sure to set your environment variables to start logging traces:

```shell
export LANGCHAIN_TRACING_V2="true"
export LANGCHAIN_API_KEY="..."
export LANGSMITH_TRACING="true"
export LANGSMITH_API_KEY="..."

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/graph_constructing.ipynb
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/graph_mapping.ipynb
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/graph_prompting.ipynb
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/graph_semantic.ipynb
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
16 changes: 16 additions & 0 deletions docs/core_docs/docs/how_to/llm_caching.mdx
Original file line number Diff line number Diff line change
@@ -161,6 +161,22 @@ import AdvancedUpstashRedisCacheExample from "@examples/cache/upstash_redis_adva

<CodeBlock language="typescript">{AdvancedUpstashRedisCacheExample}</CodeBlock>

## Caching with Vercel KV

LangChain provides an Vercel KV-based cache. Like the Redis-based cache, this cache is useful if you want to share the cache across multiple processes or servers. The Vercel KV client uses HTTP and supports edge environments. To use it, you'll need to install the `@vercel/kv` package:

```bash npm2yarn
npm install @vercel/kv
```

You'll also need an Vercel account and a [KV database](https://vercel.com/docs/storage/vercel-kv/kv-reference) to connect to. Once you've done that, retrieve your REST URL and REST token.

Then, you can pass a `cache` option when you instantiate the LLM. For example:

import VercelKVCacheExample from "@examples/cache/vercel_kv.ts";

<CodeBlock language="typescript">{VercelKVCacheExample}</CodeBlock>

## Caching with Cloudflare KV

:::info
8 changes: 4 additions & 4 deletions docs/core_docs/docs/how_to/migrate_agent.ipynb
Original file line number Diff line number Diff line change
@@ -57,10 +57,10 @@
"// process.env.OPENAI_API_KEY = \"...\";\n",
"\n",
"// Optional, add tracing in LangSmith\n",
"// process.env.LANGCHAIN_API_KEY = \"ls...\";\n",
"// process.env.LANGSMITH_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\";\n",
"// process.env.LANGSMITH_TRACING = \"true\";\n",
"// process.env.LANGSMITH_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\";"
@@ -1337,4 +1337,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/qa_chat_history_how_to.ipynb
Original file line number Diff line number Diff line change
@@ -63,8 +63,8 @@
"\n",
"\n",
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"export LANGSMITH_TRACING=true\n",
"export LANGSMITH_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/qa_citations.ipynb
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@
"\n",
"\n",
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"export LANGSMITH_TRACING=true\n",
"export LANGSMITH_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/qa_per_user.ipynb
Original file line number Diff line number Diff line change
@@ -88,7 +88,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/qa_sources.ipynb
Original file line number Diff line number Diff line change
@@ -53,8 +53,8 @@
"\n",
"\n",
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"export LANGSMITH_TRACING=true\n",
"export LANGSMITH_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/qa_streaming.ipynb
Original file line number Diff line number Diff line change
@@ -53,8 +53,8 @@
"\n",
"\n",
"```bash\n",
"export LANGCHAIN_TRACING_V2=true\n",
"export LANGCHAIN_API_KEY=YOUR_KEY\n",
"export LANGSMITH_TRACING=true\n",
"export LANGSMITH_API_KEY=YOUR_KEY\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# export LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/query_few_shot.ipynb
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
"```\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/query_high_cardinality.ipynb
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@
"```\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/query_multiple_queries.ipynb
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/query_multiple_retrievers.ipynb
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/query_no_queries.ipynb
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@
"\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/sql_large_db.mdx
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ npm install langchain @langchain/community @langchain/openai typeorm sqlite3
```bash
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
# export LANGSMITH_API_KEY="your api key"
# export LANGSMITH_TRACING=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/sql_prompting.mdx
Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ npm install @langchain/community @langchain/openai typeorm sqlite3
```bash
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
# export LANGSMITH_API_KEY="your api key"
# export LANGSMITH_TRACING=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
4 changes: 2 additions & 2 deletions docs/core_docs/docs/how_to/sql_query_checking.mdx
Original file line number Diff line number Diff line change
@@ -26,8 +26,8 @@ npm install @langchain/community @langchain/openai typeorm sqlite3
```bash
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
# export LANGSMITH_API_KEY="your api key"
# export LANGSMITH_TRACING=true

# Reduce tracing latency if you are not in a serverless environment
# export LANGCHAIN_CALLBACKS_BACKGROUND=true
2 changes: 1 addition & 1 deletion docs/core_docs/docs/how_to/tools_prompting.ipynb
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
"```\n",
"# Optional, use LangSmith for best-in-class observability\n",
"LANGSMITH_API_KEY=your-api-key\n",
"LANGCHAIN_TRACING_V2=true\n",
"LANGSMITH_TRACING=true\n",
"\n",
"# Reduce tracing latency if you are not in a serverless environment\n",
"# LANGCHAIN_CALLBACKS_BACKGROUND=true\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/integrations/chat/anthropic.ipynb
Original file line number Diff line number Diff line change
@@ -55,8 +55,8 @@
"If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n",
"\n",
"```bash\n",
"# export LANGCHAIN_TRACING_V2=\"true\"\n",
"# export LANGCHAIN_API_KEY=\"your-api-key\"\n",
"# export LANGSMITH_TRACING=\"true\"\n",
"# export LANGSMITH_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"### Installation\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/integrations/chat/azure.ipynb
Original file line number Diff line number Diff line change
@@ -66,8 +66,8 @@
"If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n",
"\n",
"```bash\n",
"# export LANGCHAIN_TRACING_V2=\"true\"\n",
"# export LANGCHAIN_API_KEY=\"your-api-key\"\n",
"# export LANGSMITH_TRACING=\"true\"\n",
"# export LANGSMITH_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"### Installation\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/integrations/chat/bedrock.ipynb
Original file line number Diff line number Diff line change
@@ -57,8 +57,8 @@
"If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n",
"\n",
"```bash\n",
"# export LANGCHAIN_TRACING_V2=\"true\"\n",
"# export LANGCHAIN_API_KEY=\"your-api-key\"\n",
"# export LANGSMITH_TRACING=\"true\"\n",
"# export LANGSMITH_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"### Installation\n",
4 changes: 2 additions & 2 deletions docs/core_docs/docs/integrations/chat/bedrock_converse.ipynb
Original file line number Diff line number Diff line change
@@ -51,8 +51,8 @@
"If you want to get automated tracing of your model calls you can also set your [LangSmith](https://docs.smith.langchain.com/) API key by uncommenting below:\n",
"\n",
"```bash\n",
"# export LANGCHAIN_TRACING_V2=\"true\"\n",
"# export LANGCHAIN_API_KEY=\"your-api-key\"\n",
"# export LANGSMITH_TRACING=\"true\"\n",
"# export LANGSMITH_API_KEY=\"your-api-key\"\n",
"```\n",
"\n",
"### Installation\n",
Loading