From b81ad7ccce91a258853aecc8cecdece81fc55f44 Mon Sep 17 00:00:00 2001 From: Michael Struwig Date: Fri, 17 May 2024 11:36:51 +0200 Subject: [PATCH 1/3] Update README. --- README.md | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5eb566b..de86ee0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # OpenBB-agents -Active work-in-progress. Consider pre-alpha for now. +Work-in-progress. -This is a project that leverages LLMs and OpenBB Platform to create financial +This is a project that leverages LLMs and [OpenBB Platform](https://github.com/OpenBB-finance/OpenBBTerminal/tree/develop/openbb_platform) to create financial analyst agents that can autonomously perform financial research, and answer questions using up-to-date data. This is possible as a result of agents -utilizing function calling to interact with the OpenBB platform. +utilizing function calling to interact with the OpenBB Platform. ## Installation @@ -16,6 +16,15 @@ Currently, we only support Python 3.11. We will be adding support for more versi pip install openbb-agents --upgrade ``` +## Setup +All underlying LLM functions are OpenBB Platform functions. This means that, for +certain data providers, you must configure [data provider API credentials](https://docs.openbb.co/platform/usage/api_keys) for use with OpenBB Platform. You can set-up +credentials in two ways: +- [Locally by specifying a `~/.openbb_platform/user_settings.json` +file](https://docs.openbb.co/platform/usage/api_keys#local-environment) +- Using your [OpenBB Hub](https://my.openbb.co/) account and creating a personal access token (PAT), which can be passed to the agent as an argument. + + ## Usage ``` python @@ -27,24 +36,36 @@ pip install openbb-agents --upgrade - The market cap is calculated by multiplying the current stock price ($218.89) by the number of outstanding shares (3,178,920,000). ``` -If you've cloned the repository, you can use the `run.py` script and pass in your query: -``` sh -python run.py "What is the current market cap of TSLA?" +To use your data provider credentials stored in OpenBB Hub, you can pass in your OpenBB Hub PAT directly to the agent: + +``` python +>>> openbb_agent("What is the stock price of AAPL?", openbb_pat="") ``` -Queries can be complex: +**Note:** The agent automatically configures itself based on which data provider +credentials are available. This means that certain data sources and functions +may not be available without the proper API key. By default, `yfinance` is +included as a data provider, which does not require an API key. For a list of functions and their supported data providers, see the [OpenBB Platform documentation](https://docs.openbb.co/platform/reference). -``` sh -python run.py "Perform a fundamentals financial analysis of AMZN using the most recently available data. What do you find that's interesting?" + +Queries can be relatively complex: + +```python +>>> openbb_agent("Perform a fundamentals financial analysis of AMZN using the most recently available data. What do you find that's interesting?") ``` Queries can also have temporal dependencies (i.e the answers of previous subquestions are required to answer a later subquestion): -``` sh -python run.py "Who are TSLA's peers? What is their respective market cap? Return the results in _descending_ order of market cap." +``` python +>>> openbb_agent("Who are TSLA's peers? What is their respective market cap? Return the results in _descending_ order of market cap.") ``` -There is more functionality coming very soon! +An `async` variant of the agent is also available: + +``` python +>>> from openbb_agents.agent import aopenbb_agent +>>> await aopenbb_agent("What is the current market cap of TSLA?") +``` ## Development From eaa949f3924a6da43cc9cc0807d4769f1a88435c Mon Sep 17 00:00:00 2001 From: Michael Struwig Date: Fri, 17 May 2024 11:37:31 +0200 Subject: [PATCH 2/3] Update title. --- README.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index de86ee0..f70982f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# OpenBB-agents +# OpenBB LLM Agents Work-in-progress. This is a project that leverages LLMs and [OpenBB Platform](https://github.com/OpenBB-finance/OpenBBTerminal/tree/develop/openbb_platform) to create financial @@ -17,12 +17,10 @@ pip install openbb-agents --upgrade ``` ## Setup -All underlying LLM functions are OpenBB Platform functions. This means that, for -certain data providers, you must configure [data provider API credentials](https://docs.openbb.co/platform/usage/api_keys) for use with OpenBB Platform. You can set-up -credentials in two ways: -- [Locally by specifying a `~/.openbb_platform/user_settings.json` -file](https://docs.openbb.co/platform/usage/api_keys#local-environment) -- Using your [OpenBB Hub](https://my.openbb.co/) account and creating a personal access token (PAT), which can be passed to the agent as an argument. +To use the OpenBB Platform functions, you need to configure the necessary [data provider API credentials](https://docs.openbb.co/platform/usage/api_keys). This can be done in one of two ways: + +1. **Local Configuration**: Specify your credentials in a `~/.openbb_platform/user_settings.json` file. Follow the [local environment setup guide](https://docs.openbb.co/platform/usage/api_keys#local-environment) for detailed instructions. +2. **OpenBB Hub**: Create a personal access token (PAT) via your [OpenBB Hub](https://my.openbb.co/) account. This PAT can then be passed to the agent as an argument. ## Usage @@ -42,11 +40,7 @@ To use your data provider credentials stored in OpenBB Hub, you can pass in your >>> openbb_agent("What is the stock price of AAPL?", openbb_pat="") ``` -**Note:** The agent automatically configures itself based on which data provider -credentials are available. This means that certain data sources and functions -may not be available without the proper API key. By default, `yfinance` is -included as a data provider, which does not require an API key. For a list of functions and their supported data providers, see the [OpenBB Platform documentation](https://docs.openbb.co/platform/reference). - +**Note:** The agent dynamically configures itself based on the available data provider credentials. Consequently, certain data sources and functions may be inaccessible without the appropriate API key. By default, `yfinance` is included as a data provider and does not require an API key. For a comprehensive list of functions and their supported data providers, refer to the [OpenBB Platform documentation](https://docs.openbb.co/platform/reference). Queries can be relatively complex: From e847ba072c576a0a1941f2a78e989f477f8d9fbb Mon Sep 17 00:00:00 2001 From: Michael Struwig Date: Fri, 17 May 2024 11:39:20 +0200 Subject: [PATCH 3/3] Add openai api key instructions. --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index f70982f..0689f53 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,17 @@ pip install openbb-agents --upgrade ``` ## Setup +### OpenAI API keys + +To use OpenBB LLM Agents, you need an OpenAI API key. Follow these steps: + +1. **Get API Key**: Sign up on [OpenAI](https://www.openai.com/) and get your API key. +2. **Set Environment Variable**: Add this to your shell profile (`.bashrc`, `.zshrc`, etc.): + ```sh + export OPENAI_API_KEY="your_openai_api_key" + ``` + +### OpenBB Platform data provider credentials To use the OpenBB Platform functions, you need to configure the necessary [data provider API credentials](https://docs.openbb.co/platform/usage/api_keys). This can be done in one of two ways: 1. **Local Configuration**: Specify your credentials in a `~/.openbb_platform/user_settings.json` file. Follow the [local environment setup guide](https://docs.openbb.co/platform/usage/api_keys#local-environment) for detailed instructions.