docs: update pydantic comments -> callouts in tutorials (#1825)

This commit is contained in:
Vadym Barda
2024-09-24 13:09:59 +00:00
committed by GitHub
parent bb5ff42bcd
commit 37948b3348
16 changed files with 218 additions and 19 deletions
@@ -130,6 +130,19 @@
"We will create a `code_gen_chain` w/ either OpenAI or Claude and test them here."
]
},
{
"cell_type": "markdown",
"id": "95944645-35bc-4798-8a27-c262b245a74c",
"metadata": {},
"source": [
"<div class=\"admonition note\">\n",
" <p class=\"admonition-title\">Using Pydantic with LangChain</p>\n",
" <p>\n",
" This notebook uses Pydantic v2 <code>BaseModel</code>, which requires <code>langchain-core >= 0.3</code>. Using <code>langchain-core < 0.3</code> will result in errors due to mixing of Pydantic v1 and v2 <code>BaseModels</code>.\n",
" </p>\n",
"</div>"
]
},
{
"cell_type": "code",
"execution_count": 5,
@@ -150,7 +163,6 @@
"source": [
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_openai import ChatOpenAI\n",
"# NOTE: you must use langchain-core >= 0.3 with Pydantic v2\n",
"from pydantic import BaseModel, Field\n",
"\n",
"### OpenAI\n",