Chad commited on
Commit ·
85f3f5b
1
Parent(s): 806374e
nwfbwfbwdwd
Browse files- appConfig.py +0 -28
appConfig.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
from groq import Groq
|
| 3 |
-
|
| 4 |
-
api_key = os.getenv("GROQ_API_KEY")
|
| 5 |
-
|
| 6 |
-
if not api_key:
|
| 7 |
-
raise ValueError("GROQ_API_KEY is not set. Please set it as an environment variable.")
|
| 8 |
-
|
| 9 |
-
client = Groq(api_key=api_key)
|
| 10 |
-
|
| 11 |
-
def liveChat(messages):
|
| 12 |
-
try:
|
| 13 |
-
completion = client.chat.completions.create(
|
| 14 |
-
model="llama3-70b-8192",
|
| 15 |
-
messages=messages,
|
| 16 |
-
temperature=0.7,
|
| 17 |
-
max_completion_tokens=512,
|
| 18 |
-
top_p=0.95,
|
| 19 |
-
stream=True,
|
| 20 |
-
stop=None,
|
| 21 |
-
)
|
| 22 |
-
except Exception as e:
|
| 23 |
-
yield f"Error: {e}"
|
| 24 |
-
return
|
| 25 |
-
|
| 26 |
-
for chunk in completion:
|
| 27 |
-
token = chunk.choices[0].delta.content or ""
|
| 28 |
-
yield token
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|