wakeupmh commited on
Commit
9b85f94
·
1 Parent(s): e191b2f

fix: audio

Browse files
Files changed (1) hide show
  1. services/model_handler.py +19 -0
services/model_handler.py CHANGED
@@ -6,6 +6,8 @@ from agno.tools.arxiv import ArxivTools
6
  from agno.tools.pubmed import PubmedTools
7
  from agno.models.base import Model
8
  from tenacity import retry, stop_after_attempt, wait_exponential
 
 
9
 
10
  MODEL_PATH = "google/flan-t5-small"
11
 
@@ -20,6 +22,23 @@ class Response:
20
  self.metadata = {} # Add metadata attribute
21
  self.finish_reason = "stop" # Add finish_reason attribute
22
  self.usage = {"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0} # Add usage attribute
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  def __str__(self):
25
  return self.content
 
6
  from agno.tools.pubmed import PubmedTools
7
  from agno.models.base import Model
8
  from tenacity import retry, stop_after_attempt, wait_exponential
9
+ import time
10
+ import datetime
11
 
12
  MODEL_PATH = "google/flan-t5-small"
13
 
 
22
  self.metadata = {} # Add metadata attribute
23
  self.finish_reason = "stop" # Add finish_reason attribute
24
  self.usage = {"prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0} # Add usage attribute
25
+
26
+ # Add timestamp attributes
27
+ current_time = time.time()
28
+ self.created_at = current_time
29
+ self.created = int(current_time)
30
+ self.timestamp = datetime.datetime.now().isoformat()
31
+
32
+ # Add model info attributes
33
+ self.id = "local-model-response"
34
+ self.model = "local-huggingface"
35
+ self.object = "chat.completion"
36
+ self.choices = [{"index": 0, "message": {"role": "assistant", "content": content}, "finish_reason": "stop"}]
37
+
38
+ # Add additional attributes that might be needed
39
+ self.system_fingerprint = ""
40
+ self.is_truncated = False
41
+ self.role = "assistant"
42
 
43
  def __str__(self):
44
  return self.content