adding llm
Browse files
.gradio/flagged/dataset1.csv
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
user_input,output,timestamp
|
| 2 |
+
,,2026-03-04 20:40:22.416508
|
src/llm/client.py
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dotenv import load_dotenv
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
load_dotenv(override=True)
|
| 4 |
+
|
| 5 |
+
import os
|
| 6 |
+
from groq import Groq
|
| 7 |
+
|
| 8 |
+
# Debug: print to confirm key is loaded
|
| 9 |
+
api_key = os.environ.get('GROQ_API_KEY')
|
| 10 |
+
|
| 11 |
+
def infer_model(msg, massages = []):
|
| 12 |
+
client = Groq(api_key=api_key)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
massages.append({"role":"user", "content": msg})
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
chat_completion = client.chat.completions.create(
|
| 19 |
+
messages=massages,
|
| 20 |
+
model="groq/compound",
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
return chat_completion, messages
|
| 24 |
+
|
| 25 |
+
msg = ""
|
| 26 |
+
messages = []
|
| 27 |
+
while(True):
|
| 28 |
+
msg = input("\nescreva: \n")
|
| 29 |
+
if msg == "quit":
|
| 30 |
+
break
|
| 31 |
+
out, messages = infer_model(msg, messages)
|
| 32 |
+
print(out.choices[0].message.content)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
{legacy/src/utils → src/tools/lore_relevent}/ami.py
RENAMED
|
File without changes
|