docs: mdx v3 compat [wip]

This commit is contained in:
Erick Friis
2024-09-12 21:22:48 -07:00
parent 608c4a4327
commit c858c6cc09
10 changed files with 125 additions and 15 deletions

View File

@@ -452,7 +452,7 @@ the effectiveness of the proposed technique, we implemented a ToT-based solver
for the Sudoku Puzzle. Experimental results show that the ToT framework can for the Sudoku Puzzle. Experimental results show that the ToT framework can
significantly increase the success rate of Sudoku puzzle solving. Our significantly increase the success rate of Sudoku puzzle solving. Our
implementation of the ToT-based Sudoku solver is available on GitHub: implementation of the ToT-based Sudoku solver is available on GitHub:
\url{https://github.com/jieyilong/tree-of-thought-puzzle-solver}. \url\{https://github.com/jieyilong/tree-of-thought-puzzle-solver\}.
## Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models ## Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought Reasoning by Large Language Models

View File

@@ -734,10 +734,10 @@ of the object.
If you're creating a custom chain or runnable, you need to remember to propagate request time If you're creating a custom chain or runnable, you need to remember to propagate request time
callbacks to any child objects. callbacks to any child objects.
:::important Async in Python<=3.10 :::important Async in Python&lt;=3.10
Any `RunnableLambda`, a `RunnableGenerator`, or `Tool` that invokes other runnables Any `RunnableLambda`, a `RunnableGenerator`, or `Tool` that invokes other runnables
and is running `async` in python<=3.10, will have to propagate callbacks to child and is running `async` in python&lt;=3.10, will have to propagate callbacks to child
objects manually. This is because LangChain cannot automatically propagate objects manually. This is because LangChain cannot automatically propagate
callbacks to child objects in this case. callbacks to child objects in this case.

View File

@@ -23,7 +23,7 @@
"\n", "\n",
":::{.callout-danger}\n", ":::{.callout-danger}\n",
"\n", "\n",
"If you're on `python<=3.10`, you need to remember to propagate `config` or `callbacks` when invoking other `runnable` from within a `RunnableLambda`, `RunnableGenerator` or `@tool`. If you do not do this,\n", "If you're on `python&lt;=3.10`, you need to remember to propagate `config` or `callbacks` when invoking other `runnable` from within a `RunnableLambda`, `RunnableGenerator` or `@tool`. If you do not do this,\n",
"the callbacks will not be propagated to the child runnables being invoked.\n", "the callbacks will not be propagated to the child runnables being invoked.\n",
":::" ":::"
] ]

View File

