MarcosFRGames commited on
Commit
97d7801
verified
1 Parent(s): 41ca8d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -272,6 +272,7 @@ def generate_endpoint(user_message):
272
  system_instruction = request.args.get('system', '')
273
  temperature = float(request.args.get('temperature', 0.7))
274
  top_p = float(request.args.get('top_p', 0.95))
 
275
  model_name = request.args.get('model', MODELS[0]["name"])
276
  max_tokens = int(request.args.get('max_tokens', MAX_GENERATION_TOKENS))
277
 
@@ -289,7 +290,13 @@ def generate_endpoint(user_message):
289
  status=400,
290
  mimetype='text/plain'
291
  )
292
-
 
 
 
 
 
 
293
  # Limitar max_tokens a la configuraci贸n m谩xima
294
  if max_tokens > MAX_GENERATION_TOKENS:
295
  max_tokens = MAX_GENERATION_TOKENS
 
272
  system_instruction = request.args.get('system', '')
273
  temperature = float(request.args.get('temperature', 0.7))
274
  top_p = float(request.args.get('top_p', 0.95))
275
+ top_k = int(request.args.get('top_k', 40))
276
  model_name = request.args.get('model', MODELS[0]["name"])
277
  max_tokens = int(request.args.get('max_tokens', MAX_GENERATION_TOKENS))
278
 
 
290
  status=400,
291
  mimetype='text/plain'
292
  )
293
+
294
+ if top_k:
295
+ try:
296
+ kwargs["top_k"] = int(top_k)
297
+ except ValueError:
298
+ return Response("Error: top_k debe ser n煤mero entero", status=400)
299
+
300
  # Limitar max_tokens a la configuraci贸n m谩xima
301
  if max_tokens > MAX_GENERATION_TOKENS:
302
  max_tokens = MAX_GENERATION_TOKENS