PydanticAI - Building a Research Agent

preview_player
Показать описание
In this video, I look at how to build a research agent using PydanticAI that makes use of external search as a tool .

In this video, I look at Pydantic AI, which is a new agent framework from the creators of the Pydantic validation framework. It can be used for building a variety of LLM apps and AI agents.

For more tutorials on using LLMs and building agents, check out my Patreon

🕵️ Interested in building LLM Agents? Fill out the form below

👨‍💻Github:

⏱️Time Stamps:
00:00 Intro
00:14 Building a Research Agent with Pydantic AI
00:51 Setting up Search Engines Tavily and Duck Duck Go Search
04:25 Setting up the Agent
05:43 Setting up the Search Agent Tool
07:24 Setting up the Dependencies
08:17 Running a Query
13:25 Injecting a Date into System prompt
Рекомендации по теме
Комментарии
Автор

nice video! you might want to explore Annotated types so you don’t have to waste space in your english prompts saying “3-5 items” etc and instead say Annotated[list[str], Field(description=‘at least 3’, max_length=5)] so you can use that in your data classes / models / typed dicts. then reserve your system prompts for high level nuance

nathannowack
Автор

Nice vid. If you like this checkout Controlflow. Similar features. Better options for orchestration. Good docs. Clean code. Easy to dive in and customise.

thembamahlangu
Автор

Can’t wait for the rag video! Thanks, great job

simonNAME
Автор

This was marvellous! Thanks a lot Sam! 🔥🤗

rezakn
Автор

Awesome video! How can you link Pydantic AI with OpenAI's vision features?

ShlomiSchwartz
Автор

thanks for the video, is there a way to control which tools the agent will call in a specific situation?

thanhquachable
Автор

Great content! thanks. I'm using Phidata for that purpose and more other stuff, it's relatively lightweight/flexible although it's getting bigger recently, pydantic-ai looks a good alternative when it becomes more mature, having that in mind someone needs to choose carefully what to use in order to reduce the cost of refactoring. I wish to see your thoughts about it or make a video if it worth it.

ibrahimhalouane
Автор

one question. why someone would use pytdanticAi instead of langchain for example?

TheAstralftw
Автор

Nice example. I was thinking - I don't like passing the date to the model by overriding the system prompt. What if we give it a tool that allows it to call the datetime function (I don't know what's a python equivalent of moment.js) and it could do all sorts of date-time computations depending on what is asked in the user prompt. That way it would truly be agentic.

ksprashutv
Автор

Liked and subscribe after discover the 2 latest videos on Pydantic AI

xTomster
Автор

Researching at 50 giga pages per minute cool. 😊

justindressler
Автор

Sam, I love your work! I am hoping your RAG chunking strategy will be full Page or Article-Based chunks?

ShaneHolloman
Автор

Researching what is question. Patent can be registered only to genuine author, which Ai cannot be and human using Ai are not author. At the same time they registered a thousand machine generated patents in USA already.

fontenbleau
Автор

Hi. The dataclass that you used is _not_ a pydantic dataclass. For pydantic dataclasss you would: from pydantic.dataclasses import dataclass not from dataclasses import dataclass. It's kind of important difference.

MariuszWoloszyn