API: Move OpenAI-compatible API from extensions/openai to modules/api

This commit is contained in:
oobabooga 2026-03-20 14:46:00 -03:00
parent 2e4232e02b
commit bf6fbc019d
23 changed files with 51 additions and 65 deletions

9
modules/api/logits.py Normal file
View file

@ -0,0 +1,9 @@
from .completions import process_parameters
from modules.logits import get_next_logits
def _get_next_logits(body):
# Pre-process the input payload to simulate a real generation
use_samplers = body['use_samplers']
state = process_parameters(body)
return get_next_logits(body['prompt'], state, use_samplers, "", top_logits=body['top_logits'], return_dict=True)