@@ -38,9 +38,9 @@
"\n", "\n",
"\n", "\n",
":::caution COMPATIBILITY\n", ":::caution COMPATIBILITY\n",
"LangChain cannot automatically propagate configuration, including callbacks necessary for astream_events(), to child runnables if you are running async code in python<=3.10. This is a common reason why you may fail to see events being emitted from custom runnables or tools.\n", "LangChain cannot automatically propagate configuration, including callbacks necessary for astream_events(), to child runnables if you are running async code in python&lt;=3.10. This is a common reason why you may fail to see events being emitted from custom runnables or tools.\n",
"\n", "\n",
"If you are running python<=3.10, you will need to manually propagate the `RunnableConfig` object to the child runnable in async environments. For an example of how to manually propagate the config, see the implementation of the `bar` RunnableLambda below.\n", "If you are running python&lt;=3.10, you will need to manually propagate the `RunnableConfig` object to the child runnable in async environments. For an example of how to manually propagate the config, see the implementation of the `bar` RunnableLambda below.\n",
"\n", "\n",
"If you are running python>=3.11, the `RunnableConfig` will automatically propagate to child runnables in async environment. However, it is still a good idea to propagate the `RunnableConfig` manually if your code may run in other Python versions.\n", "If you are running python>=3.11, the `RunnableConfig` will automatically propagate to child runnables in async environment. However, it is still a good idea to propagate the `RunnableConfig` manually if your code may run in other Python versions.\n",
":::" ":::"
@@ -115,7 +115,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"In python <= 3.10, you must propagate the config manually!" "In python &lt;= 3.10, you must propagate the config manually!"
] ]
}, },
{ {
@@ -147,7 +147,7 @@
"async def bar(x: str, config: RunnableConfig) -> str:\n", "async def bar(x: str, config: RunnableConfig) -> str:\n",
" \"\"\"An example that shows how to manually propagate config.\n", " \"\"\"An example that shows how to manually propagate config.\n",
"\n", "\n",
" You must do this if you're running python<=3.10.\n", " You must do this if you're running python&lt;=t;=3.10.\n",
" \"\"\"\n", " \"\"\"\n",
" await adispatch_custom_event(\"event1\", {\"x\": x}, config=config)\n", " await adispatch_custom_event(\"event1\", {\"x\": x}, config=config)\n",
" await adispatch_custom_event(\"event2\", 5, config=config)\n", " await adispatch_custom_event(\"event2\", 5, config=config)\n",
@@ -223,7 +223,7 @@
"async def bar(x: str, config: RunnableConfig) -> str:\n", "async def bar(x: str, config: RunnableConfig) -> str:\n",
" \"\"\"An example that shows how to manually propagate config.\n", " \"\"\"An example that shows how to manually propagate config.\n",
"\n", "\n",
" You must do this if you're running python<=3.10.\n", " You must do this if you're running python&lt;=t;=3.10.\n",
" \"\"\"\n", " \"\"\"\n",
" await adispatch_custom_event(\"event1\", {\"x\": x}, config=config)\n", " await adispatch_custom_event(\"event1\", {\"x\": x}, config=config)\n",
" await adispatch_custom_event(\"event2\", 5, config=config)\n", " await adispatch_custom_event(\"event2\", 5, config=config)\n",

View File

@@ -39,7 +39,7 @@
"| `AIMessageChunk` / `HumanMessageChunk` / ... | Chunk variant of each type of message. |\n", "| `AIMessageChunk` / `HumanMessageChunk` / ... | Chunk variant of each type of message. |\n",
"\n", "\n",
"\n", "\n",
"::: {.callout-note}\n", ":::note\n",
"`ToolMessage` and `FunctionMessage` closely follow OpenAI's `function` and `tool` roles.\n", "`ToolMessage` and `FunctionMessage` closely follow OpenAI's `function` and `tool` roles.\n",
"\n", "\n",
"This is a rapidly developing field and as more models add function calling capabilities. Expect that there will be additions to this schema.\n", "This is a rapidly developing field and as more models add function calling capabilities. Expect that there will be additions to this schema.\n",
@@ -145,7 +145,7 @@
"| `_astream` | Use to implement async version of `_stream`. | Optional |\n", "| `_astream` | Use to implement async version of `_stream`. | Optional |\n",
"\n", "\n",
"\n", "\n",
":::{.callout-tip}\n", ":::tip\n",
"The `_astream` implementation uses `run_in_executor` to launch the sync `_stream` in a separate thread if `_stream` is implemented, otherwise it fallsback to use `_agenerate`.\n", "The `_astream` implementation uses `run_in_executor` to launch the sync `_stream` in a separate thread if `_stream` is implemented, otherwise it fallsback to use `_agenerate`.\n",
"\n", "\n",
"You can use this trick if you want to reuse the `_stream` implementation, but if you're able to implement code that's natively async that's a better solution since that code will run with less overhead.\n", "You can use this trick if you want to reuse the `_stream` implementation, but if you're able to implement code that's natively async that's a better solution since that code will run with less overhead.\n",

View File

@@ -22,7 +22,7 @@
"\n", "\n",
"LangChain cannot automatically propagate configuration, including callbacks necessary for `astream_events()`, to child runnables if you are running `async` code in `python<=3.10`. This is a common reason why you may fail to see events being emitted from custom runnables or tools.\n", "LangChain cannot automatically propagate configuration, including callbacks necessary for `astream_events()`, to child runnables if you are running `async` code in `python<=3.10`. This is a common reason why you may fail to see events being emitted from custom runnables or tools.\n",
"\n", "\n",
"If you are running python<=3.10, you will need to manually propagate the `RunnableConfig` object to the child runnable in async environments. For an example of how to manually propagate the config, see the implementation of the `bar` RunnableLambda below.\n", "If you are running python&lt;=3.10, you will need to manually propagate the `RunnableConfig` object to the child runnable in async environments. For an example of how to manually propagate the config, see the implementation of the `bar` RunnableLambda below.\n",
"\n", "\n",
"If you are running python>=3.11, the `RunnableConfig` will automatically propagate to child runnables in async environment. However, it is still a good idea to propagate the `RunnableConfig` manually if your code may run in older Python versions.\n", "If you are running python>=3.11, the `RunnableConfig` will automatically propagate to child runnables in async environment. However, it is still a good idea to propagate the `RunnableConfig` manually if your code may run in older Python versions.\n",
"\n", "\n",

View File

@@ -474,7 +474,7 @@
"# Other Notes\n", "# Other Notes\n",
">* More documentation can be found at [LangChain-MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/ai-integrations/langchain/) site\n", ">* More documentation can be found at [LangChain-MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/ai-integrations/langchain/) site\n",
">* This feature is Generally Available and ready for production deployments.\n", ">* This feature is Generally Available and ready for production deployments.\n",
">* The langchain version 0.0.305 ([release notes](https://github.com/langchain-ai/langchain/releases/tag/v0.0.305)) introduces the support for $vectorSearch MQL stage, which is available with MongoDB Atlas 6.0.11 and 7.0.2. Users utilizing earlier versions of MongoDB Atlas need to pin their LangChain version to <=0.0.304\n", ">* The langchain version 0.0.305 ([release notes](https://github.com/langchain-ai/langchain/releases/tag/v0.0.305)) introduces the support for $vectorSearch MQL stage, which is available with MongoDB Atlas 6.0.11 and 7.0.2. Users utilizing earlier versions of MongoDB Atlas need to pin their LangChain version to &lt;=0.0.304\n",
"> " "> "
] ]
}, },

