PD03 commited on
Commit
8622f42
·
verified ·
1 Parent(s): 01af39a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -93,7 +93,15 @@ class AIAssistant:
93
  """AI Assistant with MCP integration"""
94
 
95
  def __init__(self, openai_api_key: str, mcp_client: MCPClient):
96
- self.openai_client = openai.OpenAI(api_key=openai_api_key)
 
 
 
 
 
 
 
 
97
  self.mcp_client = mcp_client
98
  self.available_tools = []
99
 
 
93
  """AI Assistant with MCP integration"""
94
 
95
  def __init__(self, openai_api_key: str, mcp_client: MCPClient):
96
+ try:
97
+ self.openai_client = openai.OpenAI(
98
+ api_key=openai_api_key,
99
+ timeout=30.0
100
+ )
101
+ except Exception as e:
102
+ # Fallback for older OpenAI versions
103
+ openai.api_key = openai_api_key
104
+ self.openai_client = openai
105
  self.mcp_client = mcp_client
106
  self.available_tools = []
107