Skip to main content

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:

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

llama_index_packs_finchat-0.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file llama_index_packs_finchat-0.2.0.tar.gz.

File metadata

  • Download URL: llama_index_packs_finchat-0.2.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.13 Darwin/23.6.0

File hashes

Hashes for llama_index_packs_finchat-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ee3e218a6da867df07bf8906c129ff96f98b54001416815da95daf424bf10d0f
MD5 53a8863ae9a8c8ab7ebfba968b4fe660
BLAKE2b-256 aaff03759ca48358e5074c424f67886a311fbe20e3dbe36d6065d6a40ce8f612

See more details on using hashes here.

File details

Details for the file llama_index_packs_finchat-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_packs_finchat-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b396d8fdb1536040d524f7a325c6cb210487a6d2c1da33a19902daf8629a768
MD5 81739a214ea6ecb7ac9ff4b1d341dbcc
BLAKE2b-256 8d31ce0517a9ed2d773a032c05005b7033bb503ce2686a998214dbc774089d66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page