diff --git a/comps/cores/mega/micro_service.py b/comps/cores/mega/micro_service.py index 0f161b05b9..7afd7c4a24 100644 --- a/comps/cores/mega/micro_service.py +++ b/comps/cores/mega/micro_service.py @@ -3,18 +3,21 @@ import asyncio import multiprocessing -import requests import time from typing import Any, List, Optional, Type +import requests + from ..proto.docarray import TextDoc from .constants import ServiceRoleType, ServiceType -from .utils import check_ports_availability from .logger import CustomLogger +from .utils import check_ports_availability opea_microservices = {} logger = CustomLogger("micro-service") + + class MicroService: """MicroService class to create a microservice.""" @@ -56,7 +59,7 @@ def __init__( else: logger.info(f"LLM endpoint is ready - but error status code - {llm_endpoint}") success = True - + except requests.exceptions.RequestException as e: logger.info(f"Error: {e} - {llm_endpoint}") time.sleep(2.5) diff --git a/comps/llms/text-generation/vllm/llama_index/llm.py b/comps/llms/text-generation/vllm/llama_index/llm.py index 5df13f07f7..0111ea9fc6 100644 --- a/comps/llms/text-generation/vllm/llama_index/llm.py +++ b/comps/llms/text-generation/vllm/llama_index/llm.py @@ -38,7 +38,7 @@ def post_process_text(text: str): endpoint="/v1/chat/completions", host="0.0.0.0", port=9000, - llm_endpoint = os.getenv("vLLM_ENDPOINT", "http://localhost:8008"), + llm_endpoint=os.getenv("vLLM_ENDPOINT", "http://localhost:8008"), ) def llm_generate(input: LLMParamsDoc): if logflag: