Spaces:
Sleeping
Sleeping
File size: 784 Bytes
6848c8b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #%%
import os
from dotenv import load_dotenv
from groq import Groq
from langchain_groq import ChatGroq
def llm_base_client_init():
load_dotenv()
groq_key = os.getenv('GROQ_API_KEY')
client = Groq(api_key=groq_key)
return client
def llm_langchain_client_init(modelname="llama-3.1-8b-instant", temp=0.2):
'''
Initializes the LLM client using the langchain_groq package.
Parameters:
modelname (str): The name of the model to use. Other models: "meta-llama/llama-4-scout-17b-16e-instruct"
'''
load_dotenv()
groq_key = os.getenv('GROQ_API_KEY')
client = ChatGroq(
model=modelname,
temperature=temp,
max_tokens=None,
timeout=None,
max_retries=2,
api_key=groq_key
)
return client |