Spaces:
Sleeping
Sleeping
File size: 908 Bytes
ed65c68 5d970ca ed65c68 |
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 |
import os
import streamlit as st
from langchain_groq import ChatGroq
class GroqLLM:
def __init__(self, user_controls_input):
self.user_controls_input = user_controls_input
# print(f"#### self.user_controls_input : {self.user_controls_input}")
def get_llm_model(self):
try:
groq_api_key = self.user_controls_input["GROQ_API_KEY"]
selected_groq_model = self.user_controls_input["selected_groq_model"]
# print(f"$$$$ {groq_api_key == ""} {os.environ["GROQ_API_KEY"] == ""}")
# if groq_api_key == "" and os.environ["GROQ_API_KEY"] == "":
if groq_api_key == "":
st.error("Please Enter the Groq API KEY")
llm = ChatGroq(api_key=groq_api_key, model=selected_groq_model)
except Exception as e:
raise ValueError(f"Error Occurred with Exception : {e}")
return llm
|