Update services/client.py
Browse files- services/client.py +4 -1
services/client.py
CHANGED
|
@@ -9,12 +9,15 @@ load_dotenv()
|
|
| 9 |
# constants
|
| 10 |
BASE_URL = "https://api.novita.ai/v3/openai"
|
| 11 |
MODEL_NAME = "meta-llama/llama-3.2-1b-instruct"
|
|
|
|
|
|
|
| 12 |
|
| 13 |
client = OpenAI(
|
| 14 |
base_url=BASE_URL,
|
| 15 |
-
api_key=
|
| 16 |
)
|
| 17 |
|
|
|
|
| 18 |
def generate_commented_code(code: str, max_token: int):
|
| 19 |
system_prompt = (
|
| 20 |
"You are a senior software engineer skilled in writing precise comments only. "
|
|
|
|
| 9 |
# constants
|
| 10 |
BASE_URL = "https://api.novita.ai/v3/openai"
|
| 11 |
MODEL_NAME = "meta-llama/llama-3.2-1b-instruct"
|
| 12 |
+
# Grab the key, but use a dummy string if missing so the server doesn't crash on boot
|
| 13 |
+
my_key = os.environ.get("NOVITA_API_KEY", "dummy_key")
|
| 14 |
|
| 15 |
client = OpenAI(
|
| 16 |
base_url=BASE_URL,
|
| 17 |
+
api_key=my_key,
|
| 18 |
)
|
| 19 |
|
| 20 |
+
|
| 21 |
def generate_commented_code(code: str, max_token: int):
|
| 22 |
system_prompt = (
|
| 23 |
"You are a senior software engineer skilled in writing precise comments only. "
|