From a836be0e66ad896f93b3ab55bd474c6006196ec8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 08:50:34 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- comps/cores/mega/gateway.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/comps/cores/mega/gateway.py b/comps/cores/mega/gateway.py index 0b1326e38..1f05bbc61 100644 --- a/comps/cores/mega/gateway.py +++ b/comps/cores/mega/gateway.py @@ -409,19 +409,19 @@ async def handle_request(self, request: Request): class DocSumGateway(Gateway): def __init__(self, megaservice, host="0.0.0.0", port=8888): super().__init__( - megaservice, - host, - port, - str(MegaServiceEndpoint.DOC_SUMMARY), - input_datatype= DocSumChatCompletionRequest, - output_datatype=ChatCompletionResponse + megaservice, + host, + port, + str(MegaServiceEndpoint.DOC_SUMMARY), + input_datatype=DocSumChatCompletionRequest, + output_datatype=ChatCompletionResponse, ) async def handle_request(self, request: Request): data = await request.json() stream_opt = data.get("stream", True) chat_request = ChatCompletionRequest.model_validate(data) - + prompt = self._handle_message(chat_request.messages) parameters = LLMParams( max_tokens=chat_request.max_tokens if chat_request.max_tokens else 1024, @@ -434,7 +434,7 @@ async def handle_request(self, request: Request): streaming=stream_opt, ) result_dict, runtime_graph = await self.megaservice.schedule( - initial_inputs={data['type']: prompt}, llm_parameters=parameters + initial_inputs={data["type"]: prompt}, llm_parameters=parameters ) for node, response in result_dict.items(): # Here it suppose the last microservice in the megaservice is LLM. @@ -458,7 +458,6 @@ async def handle_request(self, request: Request): return ChatCompletionResponse(model="docsum", choices=choices, usage=usage) - class AudioQnAGateway(Gateway): def __init__(self, megaservice, host="0.0.0.0", port=8888): super().__init__(