Spaces:
Running
Running
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
@@ -582,14 +582,19 @@ class NutritionBot:
|
|
582 |
# temperature=0 # Controls randomness in responses; 0 ensures deterministic results
|
583 |
#)
|
584 |
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
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]
|