Skip to content

Commit

Permalink
Merge branch 'main' into k-allagbe/issue18-update-env-var-template
Browse files Browse the repository at this point in the history
  • Loading branch information
k-allagbe committed Jan 10, 2024
2 parents c7745c1 + 622c2b4 commit f4fee9b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 26 deletions.
16 changes: 2 additions & 14 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# Deployment

## Azure
Create and set the environment variables based on `.env.template`. Make sure
Note on the container: Create and set the environment variables based on `.env.template`. Make sure
`FINESSE_BACKEND_DEBUG_MODE` is NOT set to `True` in PRODUCTION builds.

Build (do this from your WSL Ubuntu where Docker is already installed):

```
docker build -t finesse-backend .
```

test locally:

```
export PORT=<your_port_here>
docker run -p $PORT:$PORT -e PORT=$PORT --env-file .env finesse-backend
```
Refer to the [infrastructure repository](https://github.com/ai-cfia/infra) for a Kubernetes deployment. The secrets (in this case environment variables) are managed with Hashicorp Vault.
44 changes: 32 additions & 12 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,56 @@
## Running and testing the API
# Running and testing the API locally

Create and set the environment variables based on `.env.template`.
## With your local environment

Create and set the environment variables based on `.env.template`. You will need to create a `.env` file.

### Running:

```
```bash
flask run -h 0.0.0.0 --debug
```

Alternatively, set the `FINESSE_BACKEND_DEBUG_MODE` environment variable to
Alternatively, set the `FINESSE_BACKEND_DEBUG_MODE` environment variable to
`True` and run:

```
```bash
python run.py
```

### Query Azure AI Search from the command-line
## With docker

```
curl -X POST http://localhost:5000/search/azure --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"
Create and set the environment variables based on `.env.template`. You will need to create a `.env` file.

Build the container:

```bash
docker build -t finesse-backend .
```

### Query Ailab Search from the command-line
Deploy the container locally:

```bash
docker run -p 5000:5000 -e PORT=$PORT --env-file .env finesse-backend
```
curl -X POST http://localhost:5000/search/ailab --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"

## Check if the API is working properly

Test the path: `/search/static`

```bash
curl -X POST http://localhost:5000/search/static --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"
```

### Query Static Search from the command-line
Test the path: `/search/azure`

```bash
curl -X POST http://localhost:5000/search/azure --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"
```
curl -X POST http://localhost:5000/search/static --data '{"query": "how to bring a cat to canada"}' -H "Content-Type: application/json"

Test the path: `/search/ailab`

```bash
curl -X POST http://localhost:5000/search/ailab --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"
```

JSON structure explanation:
Expand Down

0 comments on commit f4fee9b

Please sign in to comment.