DrishtiSharma commited on
Commit
9ecee75
·
verified ·
1 Parent(s): d2ddd9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -2
app.py CHANGED
@@ -13,6 +13,26 @@ import logging
13
  # Setup logging
14
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  # Title and Application Introduction
17
  st.title("Patent Strategy and Innovation Consultant")
18
  st.sidebar.write(
@@ -51,8 +71,6 @@ with st.sidebar.expander("Customize Agent Goals", expanded=False):
51
  writer_goal = "Craft a professional insights document summarizing trends, strategies, and actionable outcomes for stakeholders."
52
  analyst_goal = "Perform detailed statistical analysis of patent filings, growth trends, and innovation distribution."
53
 
54
- # LLM Initialization
55
- llm = ChatGroq(groq_api_key=os.getenv("GROQ_API_KEY"), model="groq/llama-3.3-70b-versatile")
56
 
57
  # Agent Definitions
58
  planner = Agent(
 
13
  # Setup logging
14
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
15
 
16
+ # API Key Validation and LLM Initialization
17
+ groq_api_key = os.getenv("GROQ_API_KEY")
18
+ openai_api_key = os.getenv("OPENAI_API_KEY")
19
+
20
+ #llm = ChatGroq(groq_api_key=os.getenv("GROQ_API_KEY"), model="groq/llama-3.3-70b-versatile")
21
+
22
+ if model_choice == "Groq":
23
+ if not groq_api_key:
24
+ st.error("Groq API key is missing. Please set the GROQ_API_KEY environment variable.")
25
+ llm = None
26
+ else:
27
+ llm = ChatGroq(groq_api_key=groq_api_key, model="groq/llama-3.3-70b-versatile")
28
+ elif model_choice == "OpenAI":
29
+ if not openai_api_key:
30
+ st.error("OpenAI API key is missing. Please set the OPENAI_API_KEY environment variable.")
31
+ llm = None
32
+ else:
33
+ llm = ChatOpenAI(api_key=openai_api_key, model="gpt-4o")
34
+
35
+
36
  # Title and Application Introduction
37
  st.title("Patent Strategy and Innovation Consultant")
38
  st.sidebar.write(
 
71
  writer_goal = "Craft a professional insights document summarizing trends, strategies, and actionable outcomes for stakeholders."
72
  analyst_goal = "Perform detailed statistical analysis of patent filings, growth trends, and innovation distribution."
73
 
 
 
74
 
75
  # Agent Definitions
76
  planner = Agent(