Update generator/initialize_llm.py
Browse files- generator/initialize_llm.py +10 -2
generator/initialize_llm.py
CHANGED
@@ -3,7 +3,11 @@ import os
|
|
3 |
from langchain_groq import ChatGroq
|
4 |
|
5 |
def initialize_generation_llm(input_model_name):
|
6 |
-
os.
|
|
|
|
|
|
|
|
|
7 |
|
8 |
model_name = input_model_name
|
9 |
llm = ChatGroq(model=model_name, temperature=0.7)
|
@@ -13,7 +17,11 @@ def initialize_generation_llm(input_model_name):
|
|
13 |
return llm
|
14 |
|
15 |
def initialize_validation_llm(input_model_name):
|
16 |
-
os.
|
|
|
|
|
|
|
|
|
17 |
|
18 |
model_name = input_model_name
|
19 |
llm = ChatGroq(model=model_name, temperature=0.7)
|
|
|
3 |
from langchain_groq import ChatGroq
|
4 |
|
5 |
def initialize_generation_llm(input_model_name):
|
6 |
+
api_key = os.getenv("GROQ_API_KEY") # Fetch from environment
|
7 |
+
if not api_key:
|
8 |
+
raise ValueError("GROQ_API_KEY is not set. Please add it in Hugging Face Secrets.")
|
9 |
+
|
10 |
+
os.environ["GROQ_API_KEY"] = api_key # Explicitly set it
|
11 |
|
12 |
model_name = input_model_name
|
13 |
llm = ChatGroq(model=model_name, temperature=0.7)
|
|
|
17 |
return llm
|
18 |
|
19 |
def initialize_validation_llm(input_model_name):
|
20 |
+
api_key = os.getenv("GROQ_API_KEY") # Fetch from environment
|
21 |
+
if not api_key:
|
22 |
+
raise ValueError("GROQ_API_KEY is not set. Please add it in Hugging Face Secrets.")
|
23 |
+
|
24 |
+
os.environ["GROQ_API_KEY"] = api_key # Explicitly set it
|
25 |
|
26 |
model_name = input_model_name
|
27 |
llm = ChatGroq(model=model_name, temperature=0.7)
|