Spaces:
Running
Running
Commit ·
cf308ec
1
Parent(s): 1e910f8
updated llm
Browse files- core_logic.py +5 -0
- requirements.txt +1 -0
core_logic.py
CHANGED
|
@@ -8,6 +8,9 @@ The Inference Engine - Where the "Technical Genius" persona lives. It uses the h
|
|
| 8 |
import os
|
| 9 |
from huggingface_hub import InferenceClient
|
| 10 |
from tools import web_search, parse_file
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Recommended: Qwen2.5-Coder-32B or Llama-3.1-70B-Instruct
|
| 13 |
#client = InferenceClient("deepseek-ai/DeepSeek-V4-Pro", token=os.getenv("HF_TOKEN"))
|
|
@@ -65,6 +68,8 @@ def chat_function(message, history):
|
|
| 65 |
response_text = ""
|
| 66 |
try:
|
| 67 |
for chunk in client.chat_completion(messages, max_tokens=2048, stream=True, temperature=0.2):
|
|
|
|
|
|
|
| 68 |
# FIX: Check if choices exists and is not empty
|
| 69 |
if hasattr(chunk, 'choices') and len(chunk.choices) > 0:
|
| 70 |
token = chunk.choices[0].delta.content
|
|
|
|
| 8 |
import os
|
| 9 |
from huggingface_hub import InferenceClient
|
| 10 |
from tools import web_search, parse_file
|
| 11 |
+
from groq import Groq
|
| 12 |
+
|
| 13 |
+
#client = Groq(api_key=os.getenv("GROQ_API_KEY"))
|
| 14 |
|
| 15 |
# Recommended: Qwen2.5-Coder-32B or Llama-3.1-70B-Instruct
|
| 16 |
#client = InferenceClient("deepseek-ai/DeepSeek-V4-Pro", token=os.getenv("HF_TOKEN"))
|
|
|
|
| 68 |
response_text = ""
|
| 69 |
try:
|
| 70 |
for chunk in client.chat_completion(messages, max_tokens=2048, stream=True, temperature=0.2):
|
| 71 |
+
# --- Uncomment below for GROQ
|
| 72 |
+
#for chunk in client.chat.completions.create(model="llama-3.1-70b-versatile", messages=messages, max_tokens=2048, stream=True, temperature=0.2): # Or model="llama-3.1-8b-instant"
|
| 73 |
# FIX: Check if choices exists and is not empty
|
| 74 |
if hasattr(chunk, 'choices') and len(chunk.choices) > 0:
|
| 75 |
token = chunk.choices[0].delta.content
|
requirements.txt
CHANGED
|
@@ -6,3 +6,4 @@ pypdf
|
|
| 6 |
python-docx
|
| 7 |
pandas
|
| 8 |
tavily-python
|
|
|
|
|
|
| 6 |
python-docx
|
| 7 |
pandas
|
| 8 |
tavily-python
|
| 9 |
+
groq
|