jdesiree commited on
Commit
b2186b2
·
verified ·
1 Parent(s): 807c4b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -12,6 +12,9 @@ import logging
12
  import re
13
  import json
14
  from datetime import datetime
 
 
 
15
  from typing import Annotated, Sequence, TypedDict, List, Optional, Any, Type
16
  from pydantic import BaseModel, Field
17
 
@@ -62,7 +65,6 @@ metrics_logger = setup_metrics_logger()
62
 
63
  def log_metric(message):
64
  """Log a human-readable metric message with automatic timestamp"""
65
- current_time = datetime.now()
66
  timestamped_message = f"{message} | Logged: {current_time:%Y-%m-%d %H:%M:%S}"
67
  metrics_logger.info(timestamped_message)
68
  logger.info(timestamped_message) # Also log to console using info.logger
@@ -264,7 +266,6 @@ class Qwen25SmallLLM(Runnable):
264
  super().__init__()
265
  logger.info(f"Loading model: {model_path} (use_4bit={use_4bit})")
266
  start_Loading_Model_time = time.perf_counter()
267
- current_time = datetime.now()
268
 
269
  try:
270
  # Load tokenizer
@@ -370,7 +371,6 @@ class Educational_Agent:
370
 
371
  def __init__(self):
372
  start_init_and_langgraph_time = time.perf_counter()
373
- current_time = datetime.now()
374
 
375
  self.llm = Qwen25SmallLLM(model_path="Qwen/Qwen2.5-1.5B-Instruct", use_4bit=True)
376
  self.tool_decision_engine = Tool_Decision_Engine(self.llm)
@@ -407,7 +407,6 @@ class Educational_Agent:
407
  def call_model(state: EducationalAgentState) -> dict:
408
  """Call the model with tool decision logic"""
409
  start_call_model_time = time.perf_counter()
410
- current_time = datetime.now()
411
 
412
  messages = state["messages"]
413
 
@@ -504,7 +503,6 @@ Otherwise, provide a regular educational response.
504
  def handle_tools(state: EducationalAgentState) -> dict:
505
  """Handle tool execution"""
506
  start_handle_tools_time = time.perf_counter()
507
- current_time = datetime.now()
508
 
509
  try:
510
  messages = state["messages"]
@@ -575,9 +573,7 @@ Otherwise, provide a regular educational response.
575
 
576
  def chat(self, message: str, thread_id: str = "default") -> str:
577
  """Main chat interface"""
578
- start_chat_time = time.perf_counter()
579
- current_time = datetime.now()
580
-
581
  try:
582
  config = {"configurable": {"thread_id": thread_id}}
583
 
 
12
  import re
13
  import json
14
  from datetime import datetime
15
+
16
+ current_time = datetime.now()
17
+
18
  from typing import Annotated, Sequence, TypedDict, List, Optional, Any, Type
19
  from pydantic import BaseModel, Field
20
 
 
65
 
66
  def log_metric(message):
67
  """Log a human-readable metric message with automatic timestamp"""
 
68
  timestamped_message = f"{message} | Logged: {current_time:%Y-%m-%d %H:%M:%S}"
69
  metrics_logger.info(timestamped_message)
70
  logger.info(timestamped_message) # Also log to console using info.logger
 
266
  super().__init__()
267
  logger.info(f"Loading model: {model_path} (use_4bit={use_4bit})")
268
  start_Loading_Model_time = time.perf_counter()
 
269
 
270
  try:
271
  # Load tokenizer
 
371
 
372
  def __init__(self):
373
  start_init_and_langgraph_time = time.perf_counter()
 
374
 
375
  self.llm = Qwen25SmallLLM(model_path="Qwen/Qwen2.5-1.5B-Instruct", use_4bit=True)
376
  self.tool_decision_engine = Tool_Decision_Engine(self.llm)
 
407
  def call_model(state: EducationalAgentState) -> dict:
408
  """Call the model with tool decision logic"""
409
  start_call_model_time = time.perf_counter()
 
410
 
411
  messages = state["messages"]
412
 
 
503
  def handle_tools(state: EducationalAgentState) -> dict:
504
  """Handle tool execution"""
505
  start_handle_tools_time = time.perf_counter()
 
506
 
507
  try:
508
  messages = state["messages"]
 
573
 
574
  def chat(self, message: str, thread_id: str = "default") -> str:
575
  """Main chat interface"""
576
+ start_chat_time = time.perf_counter()
 
 
577
  try:
578
  config = {"configurable": {"thread_id": thread_id}}
579