Quick Start#
To use the CHA in a safe and stable way make sure you have python3.10 and higher. First create a virtual env.
#create the venv
python -m venv /path/to/new/virtual/environment
#activate the venv
source /path/to/new/virtual/environment/bin/activate
You should now be able to see the environment showing in your terminal.
Now install the CHA package:
pip install openCHA
playwright install
Manual Installation#
git clone https://github.com/Institute4FutureHealth/CHA.git
cd CHA
pip install -e '.[all]'
playwright install
To make it easier, you can use the following command to install the minimum requirments and ready to go. This will install openai, tree of thought planner, as well as serpapi (search), and extract_text tasks.
pip install -e '.[minimum]'
If you want to install all requirements for all tasks and other components, use the following command:
pip install -e '.[all]'
After installing the package, based on what tasks you want to use, you may need to acquire some api_keys. For example, to get started using openAI GPT3.5 model as LLM in CHA, you need to signup in their website and get the api_key. Then you should add openAI api_key as environment vairable in your terminal:
export OPENAI_API_KEY="your api_key"
The same goes for using tasks like SerpAPI:
export SERPAPI_API_KEY="your api_key"
To make the extract_text work, you need to also install playwright using playwright command. Run the following command in your terminal:
playwright install
Running openCHA#
After installing the package, based on what tasks you want to use, you may need to acquire some api_keys. For example, to get started using openAI GPT3.5 model as LLM in CHA, you need to signup in their website and get the api_key. Then you should add openAI api_key as environment vairable in your terminal:
from openCHA import openCHA
cha = openCHA()
cha.run_with_interface()
This code will run the default interface. You can route to the following url:
http://127.0.0.1:7860
The openCHA back-end starts running
To start interacting with openCHA and make sure everything is working correctly, from the Tasks List selece google_search and extract_text. Then, in the Question box ask your questions like How to improve my sleep.
When the answer is ready, the answer will be shown in the chatbot box:
For debugging matters, your can check the terminal logs which logs all the process happening in the terminal. Each component log has different colors. For example, the tasks’ execution logs are purple.
For more examples go to the Examples page: Examples
Checkout our youtube video to see the setup in action: