jenngang commited on
Commit
9010762
·
verified ·
1 Parent(s): 83c3edd

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -582,14 +582,19 @@ class NutritionBot:
582
  # temperature=0 # Controls randomness in responses; 0 ensures deterministic results
583
  #)
584
 
585
- self.client = ChatOpenAI(
586
- model="gpt-4o",
587
- temperature=0.0,
588
- streaming=False, # Explicitly disabling streaming
589
- api_key=my_api_key,
590
- openai_api_key=my_api_key,
591
- openai_api_base=endpoint
592
- )
 
 
 
 
 
593
 
594
  # Define tools available to the chatbot, such as web search
595
  tools = [agentic_rag]
 
582
  # temperature=0 # Controls randomness in responses; 0 ensures deterministic results
583
  #)
584
 
585
+ try:
586
+ self.client = ChatOpenAI(
587
+ #openai_api_base=endpoint,
588
+ model="gpt-4o",
589
+ temperature=0.0,
590
+ streaming=False, # Explicitly disabling streaming
591
+ api_key=my_api_key,
592
+ openai_api_key=my_api_key, # api_key
593
+ #openai_api_base=endpoint # api_key
594
+ )
595
+ except Exception as e:
596
+ print(f"Error with OpenAI: {str(e)}")
597
+ return None
598
 
599
  # Define tools available to the chatbot, such as web search
600
  tools = [agentic_rag]