Update app.py
Browse files
app.py
CHANGED
|
@@ -604,12 +604,19 @@ class NutritionBot:
|
|
| 604 |
# os.environ['OPENAI_API_KEY'] = config.get("API_KEY")
|
| 605 |
# os.environ['OPENAI_API_BASE'] = config.get("OPENAI_API_BASE")
|
| 606 |
|
| 607 |
-
# Use the proper OpenAI client
|
| 608 |
-
self.client = OpenAI(
|
| 609 |
-
api_key=os.environ["API_KEY"],
|
| 610 |
-
base_url=os.environ["API_BASE"]
|
| 611 |
-
)
|
| 612 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 613 |
# Define tools available to the chatbot, such as web search
|
| 614 |
tools = [agentic_rag]
|
| 615 |
|
|
|
|
| 604 |
# os.environ['OPENAI_API_KEY'] = config.get("API_KEY")
|
| 605 |
# os.environ['OPENAI_API_BASE'] = config.get("OPENAI_API_BASE")
|
| 606 |
|
| 607 |
+
# # Use the proper OpenAI client
|
| 608 |
+
# self.client = OpenAI(
|
| 609 |
+
# api_key=os.environ["API_KEY"],
|
| 610 |
+
# base_url=os.environ["API_BASE"]
|
| 611 |
+
# )
|
| 612 |
|
| 613 |
+
# Initialize the ChatOpenAI client from LangChain
|
| 614 |
+
self.client = ChatOpenAI(
|
| 615 |
+
model="gpt-4o-mini", # Specify the model to use
|
| 616 |
+
openai_api_key=api_key, # Use the api_key from the setup section
|
| 617 |
+
openai_api_base=endpoint, # Use the endpoint from the setup section
|
| 618 |
+
temperature=0 # Controls randomness in responses; 0 ensures deterministic results
|
| 619 |
+
)
|
| 620 |
# Define tools available to the chatbot, such as web search
|
| 621 |
tools = [agentic_rag]
|
| 622 |
|