Talha812 commited on
Commit
4a0871d
·
verified ·
1 Parent(s): ee83229

Create llm.py

Browse files
Files changed (1) hide show
  1. llm.py +17 -0
llm.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from groq import Groq
3
+
4
+ client = Groq(
5
+ api_key=os.environ.get("GROQ_API_KEY")
6
+ )
7
+
8
+ def ask_llm(text):
9
+
10
+ response = client.chat.completions.create(
11
+ messages=[
12
+ {"role": "user", "content": text}
13
+ ],
14
+ model="llama-3.3-70b-versatile",
15
+ )
16
+
17
+ return response.choices[0].message.content