View File

@@ -255,7 +255,7 @@
"| \\$eq | Equality (==) |\n", "| \\$eq | Equality (==) |\n",
"| \\$ne | Inequality (!=) |\n", "| \\$ne | Inequality (!=) |\n",
"| \\$lt | Less than (<) |\n", "| \\$lt | Less than (<) |\n",
"| \\$lte | Less than or equal (<=) |\n", "| \\$lte | Less than or equal (&lt;=) |\n",
"| \\$gt | Greater than (>) |\n", "| \\$gt | Greater than (>) |\n",
"| \\$gte | Greater than or equal (>=) |\n", "| \\$gte | Greater than or equal (>=) |\n",
"| \\$in | Special Cased (in) |\n", "| \\$in | Special Cased (in) |\n",

View File

@@ -372,7 +372,7 @@
"| `$eq` | Equality (==) |\n", "| `$eq` | Equality (==) |\n",
"| `$ne` | Inequality (!=) |\n", "| `$ne` | Inequality (!=) |\n",
"| `$lt` | Less than (<) |\n", "| `$lt` | Less than (<) |\n",
"| `$lte` | Less than or equal (<=) |\n", "| `$lte` | Less than or equal (&lt;=) |\n",
"| `$gt` | Greater than (>) |\n", "| `$gt` | Greater than (>) |\n",
"| `$gte` | Greater than or equal (>=) |\n", "| `$gte` | Greater than or equal (>=) |\n",
"| `$in` | Contained in a set of given values (in) |\n", "| `$in` | Contained in a set of given values (in) |\n",

110
docs/it.md Normal file
View File

