Etash Guha commited on
Commit
fe10ec9
1 Parent(s): 6055e2f
Files changed (1) hide show
  1. generators/model.py +2 -3
generators/model.py CHANGED
@@ -126,7 +126,7 @@ class Samba():
126
 
127
  for i in range(num_comps):
128
  payload = {
129
- "inputs": messages,
130
  "params": {
131
  "max_tokens_allowed_in_completion": {"type": "int", "value": 500},
132
  "min_token_capacity_for_completion": {"type": "int", "value": 2},
@@ -143,7 +143,6 @@ class Samba():
143
  "Content-Type": "application/json"
144
  }
145
  post_response = requests.post(f'https://{url}/api/v1/chat/completion', json=payload, headers=headers, stream=True)
146
-
147
  response_text = ""
148
  for line in post_response.iter_lines():
149
  if line.startswith(b"data: "):
@@ -155,7 +154,7 @@ class Samba():
155
  response_text += content
156
  except json.JSONDecodeError as e:
157
  pass
158
-
159
  if num_comps == 1:
160
  return resps[0]
161
  else:
 
126
 
127
  for i in range(num_comps):
128
  payload = {
129
+ "inputs": [dataclasses.asdict(message) for message in messages],
130
  "params": {
131
  "max_tokens_allowed_in_completion": {"type": "int", "value": 500},
132
  "min_token_capacity_for_completion": {"type": "int", "value": 2},
 
143
  "Content-Type": "application/json"
144
  }
145
  post_response = requests.post(f'https://{url}/api/v1/chat/completion', json=payload, headers=headers, stream=True)
 
146
  response_text = ""
147
  for line in post_response.iter_lines():
148
  if line.startswith(b"data: "):
 
154
  response_text += content
155
  except json.JSONDecodeError as e:
156
  pass
157
+ resps.append(response_text)
158
  if num_comps == 1:
159
  return resps[0]
160
  else: