How to Build a Financial AI Agent with Phidata

146.9K views
•
December 28, 2024
by
Krish Naik
YouTube video player
How to Build a Financial AI Agent with Phidata

TL;DR

Build the financial agent by creating a Python 3.12 environment, installing Phidata and its supporting packages, and configuring Phidata and Groq API keys in an environment file. The application uses separate agents to collect stock information and search financial news, then combines their findings through an open-source language model to produce a recommendation.

Transcript

hello all my name is krishak and uh welcome to my YouTube channel so guys I am super excited now we are going to probably build lot of endtoend agentic AI applications with the help of different different Frameworks in this specific video uh we'll just get started to Showcase you like how do we specifically build agentic AI applications how do we b... Read More

Key Insights

  • Phidata is an open-source platform for building, shipping, deploying, and monitoring agentic systems. Its framework can support individual AI agents, multimodal agents, and coordinated agentic workflows that divide a complex request into smaller, specialized activities.
  • The framework can connect different language models to agent workflows. The presented options include OpenAI, Anthropic, AWS Bedrock, Azure, Gemini Vertex AI, Hugging Face, Groq, Nvidia, and Ollama, giving developers multiple routes for selecting the model behind an agent.
  • The project uses Groq to access hosted open-source language models through an API. The presenter chooses this approach because local Ollama installations may run slowly on machines that do not have large amounts of RAM or sufficiently powerful hardware.
  • The development environment is created with Conda and Python 3.12 inside the project folder. After activation, dependencies are installed from requirements.txt, keeping the libraries needed by the financial agent isolated from other Python projects.
  • The required packages include Phidata, python-dotenv, a finance package, DuckDuckGo Search, FastAPI, Uvicorn, and Groq. These dependencies cover agent construction, environment configuration, market information, web searches, application serving, and access to hosted language models.
  • The application requires both a Phidata API key and a Groq API key. The Groq key is created from its developer console, while the Phidata key is copied from the Phidata dashboard, and both values are stored in an environment file.
  • The financial workflow separates responsibilities between autonomous agents. One agent retrieves information about a requested stock, while another searches the web for recent news, allowing each component to focus on a distinct source of information before results are combined.
  • The final recommendation is produced after stock details and web-search findings are combined and sent to the language model. The example request asks the system to summarize and recommend Nvidia stock, illustrating how multiple agents contribute evidence to a shared response.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is Phidata used for in an agentic AI project?

Phidata is used as an open-source framework for building, shipping, deploying, and monitoring agentic systems. Within the demonstrated project, it provides the structure for creating independent agents and combining them into a more complex workflow. It can also support multimodal agents, custom prompts, tools, knowledge, and memory, while allowing developers to select from multiple language-model providers.

Q: How do you set up the Python environment for the financial agent?

Create a Conda environment inside the project folder and configure it to use Python 3.12. The demonstrated command uses the path option so the environment is stored locally as VENV. After Conda finishes creating it, activate that environment, prepare requirements.txt, and install all listed dependencies with pip before beginning work on the financial agent file.

Q: Which packages are required for the Phidata financial agent?

The requirements shown include Phidata, python-dotenv, a finance package, DuckDuckGo Search, FastAPI, Uvicorn, and Groq. Phidata supplies the agent framework, python-dotenv loads environment values, the finance and search packages provide external information, FastAPI and Uvicorn support application serving, and Groq provides access to hosted open-source language models through its API.

Q: How do you configure API keys for Phidata and Groq?

Create an environment file and add two values: a Phidata API key and a Groq API key. The Groq key can be created after signing in to the Groq developer console and opening its API Keys section. The Phidata key can be copied from the API key area of the Phidata dashboard. These credentials allow the local application to use both platforms.

Q: How does the multi-agent financial workflow operate?

The workflow assigns different responsibilities to separate autonomous agents. When a user requests a stock summary and recommendation, one agent gathers information about the stock itself. Another agent performs a web search to find relevant news. The application then combines the collected information and sends it to the selected language model, which produces the concluding summary and recommendation.

Q: Why does the project use Groq instead of a local Ollama model?

Groq is selected because it hosts open-source language models and provides API access, including some free usage for a limited number of requests. The presenter notes that Ollama runs language models locally, which can become slow when a computer lacks a high-powered configuration or large RAM capacity. Groq therefore provides the demonstrated route to open-source models without relying on demanding local execution.

Q: What kinds of language models can Phidata integrate with?

The framework is presented as supporting several model providers and deployment options. The listed integrations include OpenAI, Anthropic, AWS Bedrock, Azure, Gemini Vertex AI, Hugging Face, Groq, Nvidia, and Ollama. This flexibility lets a developer turn a selected language model into an agent and later add tools, domain knowledge, memory, and prompts for a particular workflow.

Q: How does the financial agent produce a stock recommendation?

The agent does not rely on a single action. It first coordinates specialized components that gather stock details and search the web for relevant financial news. Those findings are combined and provided to an open-source language model through Groq. The model then uses the assembled material to summarize the requested stock and formulate a recommendation, as illustrated by the Nvidia request.

Summary & Key Takeaways

  • Phidata is introduced as an open-source framework for building, shipping, deploying, and monitoring agentic systems. It supports independent agents, multimodal agents, and more complex workflows. Developers can connect language models from providers such as Groq, Hugging Face, AWS Bedrock, Azure, Gemini Vertex AI, Nvidia, and local Ollama installations.

  • The project setup begins with a Python 3.12 Conda environment created inside the project folder. Its requirements include Phidata, python-dotenv, a finance package, DuckDuckGo Search, FastAPI, Uvicorn, and Groq. After activating the environment, the dependencies are installed from requirements.txt, and secrets are placed in an environment file.

  • The planned financial application uses multiple specialized agents. One agent gathers details about a requested stock, while another searches the web for relevant news. Their information is combined and passed to an open-source language model hosted through Groq, allowing the application to summarize the stock and formulate a recommendation based on the collected material.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from Krish Naik 📚