What is phidata?
Phidata adds memory, knowledge and tools to LLMs.
Why phidata
Problem: LLMs have limited context and cannot take actions.
Solution: Add memory, knowledge and tools.
- Memory: Enables LLMs to have long-term conversations by storing chat history in a database.
- Knowledge: Provides LLMs with business context by storing information in a vector database.
- Tools: Enable LLMs to take actions like pulling data from an API, sending emails or querying a database.
Memory & knowledge make LLMs smarter while tools make them autonomous.
How it works
- Step 1: Create an
Assistant
- Step 2: Add Tools (functions), Knowledge (vectordb) and Storage (database)
- Step 3: Serve using Streamlit, FastApi or Django to build your AI application
LLM = Large Language Model
Example
Create a virtual environment
Open the Terminal
and create a python virtual environment.
Install phidata
Create an Assistant
Create a file assistant.py
with an Assistant that can search the web using DuckDuckGo.
from phi.assistant import Assistant
from phi.tools.duckduckgo import DuckDuckGo
assistant = Assistant(tools=[DuckDuckGo()], show_tool_calls=True)
assistant.print_response("Whats happening in France?", markdown=True)
Run the Assistant
Assistants use OpenAI
by default. Set your OPENAI_API_KEY
(you can get one from here).
Install openai
& duckduckgo
pip install openai duckduckgo-search
Run the Assistant
python assistant.py
Demos
Checkout the following AI Applications built using phidata:
- PDF AI summarizes and answers questions from PDFs.
- ArXiv AI answers questions about ArXiv papers using the ArXiv API.
- HackerNews AI summarize stories, users and shares what’s new on HackerNews.
Next Steps
- Read the basics to learn more about phidata.
- Read about Assistants and how to customize them.
- Checkout the cookbook for in-depth examples and code.
Looking to build an AI product?
We’ve helped many companies build AI products, the general workflow is:
- Build an Assistant with proprietary data to perform tasks specific to your product.
- Connect your product to the Assistant via an API.
- Monitor and Improve your AI product.
We also provide dedicated support and development, book a call to get started.
Was this page helpful?