remove examples gateway. (#1250)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,7 @@ import os
|
||||
from io import BytesIO
|
||||
|
||||
import requests
|
||||
from comps import Gateway, MegaServiceEndpoint, MicroService, ServiceOrchestrator, ServiceType
|
||||
from comps import MegaServiceEndpoint, MicroService, ServiceOrchestrator, ServiceRoleType, ServiceType
|
||||
from comps.cores.proto.api_protocol import (
|
||||
ChatCompletionRequest,
|
||||
ChatCompletionResponse,
|
||||
@@ -29,7 +29,7 @@ LVM_SERVICE_HOST_IP = os.getenv("LVM_SERVICE_HOST_IP", "0.0.0.0")
|
||||
LVM_SERVICE_PORT = int(os.getenv("LVM_SERVICE_PORT", 9399))
|
||||
|
||||
|
||||
class MultimodalQnAService(Gateway):
|
||||
class MultimodalQnAService:
|
||||
asr_port = int(os.getenv("ASR_SERVICE_PORT", 3001))
|
||||
asr_endpoint = os.getenv("ASR_SERVICE_ENDPOINT", "http://0.0.0.0:{}/v1/audio/transcriptions".format(asr_port))
|
||||
|
||||
@@ -38,6 +38,7 @@ class MultimodalQnAService(Gateway):
|
||||
self.port = port
|
||||
self.lvm_megaservice = ServiceOrchestrator()
|
||||
self.megaservice = ServiceOrchestrator()
|
||||
self.endpoint = str(MegaServiceEndpoint.MULTIMODAL_QNA)
|
||||
|
||||
def add_remote_service(self):
|
||||
mm_embedding = MicroService(
|
||||
@@ -74,7 +75,6 @@ class MultimodalQnAService(Gateway):
|
||||
# for lvm megaservice
|
||||
self.lvm_megaservice.add(lvm)
|
||||
|
||||
# this overrides _handle_message method of Gateway
|
||||
def _handle_message(self, messages):
|
||||
images = []
|
||||
audios = []
|
||||
@@ -303,14 +303,17 @@ class MultimodalQnAService(Gateway):
|
||||
return ChatCompletionResponse(model="multimodalqna", choices=choices, usage=usage)
|
||||
|
||||
def start(self):
|
||||
super().__init__(
|
||||
megaservice=self.megaservice,
|
||||
self.service = MicroService(
|
||||
self.__class__.__name__,
|
||||
service_role=ServiceRoleType.MEGASERVICE,
|
||||
host=self.host,
|
||||
port=self.port,
|
||||
endpoint=str(MegaServiceEndpoint.MULTIMODAL_QNA),
|
||||
endpoint=self.endpoint,
|
||||
input_datatype=ChatCompletionRequest,
|
||||
output_datatype=ChatCompletionResponse,
|
||||
)
|
||||
self.service.add_route(self.endpoint, self.handle_request, methods=["POST"])
|
||||
self.service.start()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user