Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,27 +24,6 @@ import tempfile
|
|
24 |
# API Key
|
25 |
os.environ["GROQ_API_KEY"] = st.secrets.get("GROQ_API_KEY", "")
|
26 |
|
27 |
-
# Initialize LLM
|
28 |
-
class LLMCallbackHandler(BaseCallbackHandler):
|
29 |
-
def __init__(self, log_path: Path):
|
30 |
-
self.log_path = log_path
|
31 |
-
|
32 |
-
def on_llm_start(self, serialized, prompts, **kwargs):
|
33 |
-
with self.log_path.open("a", encoding="utf-8") as file:
|
34 |
-
file.write(json.dumps({"event": "llm_start", "text": prompts[0], "timestamp": datetime.now().isoformat()}) + "\n")
|
35 |
-
|
36 |
-
def on_llm_end(self, response: LLMResult, **kwargs):
|
37 |
-
generation = response.generations[-1][-1].message.content
|
38 |
-
with self.log_path.open("a", encoding="utf-8") as file:
|
39 |
-
file.write(json.dumps({"event": "llm_end", "text": generation, "timestamp": datetime.now().isoformat()}) + "\n")
|
40 |
-
|
41 |
-
#llm = ChatGroq(
|
42 |
-
# temperature=0,
|
43 |
-
# model_name="groq/llama-3.3-70b-versatile",
|
44 |
-
# max_tokens=100,
|
45 |
-
# callbacks=[LLMCallbackHandler(Path("prompts.jsonl"))],
|
46 |
-
#)
|
47 |
-
|
48 |
st.title("Blah Blah App Using CrewAI π")
|
49 |
st.write("Analyze datasets using natural language queries powered by SQL and CrewAI.")
|
50 |
|
|
|
24 |
# API Key
|
25 |
os.environ["GROQ_API_KEY"] = st.secrets.get("GROQ_API_KEY", "")
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
st.title("Blah Blah App Using CrewAI π")
|
28 |
st.write("Analyze datasets using natural language queries powered by SQL and CrewAI.")
|
29 |
|