Skip to content

Commit cbd2239

Browse files
authored
Merge pull request #138 from AET-DevOps25/feature/adjust-genai-env
Adjust env file path for genai
2 parents f5620a8 + 2bb6a1d commit cbd2239

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

.env.template

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# To run this project with docker compose, you need a `.env` file with the following variables set.
1+
# To run this project with docker compose, you need a `.env` file with the following 4 variables set.
22

33
BASE_URL="https://gpu.aet.cit.tum.de"
44
GITLAB_CLIENT_SECRET="" # see https://rancher.ase.cit.tum.de/dashboard/c/c-m-nhcfjg9h/explorer/secret/team-continuous-disappointment/server-secret#data gitlab-client-secret-dev
55
API_OPENAI="" # see https://rancher.ase.cit.tum.de/dashboard/c/c-m-nhcfjg9h/explorer/secret/team-continuous-disappointment/genai-secret#data
6-
API_OPENWEBUI="" # see https://rancher.ase.cit.tum.de/dashboard/c/c-m-nhcfjg9h/explorer/secret/team-continuous-disappointment/genai-secret#data
6+
API_OPENWEBUI="" # see https://rancher.ase.cit.tum.de/dashboard/c/c-m-nhcfjg9h/explorer/secret/team-continuous-disappointment/genai-secret#data
7+
8+
# If you want to use cloud LLM models, you need to include your respective api keys (our openai key is already in rancher)
9+
10+
API_OPENAI="" # see https://rancher.ase.cit.tum.de/dashboard/c/c-m-nhcfjg9h/explorer/secret/team-continuous-disappointment/genai-secret#data
11+
API_ANTHROPIC="" # your anthropic key
12+
API_MISTRAL="" # your mistral key
13+
API_HUGGINGFACEHUB="" # your huggingface api token

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ embeddings = OpenAIEmbeddings(
307307
)
308308
```
309309

310-
##### Environment Variables
310+
##### Environment Variables for GenAI
311311

312312
- If you want to use cloud and local based LLM models, you need to set the respective api key in your `.env` file. Required `.env` variables:
313313

@@ -322,6 +322,7 @@ API_OPENWEBUI="your openwebui key"
322322
# Base URL for calling local models
323323
BASE_URL="base url where openwebui is hosted"
324324
```
325+
- However, you do not need to set all of these fields in your `.env` file. To run the GenAI module, you need at least the API_OPENAI, API_OPENWEBUI, and BASE_URL variables. You can find more information in the [.env.template](.env.template) file.
325326

326327
- Example for Cloud LLM Models (defined in `genai/routes/routes.py`):
327328

genai/.env.template

Lines changed: 0 additions & 9 deletions
This file was deleted.

genai/config.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
from collections import namedtuple
21
from os import environ, path
2+
from collections import namedtuple
33
from dotenv import load_dotenv
44

55
basedir = path.abspath(path.dirname(__file__))
6-
load_dotenv(path.join(basedir, ".env"))
6+
parent_dir = path.dirname(basedir)
7+
load_dotenv(path.join(parent_dir, ".env"))
78

89
ConfigT = namedtuple(
910
"Config",
@@ -18,10 +19,10 @@
1819
)
1920

2021
Config = ConfigT(
21-
api_key_openai=environ.get("API_OPENAI"),
22+
api_key_openai=environ.get("API_OPENAI", ""),
2223
api_key_anthropic=environ.get("API_ANTHROPIC", ""),
2324
api_key_mistral=environ.get("API_MISTRAL", ""),
2425
api_key_huggingface=environ.get("API_HUGGINGFACE", ""),
25-
api_key_openwebui=environ.get("API_OPENWEBUI"),
26-
base_url=environ.get("BASE_URL")
26+
api_key_openwebui=environ.get("API_OPENWEBUI", ""),
27+
base_url=environ.get("BASE_URL", "")
2728
)

0 commit comments

Comments
 (0)