OjciecTadeusz commited on
Commit
a97e214
·
verified ·
1 Parent(s): 8d5e1fd

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -8
main.py CHANGED
@@ -50,18 +50,21 @@ def generate(item: Item):
50
  details=item.details,
51
  return_full_text=item.return_full_text
52
  )
53
- return stream
54
- # output = ""
55
 
56
- # for response in stream:
57
- # Check if response has the attribute 'token'
58
 
59
- # if hasattr(response, 'tokens'):
60
- # output += response.tokens.text
61
- # else:
62
- # output += response # If not, treat it as a string
 
 
63
  # return output
64
 
 
65
  # def generate(item: Item):
66
  # temperature = float(item.temperature)
67
  # if temperature < 1e-2:
 
50
  details=item.details,
51
  return_full_text=item.return_full_text
52
  )
53
+ # return stream
54
+ output = ""
55
 
56
+ for response in stream:
57
+ Check if response has the attribute 'token'
58
 
59
+ if hasattr(response, 'tokens'):
60
+ output += response.token.text
61
+ else:
62
+ output += response # If not, treat it as a string
63
+
64
+ return ['msg': output]
65
  # return output
66
 
67
+
68
  # def generate(item: Item):
69
  # temperature = float(item.temperature)
70
  # if temperature < 1e-2: