File size: 1,060 Bytes
b58a992
026aeba
 
 
2889c96
129780c
 
 
 
 
2889c96
 
b58a992
2889c96
b58a992
2889c96
f7c2fa3
 
2889c96
129780c
 
 
 
 
2889c96
 
b58a992
2889c96
b58a992
2889c96
026aeba
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 logging
import os
from langchain_groq import ChatGroq

def initialize_generation_llm(input_model_name):
    api_key = os.getenv("GROQ_API_KEY")  # Fetch from environment
    if not api_key:
        raise ValueError("GROQ_API_KEY is not set. Please add it in Hugging Face Secrets.")
    
    os.environ["GROQ_API_KEY"] = api_key  # Explicitly set it
    
    model_name = input_model_name    
    llm = ChatGroq(model=model_name, temperature=0.7)
    llm.name = model_name
    logging.info(f'Generation LLM {model_name} initialized')
    
    return llm

def initialize_validation_llm(input_model_name):
    api_key = os.getenv("GROQ_API_KEY")  # Fetch from environment
    if not api_key:
        raise ValueError("GROQ_API_KEY is not set. Please add it in Hugging Face Secrets.")
    
    os.environ["GROQ_API_KEY"] = api_key  # Explicitly set it
    
    model_name = input_model_name      
    llm = ChatGroq(model=model_name, temperature=0.7)
    llm.name = model_name
    logging.info(f'Validation LLM {model_name} initialized')
    
    return llm