Spaces:
Sleeping
Sleeping
Commit
·
4569928
1
Parent(s):
f8848e8
fix bugs
Browse files- core/llm/llm.py +2 -2
- hf_app/app.py +7 -0
core/llm/llm.py
CHANGED
|
@@ -23,8 +23,8 @@ class LLM:
|
|
| 23 |
self.api_key = os.getenv('OPENAI_API_KEY')
|
| 24 |
self.api_base = "https://api.openai.com/v1/chat/completions"
|
| 25 |
|
| 26 |
-
if not self.api_key:
|
| 27 |
-
|
| 28 |
|
| 29 |
self.client = openai.Client(api_key=self.api_key, base_url=self.api_base)
|
| 30 |
|
|
|
|
| 23 |
self.api_key = os.getenv('OPENAI_API_KEY')
|
| 24 |
self.api_base = "https://api.openai.com/v1/chat/completions"
|
| 25 |
|
| 26 |
+
# if not self.api_key:
|
| 27 |
+
# raise ValueError('API key not found in environment variables')
|
| 28 |
|
| 29 |
self.client = openai.Client(api_key=self.api_key, base_url=self.api_base)
|
| 30 |
|
hf_app/app.py
CHANGED
|
@@ -160,6 +160,13 @@ def reset_stages():
|
|
| 160 |
|
| 161 |
def initialize_modeling_agent():
|
| 162 |
"""Initialize the ModelingAgentSystem with current configuration"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
# Create config for the agent system
|
| 164 |
agent_config = {
|
| 165 |
'top_method_num': 6,
|
|
|
|
| 160 |
|
| 161 |
def initialize_modeling_agent():
|
| 162 |
"""Initialize the ModelingAgentSystem with current configuration"""
|
| 163 |
+
# Check if API details are provided in session state first
|
| 164 |
+
if not st.session_state.api_base_url or not st.session_state.api_key or not st.session_state.api_model:
|
| 165 |
+
st.error("API Base URL, API Key, and Model Name must be configured before initializing the agent.")
|
| 166 |
+
st.session_state.modeling_agent = None
|
| 167 |
+
st.session_state.agent_initialized = False
|
| 168 |
+
return # Stop initialization if config is missing
|
| 169 |
+
|
| 170 |
# Create config for the agent system
|
| 171 |
agent_config = {
|
| 172 |
'top_method_num': 6,
|