Skip to content

The agent engineering platform.

[Docs] Update deprecated Pydantic .schema() method to .model_json_schema() in How to convert Runnables to Tools guide (#31618)

97tkddnjs4fe490c0ea59
diff --git a/docs/docs/how_to/convert_runnable_to_tool.ipynb b/docs/docs/how_to/convert_runnable_to_tool.ipynb
index 0cee498715..3627f539c0 100644
--- a/docs/docs/how_to/convert_runnable_to_tool.ipynb
+++ b/docs/docs/how_to/convert_runnable_to_tool.ipynb
@@ -106,11 +106,11 @@
{
"data": {
"text/plain": [
- "{'title': 'My tool',\n",
- " 'type': 'object',\n",
- " 'properties': {'a': {'title': 'A', 'type': 'integer'},\n",
- " 'b': {'title': 'B', 'type': 'array', 'items': {'type': 'integer'}}},\n",
- " 'required': ['a', 'b']}"
+ "{'properties': {'a': {'title': 'A', 'type': 'integer'},\n",
+ " 'b': {'items': {'type': 'integer'}, 'title': 'B', 'type': 'array'}},\n",
+ " 'required': ['a', 'b'],\n",
+ " 'title': 'My tool',\n",
+ " 'type': 'object'}"
]
},
"execution_count": 3,
@@ -121,7 +121,7 @@
"source": [
"print(as_tool.description)\n",
"\n",
- "as_tool.args_schema.schema()"
+ "as_tool.args_schema.model_json_schema()"
]
},
{
@@ -449,10 +449,11 @@
{
"data": {
"text/plain": [
- "{'title': 'RunnableParallel<context,question,answer_style>Input',\n",
- " 'type': 'object',\n",
- " 'properties': {'question': {'title': 'Question'},\n",
- " 'answer_style': {'title': 'Answer Style'}}}"
+ "{'properties': {'question': {'title': 'Question'},\n",
+ " 'answer_style': {'title': 'Answer Style'}},\n",
+ " 'required': ['question', 'answer_style'],\n",
+ " 'title': 'RunnableParallel<context,question,answer_style>Input',\n",
+ " 'type': 'object'}"
]
},
"execution_count": 14,
@@ -461,12 +462,12 @@
}
],
"source": [
- "rag_chain.input_schema.schema()"
+ "rag_chain.input_schema.model_json_schema()"
]
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": 15,
"id": "a3f9cf5b-8c71-4b0f-902b-f92e028780c9",
"metadata": {},
"outputs": [],