Hammad712 commited on
Commit
550e28f
·
verified ·
1 Parent(s): 950e966

Create llm.py

Browse files
Files changed (1) hide show
  1. llm.py +19 -0
llm.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from langchain_groq import ChatGroq
3
+
4
+ def get_llm():
5
+ """
6
+ Returns the language model instance (LLM) using ChatGroq API.
7
+ The LLM used is Llama 3.3 with a versatile 70 billion parameter model.
8
+ """
9
+ api_key = os.getenv("CHAT_GROQ_API_KEY")
10
+ if not api_key:
11
+ raise ValueError("Please set the CHAT_GROQ_API_KEY environment variable.")
12
+
13
+ llm = ChatGroq(
14
+ model="llama-3.3-70b-versatile",
15
+ temperature=0,
16
+ max_tokens=1024,
17
+ api_key=api_key
18
+ )
19
+ return llm