Skip to content

Commit

Permalink
Merge pull request #3 from mitodl/mb/readme
Browse files Browse the repository at this point in the history
Fill out README a bit
  • Loading branch information
mbertrand authored Jan 3, 2025
2 parents 090f7fa + f56d0ef commit 9903d34
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 32 deletions.
78 changes: 77 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,78 @@
# learn-ai
AI Learn Test Repo

![CI Workflow](https://github.com/mitodl/learn-ai/actions/workflows/ci.yml/badge.svg)

This application provides backend API endpoints to access various AI chatbots.

**SECTIONS**

1. [Initial Setup](#initial-setup)
2. [Configuration](#configuration)
3. [Committing & Formatting](#committing--formatting)
4. [Sample Requests](#sample-requests)

## Initial Setup

Learn-AI follows the same [initial setup steps outlined in the common OL web app guide](https://mitodl.github.io/handbook/how-to/common-web-app-guide.html).
Run through those steps **including the addition of `/etc/hosts` aliases and the optional step for running the
`createsuperuser` command**.

This app runs locally on port 8002.

You can start it by running `docker compose up`

## Configuration

Configuration can be put in the following file which is gitignored:

```
mit-learn/
├── env/
└── backend.local.env
```

You will need at minimum the following environment variable to run locally:

```
OPENAI_API_KEY=<your_openai_api_key>
```

## Committing & Formatting

To ensure commits to GitHub are safe, first install [pre-commit](https://pre-commit.com/):

```
pip install pre_commit
pre-commit install
```

Running pre-commit can confirm your commit is safe to be pushed to GitHub and correctly formatted:

```
pre-commit run --all-files
```

To automatically install precommit hooks when cloning a repo, you can run this:

```
git config --global init.templateDir ~/.git-template
pre-commit init-templatedir ~/.git-template
```

## Sample Requests

Run the following curl command to test the SSE recommendation agent API:

```
curl 'http://ai.open.odl.local:8002/sse/recommendation_agent/' \
-H 'Accept: */*' \
-H 'Connection: keep-alive' \
-H 'Origin: http://ai.open.odl.local:8002' \
-H 'Referer: http://ai.open.odl.local:8002/' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
-H 'accept-language: en-US,en;q=0.9' \
-H 'content-type: application/json' \
--data-raw '{"message":"I am curious about AI applications for business"}' \
--verbose
```
6 changes: 0 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ services:
file: docker-compose.apps.yml
service: web
env_file:
- path: env/shared.env
- path: env/shared.local.env
required: false
- path: env/backend.env
- path: env/backend.local.env
required: false
Expand All @@ -22,9 +19,6 @@ services:
file: docker-compose.apps.yml
service: celery
env_file:
- path: env/shared.env
- path: env/shared.local.env
required: false
- path: env/backend.env
- path: env/backend.local.env
required: false
Expand Down
2 changes: 1 addition & 1 deletion env/backend.env
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CSRF_COOKIE_DOMAIN=open.odl.local
CSRF_COOKIE_SECURE=False
MITOL_COOKIE_DOMAIN=open.odl.local
MITOL_COOKIE_NAME=discussions

MITOL_APP_BASE_URL=http://ai.open.odl.local:8002

DEBUG=True
DJANGO_LOG_LEVEL=INFO
Expand Down
15 changes: 0 additions & 15 deletions env/frontend.env

This file was deleted.

1 change: 0 additions & 1 deletion env/frontend.local.example.env

This file was deleted.

5 changes: 0 additions & 5 deletions env/shared.env

This file was deleted.

3 changes: 0 additions & 3 deletions env/shared.local.example.env

This file was deleted.

0 comments on commit 9903d34

Please sign in to comment.