Update app.py
Browse files
app.py
CHANGED
@@ -54,7 +54,7 @@ global_data = {
|
|
54 |
'eot': {},
|
55 |
'eom': {},
|
56 |
'lf': {},
|
57 |
-
'max_tokens':
|
58 |
'tokenizers': {},
|
59 |
'model_params': {},
|
60 |
'model_size': {},
|
@@ -252,6 +252,7 @@ model_configs = [
|
|
252 |
"name": "Meta-Llama-3.1-70B"
|
253 |
}
|
254 |
]
|
|
|
255 |
class ModelManager:
|
256 |
def __init__(self):
|
257 |
self.models = {}
|
@@ -307,7 +308,7 @@ def cache_response(func):
|
|
307 |
@cache_response
|
308 |
def generate_model_response(model, inputs):
|
309 |
try:
|
310 |
-
response = model(inputs)
|
311 |
return remove_duplicates(response['choices'][0]['text'])
|
312 |
except Exception as e:
|
313 |
return ""
|
@@ -331,9 +332,7 @@ async def process_message(message):
|
|
331 |
for model_name, future in zip(global_data['models'].keys(), as_completed(futures))
|
332 |
]
|
333 |
unique_responses = remove_repetitive_responses(responses)
|
334 |
-
formatted_response =
|
335 |
-
for model, response in unique_responses.items():
|
336 |
-
formatted_response += f"**{model}:**\n{response}\n\n"
|
337 |
return formatted_response
|
338 |
|
339 |
app = FastAPI()
|
|
|
54 |
'eot': {},
|
55 |
'eom': {},
|
56 |
'lf': {},
|
57 |
+
'max_tokens': {},
|
58 |
'tokenizers': {},
|
59 |
'model_params': {},
|
60 |
'model_size': {},
|
|
|
252 |
"name": "Meta-Llama-3.1-70B"
|
253 |
}
|
254 |
]
|
255 |
+
|
256 |
class ModelManager:
|
257 |
def __init__(self):
|
258 |
self.models = {}
|
|
|
308 |
@cache_response
|
309 |
def generate_model_response(model, inputs):
|
310 |
try:
|
311 |
+
response = model(inputs, max_tokens=9999999)
|
312 |
return remove_duplicates(response['choices'][0]['text'])
|
313 |
except Exception as e:
|
314 |
return ""
|
|
|
332 |
for model_name, future in zip(global_data['models'].keys(), as_completed(futures))
|
333 |
]
|
334 |
unique_responses = remove_repetitive_responses(responses)
|
335 |
+
formatted_response = next(iter(unique_responses.values())) # Get a single response
|
|
|
|
|
336 |
return formatted_response
|
337 |
|
338 |
app = FastAPI()
|