the
commited on
Update llm.py
Browse files
llm.py
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
from groq import Groq
|
| 3 |
-
from dotenv import load_dotenv
|
| 4 |
|
| 5 |
-
load_dotenv()
|
| 6 |
|
| 7 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 8 |
if not GROQ_API_KEY:
|
| 9 |
-
raise RuntimeError(
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
)
|
| 13 |
-
|
| 14 |
|
| 15 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 16 |
|
|
@@ -36,4 +35,4 @@ Question: {user_text}
|
|
| 36 |
stream=False,
|
| 37 |
stop=None,
|
| 38 |
)
|
| 39 |
-
return completion.choices[0].message.content
|
|
|
|
| 1 |
+
from dotenv import load_dotenv
|
| 2 |
import os
|
| 3 |
from groq import Groq
|
|
|
|
| 4 |
|
| 5 |
+
load_dotenv()
|
| 6 |
|
| 7 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 8 |
if not GROQ_API_KEY:
|
| 9 |
+
raise RuntimeError(
|
| 10 |
+
"GROQ_API_KEY environment variable not set. "
|
| 11 |
+
"Please set it to your Groq API key."
|
| 12 |
+
)
|
|
|
|
| 13 |
|
| 14 |
groq_client = Groq(api_key=GROQ_API_KEY)
|
| 15 |
|
|
|
|
| 35 |
stream=False,
|
| 36 |
stop=None,
|
| 37 |
)
|
| 38 |
+
return completion.choices[0].message.content
|