1
0
mirror of https://github.com/hwchase17/langchain.git synced 2025-11-07 03:32:00 +00:00

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

This commit is contained in:
97tkddnjs
2025-06-21 05:43:59 +09:00
committed by GitHub
parent 2c9859956a
commit 4fe490c0ea

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