new features
This commit is contained in:
@@ -24,6 +24,17 @@ class Handler(BaseHTTPRequestHandler):
|
||||
message = self.body()
|
||||
method = message.get('method')
|
||||
args = message.get('params', {})
|
||||
if self.path == '/benchmark/v1/chat/completions':
|
||||
valid = (message.get('stream') is True and message.get('model') == 'fixture-model'
|
||||
and message.get('temperature') == 0 and message.get('max_tokens') == 128
|
||||
and len(message.get('messages', [])) == 1
|
||||
and 'garden' in message['messages'][0]['content'])
|
||||
if not valid:
|
||||
self.reply(400)
|
||||
return
|
||||
frame = {'choices': [{'delta': {'content': 'Benchmark reply'}}]}
|
||||
self.reply(200, f'data: {json.dumps(frame)}\n\ndata: [DONE]\n\n'.encode(), 'text/event-stream')
|
||||
return
|
||||
if self.path == '/compatible/v1/chat/completions':
|
||||
if self.headers.get('Authorization') != 'Bearer fixture-token':
|
||||
self.reply(401)
|
||||
|
||||
Reference in New Issue
Block a user