Spaces:
Sleeping
Sleeping
Commit ·
1911701
1
Parent(s): 6374b24
updated prompt, model
Browse files- core_logic.py +5 -6
core_logic.py
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
|
| 2 |
# ./core_logic.py -> Token-safe
|
| 3 |
|
| 4 |
-
"""
|
| 5 |
-
The Inference Engine - Where the "Technical Genius" persona lives. It uses the huggingface_hub InferenceClient to run the model without local CPU strain
|
| 6 |
-
"""
|
| 7 |
-
|
| 8 |
import os
|
| 9 |
from groq import Groq
|
| 10 |
from tools import web_search, parse_file
|
| 11 |
|
| 12 |
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Compressed for token efficiency
|
| 15 |
SYSTEM_PROMPT = (
|
|
@@ -51,7 +50,7 @@ def chat_function(message, history):
|
|
| 51 |
|
| 52 |
try:
|
| 53 |
completion = client.chat.completions.create(
|
| 54 |
-
model=
|
| 55 |
messages=messages,
|
| 56 |
stream=True,
|
| 57 |
temperature=0.2,
|
|
@@ -65,4 +64,4 @@ def chat_function(message, history):
|
|
| 65 |
response_text += token
|
| 66 |
yield response_text
|
| 67 |
except Exception as e:
|
| 68 |
-
yield f"
|
|
|
|
| 1 |
|
| 2 |
# ./core_logic.py -> Token-safe
|
| 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import os
|
| 5 |
from groq import Groq
|
| 6 |
from tools import web_search, parse_file
|
| 7 |
|
| 8 |
client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
| 9 |
+
model = "llama-3.1-70b-versatile"
|
| 10 |
+
#model = "mixtral-8x7b-32768"
|
| 11 |
+
#model = "llama-3.1-8b-instant"
|
| 12 |
|
| 13 |
# Compressed for token efficiency
|
| 14 |
SYSTEM_PROMPT = (
|
|
|
|
| 50 |
|
| 51 |
try:
|
| 52 |
completion = client.chat.completions.create(
|
| 53 |
+
model=model,
|
| 54 |
messages=messages,
|
| 55 |
stream=True,
|
| 56 |
temperature=0.2,
|
|
|
|
| 64 |
response_text += token
|
| 65 |
yield response_text
|
| 66 |
except Exception as e:
|
| 67 |
+
yield f"Error: {str(e)}"
|