Skip to content

Commit 4fe490c

Browse files
authored
[Docs] Update deprecated Pydantic .schema() method to .model_json_schema() in How to convert Runnables to Tools guide (#31618)
1 parent 2c98599 commit 4fe490c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

docs/docs/how_to/convert_runnable_to_tool.ipynb

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@
106106
{
107107
"data": {
108108
"text/plain": [
109-
"{'title': 'My tool',\n",
110-
" 'type': 'object',\n",
111-
" 'properties': {'a': {'title': 'A', 'type': 'integer'},\n",
112-
" 'b': {'title': 'B', 'type': 'array', 'items': {'type': 'integer'}}},\n",
113-
" 'required': ['a', 'b']}"
109+
"{'properties': {'a': {'title': 'A', 'type': 'integer'},\n",
110+
" 'b': {'items': {'type': 'integer'}, 'title': 'B', 'type': 'array'}},\n",
111+
" 'required': ['a', 'b'],\n",
112+
" 'title': 'My tool',\n",
113+
" 'type': 'object'}"
114114
]
115115
},
116116
"execution_count": 3,
@@ -121,7 +121,7 @@
121121
"source": [
122122
"print(as_tool.description)\n",
123123
"\n",
124-
"as_tool.args_schema.schema()"
124+
"as_tool.args_schema.model_json_schema()"
125125
]
126126
},
127127
{
@@ -449,10 +449,11 @@
449449
{
450450
"data": {
451451
"text/plain": [
452-
"{'title': 'RunnableParallel<context,question,answer_style>Input',\n",
453-
" 'type': 'object',\n",
454-
" 'properties': {'question': {'title': 'Question'},\n",
455-
" 'answer_style': {'title': 'Answer Style'}}}"
452+
"{'properties': {'question': {'title': 'Question'},\n",
453+
" 'answer_style': {'title': 'Answer Style'}},\n",
454+
" 'required': ['question', 'answer_style'],\n",
455+
" 'title': 'RunnableParallel<context,question,answer_style>Input',\n",
456+
" 'type': 'object'}"
456457
]
457458
},
458459
"execution_count": 14,
@@ -461,12 +462,12 @@
461462
}
462463
],
463464
"source": [
464-
"rag_chain.input_schema.schema()"
465+
"rag_chain.input_schema.model_json_schema()"
465466
]
466467
},
467468
{
468469
"cell_type": "code",
469-
"execution_count": 17,
470+
"execution_count": 15,
470471
"id": "a3f9cf5b-8c71-4b0f-902b-f92e028780c9",
471472
"metadata": {},
472473
"outputs": [],

0 commit comments

Comments
 (0)