Oleg Lavrovsky commited on
Commit
57411e2
·
unverified ·
1 Parent(s): f8c7edf

Process response length

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -110,8 +110,14 @@ def fit_to_length(text, min_length=3, max_length=100):
110
  return None
111
  return text
112
 
 
 
 
 
 
113
 
114
- def get_model_reponse(messages_think):
 
115
  """Process the text content."""
116
 
117
  # Prepare the model input
@@ -148,7 +154,9 @@ async def completion(data: Completion):
148
  raise HTTPException(status_code=503, detail="Model not loaded")
149
 
150
  try:
151
- result = get_model_reponse(data)
 
 
152
 
153
  return {
154
  "choices": [
 
110
  return None
111
  return text
112
 
113
+ def get_completion_text(messages_think: List[ChatMessage]):
114
+ txt = ""
115
+ for cm in messages_think:
116
+ txt = " ".join((txt, cm.content))
117
+ return txt
118
 
119
+
120
+ def get_model_reponse(messages_think: List[ChatMessage]):
121
  """Process the text content."""
122
 
123
  # Prepare the model input
 
154
  raise HTTPException(status_code=503, detail="Model not loaded")
155
 
156
  try:
157
+ mt = data.messages_think
158
+ text = get_completion_text(mt)
159
+ result = get_model_reponse(mt)
160
 
161
  return {
162
  "choices": [