llama-index packs implementation of a hierarchical agent for finance chat.
Project description
Finance Chat Llama Pack based on OpenAIAgent
This LlamaPack implements a hierarchical agent based on LLM for financial chat and information extraction purposed.
LLM agent is connected to various open financial apis as well as daily updated SP500 postgres SQL database storing opening & closing price, volume as well as past earnings.
Based on the query, the agent reasons and routes to available tools or runs SQL query to retrieve information and combine information to answer.
Installation
pip install llama-index llama-index-packs-finchat
CLI Usage
You can download llamapacks directly using llamaindex-cli, which comes installed with the llama-index python package:
llamaindex-cli download-llamapack FinanceChatPack --download-dir ./finchat_pack
You can then inspect the files at ./finchat_pack and use them as a template for your own project.
Code Usage
You can download the pack to a the ./finchat_pack directory:
from llama_index.core.llama_pack import download_llama_pack
FinanceChatPack = download_llama_pack("FinanceChatPack", "./finchat_pack")
To use this tool, you'll need a few API keys:
- POLYGON_API_KEY -- https://polygon.io/
- FINNHUB_API_KEY -- https://finnhub.io/
- ALPHA_VANTAGE_API_KEY -- https://www.alphavantage.co/
- NEWSAPI_API_KEY -- https://newsapi.org/
- POSTGRES_DB_URI -- 'postgresql://postgres.xhlcobfkbhtwmckmszqp:fingptpassword#123@aws-0-us-east-1.pooler.supabase.com:5432/postgres' (You can also host your own postgres SQL DB with the same table signatures. To use different signatures, modification is required in giving query examples for SQL code generation.)
fin_agent = FinanceChatPack(
POLYGON_API_KEY,
FINNHUB_API_KEY,
ALPHA_VANTAGE_API_KEY,
NEWSAPI_API_KEY,
OPENAI_API_KEY,
)
From here, you can use the pack, or inspect and modify the pack in ./finchat_pack.
The run() function chats with the agent and sends the response of the input query.
response = fin_agent.run("<query>")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llama_index_packs_finchat-0.3.0.tar.gz.
File metadata
- Download URL: llama_index_packs_finchat-0.3.0.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87f7df9fed670f8676de4cbceb537940ce25184a074035b7f1ff438a10cfb8ef
|
|
| MD5 |
41617bd97d506b666633d61d84e41e2e
|
|
| BLAKE2b-256 |
4ec50c219fb3555ab5db253e902a6b1db940c049a1f6b3c46c78729220296994
|
File details
Details for the file llama_index_packs_finchat-0.3.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_packs_finchat-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e62cd454e88f57a01f4a15ec3525b9c60c161783a336da76077ce52039b314a8
|
|
| MD5 |
3c236e04544f78048be330499f58e891
|
|
| BLAKE2b-256 |
76e5b3ad1bbeb3a031d014861db74f1d1799396dc4a9c27822c408c8ef5aa7ed
|