์นดํ…Œ๊ณ ๋ฆฌ ์—†์Œ

langchain error ํ•ด๊ฒฐ - PydanticUserError: SQLDatabaseToolkit is not fully defined; you should define BaseCache, then call SQLDatabaseToolkit.model_rebuild()

parkjiu 2024. 12. 2. 11:05

 

DB(postgreSQL)์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด์„œ ์ฑ—๋ด‡์„ ๋งŒ๋“ค๊ณ ์ž ํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๋ž˜๋„ SQL ์—์ด์ „ํŠธ๊ฐ€ ๊ฐ€์žฅ ๋น ๋ฅด๊ณ  ํšจ์œจ์ ์ธ ๋ฐฉ๋ฒ•๊ฐ™์•„์„œ sql agent ์“ฐ๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ์ž๊พธ


PydanticUserError: SQLDatabaseToolkit is not fully defined; you should define BaseCache, then call SQLDatabaseToolkit.model_rebuild() 
์ด๋Ÿฐ ์˜ค๋ฅ˜๊ฐ€ ๋‚˜๋Š” ๊ฒƒ์ž„๋‹ˆ๋‹ค... ์ฝ”ํŒŒ์ผ๋Ÿฟ๊ณผ ์ง€ํ”ผํ‹ฐ ํด๋กœ๋“œ ๋ชจ๋‘ ํ•ด๊ฒฐํ•˜์ง€ ๋ชปํ•˜๊ธธ๋ž˜ ์ผ์ฃผ์ผ ๋ฐ˜ ์ •๋„ ๋‹ค๋ฅธ ์ผํ•˜๋‹ค๊ฐ€ ๋‹ค์‹œ ์™”๋”๋‹ˆ ๊ทธ ์‚ฌ์ด์— ๋ˆ„๊ฐ€ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ด์ฃผ์…จ๋‹ค. ์•„๋ž˜ ๋งํฌ ์ฐธ๊ณ .

 

๊ฒฐ๋ก  : pydantic ์˜ ๋ฒ„์ „์„ 2.9.2๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ ํ•ด์„œ ํ•ด๊ฒฐ. 

https://github.com/langchain-ai/langchain/issues/28284

 

PydanticUserError: `SQLDatabaseToolkit` is not fully defined; you should define `BaseCache`, then call `SQLDatabaseToolkit.model

Checked other resources I added a very descriptive title to this issue. I searched the LangChain documentation with the integrated search. I used the GitHub search to find a similar question and di...

github.com

pip uninstall pydantic
pip install pydantic==2.9.2

์œ„ ๋ช…๋ น์–ด ์‹คํ–‰ํ•˜์‹œ๋ฉด ๋Œ‘๋‹ˆ๋‹น ใ…Ž

 

pydantic์˜ ์ƒˆ๋กœ์šด ๋ฒ„์ „์ด ๋‚˜์™”๋Š”๋ฐ, sql agent์— ํ•„์š”ํ•œ SQLDatabaseToolkit์ด ์ด pydantic ๋ชจ๋ธ์ด๋ฉฐ, ์ƒˆ๋กœ์šด ๋ฒ„์ „๊ณผ ์ถฉ๋Œ์ด ์žˆ์–ด์„œ ์•ˆ๋˜๋Š” ๋ญ ๊ทธ๋Ÿฐ ๊ฑฐ ๊ฐ€ํ‹ˆ... ๋งŽ์€ ์ด๋“ค์˜ ๋น ๋ฅธ ํ•ด๊ฒฐ์„ ๋ฐ”๋ผ๋ฉฐ...