@@ -0,0 +1,110 @@
[ERROR] 36/1326 MDX files couldn't compile!
---
Error while compiling file docs/additional_resources/arxiv_references.mdx:455:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/how_to/custom_chat_model.md:38:6
Details: Could not parse expression with acorn
---
Error while compiling file docs/how_to/extraction_parse.md:88:9
Details: Could not parse expression with acorn
---
Error while compiling file docs/how_to/parallel.md:75:6
Details: Could not parse expression with acorn
---
Error while compiling file docs/how_to/self_query.md:254:2
Details: Unexpected character `<` (U+003C) before name, expected a character that can start a name, such as a letter, `$`, or `_`
---
Error while compiling file docs/how_to/sql_csv.md
Details: These MDX global variables do not seem to be available in scope: df
---
Error while compiling file docs/how_to/streaming.md:428:90
Details: Could not parse expression with acorn
---
Error while compiling file docs/how_to/structured_output.md:510:15
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/chat/anthropic_functions.md:7:6
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/document_loaders/blockchain.md:27:21
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/document_loaders/confluence.md:19:1
Details: Expected a closing tag for `<page_id>` (19:149-19:158) before the end of `paragraph`
---
Error while compiling file docs/integrations/document_loaders/figma.md
Details: These MDX global variables do not seem to be available in scope: node_id
---
Error while compiling file docs/integrations/document_loaders/mintbase.md:27:21
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/document_loaders/mongodb.md:23:23
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/document_loaders/rspace.md:20:5
Details: Expected a closing tag for `<YOUR_KEY>` (20:20-20:30) before the end of `paragraph`
---
Error while compiling file docs/integrations/document_loaders/slack.md
Details: These MDX global variables do not seem to be available in scope: your_slack_domain
---
Error while compiling file docs/integrations/document_loaders/web_base.md:54:35
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/llms/runhouse.md:151:109
Details: Unexpected character `2` (U+0032) before name, expected a character that can start a name, such as a letter, `$`, or `_`
---
Error while compiling file docs/integrations/providers/dspy.md
Details: These MDX global variables do not seem to be available in scope: context question
---
Error while compiling file docs/integrations/providers/figma.mdx
Details: These MDX global variables do not seem to be available in scope: node_id
---
Error while compiling file docs/integrations/providers/xinference.mdx
Details: These MDX global variables do not seem to be available in scope: supervisor_host
---
Error while compiling file docs/integrations/tools/amadeus.md:146:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/tools/azure_ai_services.md:102:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/tools/azure_cognitive_services.md:102:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/tools/bash.md:68:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/tools/eleven_labs_tts.md:87:11
Details: Could not parse expression with acorn
---
Error while compiling file /docs/docs/integrations/tools/github.md
Details: These MDX global variables do not seem to be available in scope: name repo username
---
Error while compiling file docs/integrations/tools/gitlab.md
Details: These MDX global variables do not seem to be available in scope: name repo username
---
Error while compiling file docs/integrations/tools/ifttt.md
Details: These MDX global variables do not seem to be available in scope: JsonPayload
---
Error while compiling file docs/integrations/tools/lemonai.md:65:138
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/tools/playwright.md:174:11
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/vectorstores/activeloop_deeplake.md:305:122
Details: Could not parse expression with acorn
---
Error while compiling file docs/integrations/vectorstores/alibabacloud_opensearch.md:190:87
Details: Unexpected character `@` (U+0040) in member name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag (note: to create a link in MDX, use `[text](url)`)
---
Error while compiling file docs/integrations/vectorstores/baiducloud_vector_search.md:79:38
Details: Unexpected character `@` (U+0040) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag (note: to create a link in MDX, use `[text](url)`)
---
Error while compiling file docs/integrations/vectorstores/pgvector.md:155:27
Details: Unexpected character `)` (U+0029) before name, expected a character that can start a name, such as a letter, `$`, or `_`
---
Error while compiling file docs/integrations/vectorstores/sap_hanavector.md:199:26
Details: Unexpected character `)` (U+0029) before name, expected a character that can start a name, such as a letter, `$`, or `_`
---