Skip to content

Commit

Permalink
Made base_api_url an environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Raya679 committed Aug 10, 2024
1 parent c81129f commit 457fb93
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ The aim of query-tool-ai would be to make this search process more user-friendly
### Set the environment variables -
| Environment Variable | Type | Required | Default Value if Not Set | Example |
| ---------------------- | ------- | ---------------------------------------- | ------------------------ | --------------------------------------------------------- |
| `BASE_API_URL` | string | Yes | `None` | `https://api.neurobagel.org/query/?` |
| `HOST` | string | No | `0.0.0.0` | `127.0.0.1` |
| `PORT` | integer | No | `8000` | `8080` |


### Option 1 : Docker :
- #### First, [install Docker](https://docs.docker.com/get-docker/).
Expand Down
6 changes: 5 additions & 1 deletion app/api/url_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
import os
from dotenv import load_dotenv
from app.llm_processing.extractions import extract_information
from app.api.validators import (
validate_age_order,
Expand All @@ -11,6 +13,8 @@
get_image_modality_termURL,
)

load_dotenv()


def get_api_url(user_query: str) -> str:
"""
Expand All @@ -22,7 +26,7 @@ def get_api_url(user_query: str) -> str:
Returns:
str: The constructed API URL.
"""
base_api_url = "https://api.neurobagel.org/query/?"
base_api_url = os.getenv("BASE_API_URL", "None")
llm_response = extract_information(user_query)

try:
Expand Down
1 change: 1 addition & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Start the Ollama services first
ollama serve &
ollama pull mistral &
ollama run mistral &

# Start the FastAPI application
Expand Down

0 comments on commit 457fb93

Please sign in to comment.