arajshiva commited on
Commit
1e4a0c6
·
verified ·
1 Parent(s): 0922666

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -603,17 +603,12 @@ def filter_input_with_llama_guard(user_input, model="llama-guard-3-8b"):
603
 
604
  class NutritionBot:
605
  def __init__(self):
606
- """
607
- Initialize the NutritionBot class, setting up memory, the LLM client, tools, and the agent executor.
608
- """
609
-
610
- # Initialize a memory client to store and retrieve customer interactions
611
- #self.memory = MemoryClient(api_key=userdata.get("mem0")) # Complete the code to define the memory client API key
612
- self.memory = MemoryClient(api_key = os.environ["mem0"]) # Complete the code to define the memory client API key
613
- client = AsyncMemoryClient()
614
-
615
- # Initialize the Azure OpenAI client using the provided credentials
616
- self.client = AzureChatOpenAI(
617
  # model_name="_____", # Specify the model to use (e.g., GPT-4 optimized version)
618
  # api_key=config['_____'], # API key for authentication
619
  # azure_endpoint=config['_____'], # Endpoint URL for Azure OpenAI
@@ -624,9 +619,11 @@ class NutritionBot:
624
  azure_endpoint=config['AZURE_OPENAI_ENDPOINT'], # Endpoint URL for Azure OpenAI
625
  api_version=config['AZURE_OPENAI_APIVERSION'], # API version being used
626
  temperature=0 # Controls randomness in responses; 0 ensures deterministic results
627
- )
628
-
629
- # Define tools available to the chatbot, such as web search
 
 
630
  tools = [agentic_rag]
631
 
632
  # Define the system prompt to set the behavior of the chatbot
@@ -645,7 +642,7 @@ class NutritionBot:
645
 
646
  # Wrap the agent in an executor to manage tool interactions and execution flow
647
  self.agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
648
-
649
 
650
  def store_customer_interaction(self, user_id: str, message: str, response: str, metadata: Dict = None):
651
  """
 
603
 
604
  class NutritionBot:
605
  def __init__(self):
606
+ # Initialize a memory client to store and retrieve customer interactions
607
+ self..memory = MemoryClient(api_key = os.environ["mem0"]) # Complete the code to define the memory client API key
608
+ client = AsyncMemoryClient()
609
+ #self.memory = MemoryClient(api_key=userdata.get("mem0")) # Complete the code to define the memory client API key
610
+ # Initialize the Azure OpenAI client using the provided credentials
611
+ self.client = AzureChatOpenAI(
 
 
 
 
 
612
  # model_name="_____", # Specify the model to use (e.g., GPT-4 optimized version)
613
  # api_key=config['_____'], # API key for authentication
614
  # azure_endpoint=config['_____'], # Endpoint URL for Azure OpenAI
 
619
  azure_endpoint=config['AZURE_OPENAI_ENDPOINT'], # Endpoint URL for Azure OpenAI
620
  api_version=config['AZURE_OPENAI_APIVERSION'], # API version being used
621
  temperature=0 # Controls randomness in responses; 0 ensures deterministic results
622
+ )
623
+ """
624
+ Initialize the NutritionBot class, setting up memory, the LLM client, tools, and the agent executor.
625
+ """
626
+ # Define tools available to the chatbot, such as web search
627
  tools = [agentic_rag]
628
 
629
  # Define the system prompt to set the behavior of the chatbot
 
642
 
643
  # Wrap the agent in an executor to manage tool interactions and execution flow
644
  self.agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
645
+
646
 
647
  def store_customer_interaction(self, user_id: str, message: str, response: str, metadata: Dict = None):
648
  """