Spaces:
Build error
Initial Setup
⚠️ Create the .env file inside the code/
directory.
Python Environment
Python Version: 3.11
Create a virtual environment and install the required packages:
conda create -n ai_tutor python=3.11
conda activate ai_tutor
pip install -r requirements.txt
Code Formatting
The codebase is formatted using black, and if making changes to the codebase, ensure that the code is formatted before submitting a pull request. More instructions can be found in docs/contribute.md
.
Google OAuth 2.0 Client ID and Secret
To set up the Google OAuth 2.0 Client ID and Secret, follow these steps:
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to the "Credentials" page.
- Click on "Create Credentials" and select "OAuth 2.0 Client ID".
- Configure the OAuth consent screen if you haven't already.
- Choose "Web application" as the application type.
- Configure the redirect URIs as needed.
- Copy the generated
Client ID
andClient Secret
.
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
OAUTH_GOOGLE_CLIENT_ID=<your_client_id>
OAUTH_GOOGLE_CLIENT_SECRET=<your_client_secret>
Literal AI API Key
To obtain the Literal AI API key:
- Sign up or log in to Literal AI.
- Navigate to the API Keys section under your account settings.
- Create a new API key if necessary and copy it.
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
LITERAL_API_KEY_LOGGING=<your_api_key>
LITERAL_API_URL=https://cloud.getliteral.ai
LlamaCloud API Key
To obtain the LlamaCloud API Key:
- Go to LlamaCloud.
- Sign up or log in to your account.
- Navigate to the API section and generate a new API key if necessary.
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
LLAMA_CLOUD_API_KEY=<your_api_key>
Hugging Face Access Token
To obtain your Hugging Face access token:
- Go to Hugging Face settings.
- Log in or create an account.
- Generate a new token or use an existing one.
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
HUGGINGFACE_TOKEN=<your-huggingface-token>
Chainlit Authentication Secret
You must provide a JWT secret in the environment to use authentication. Run chainlit create-secret
to generate one.
chainlit create-secret
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
CHAINLIT_AUTH_SECRET=<your_jwt_secret>
CHAINLIT_URL=<your_chainlit_url> # Example: CHAINLIT_URL=http://localhost:8000
OpenAI API Key
Set the following in the .env file (if running locally) or in secrets (if running on Hugging Face Spaces):
OPENAI_API_KEY=<your_openai_api_key>
In a Nutshell
Your .env file (secrets in HuggingFace) should look like this:
CHAINLIT_AUTH_SECRET=<your_jwt_secret>
OPENAI_API_KEY=<your_openai_api_key>
HUGGINGFACE_TOKEN=<your-huggingface-token>
LITERAL_API_KEY_LOGGING=<your_api_key>
LITERAL_API_URL=<https://cloud.getliteral.ai>
OAUTH_GOOGLE_CLIENT_ID=<your_client_id>
OAUTH_GOOGLE_CLIENT_SECRET=<your_client_secret>
LLAMA_CLOUD_API_KEY=<your_api_key>
CHAINLIT_URL=<your_chainlit_url>
Configuration
The configuration file code/modules/config.yaml
contains the parameters that control the behaviour of your app.
The configuration file code/modules/user_config.yaml
contains user-defined parameters.