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

This commit is contained in:
97tkddnjs 2025-06-21 05:43:59 +09:00 committed by GitHub
parent 2c9859956a
commit 4fe490c0ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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": [],