MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / __init__

Method __init__

camel/models/sglang_model.py:56–87  ·  view source on GitHub ↗
(
        self,
        model_type: Union[ModelType, str],
        model_config_dict: Optional[Dict[str, Any]] = None,
        api_key: Optional[str] = None,
        url: Optional[str] = None,
        token_counter: Optional[BaseTokenCounter] = None,
    )

Source from the content-addressed store, hash-verified

54 """
55
56 def __init__(
57 self,
58 model_type: Union[ModelType, str],
59 model_config_dict: Optional[Dict[str, Any]] = None,
60 api_key: Optional[str] = None,
61 url: Optional[str] = None,
62 token_counter: Optional[BaseTokenCounter] = None,
63 ) -> None:
64 if model_config_dict is None:
65 model_config_dict = SGLangConfig().as_dict()
66
67 self.server_process = None
68 self.last_run_time: Optional[float] = (
69 None # Will be set when the server starts
70 )
71 self._lock = threading.Lock()
72 self._inactivity_thread: Optional[threading.Thread] = None
73
74 super().__init__(
75 model_type, model_config_dict, api_key, url, token_counter
76 )
77
78 self._client = None
79
80 if self._url:
81 # Initialize the client if an existing URL is provided
82 self._client = OpenAI(
83 timeout=180,
84 max_retries=3,
85 api_key="Set-but-ignored", # required but ignored
86 base_url=self._url,
87 )
88
89 def _start_server(self) -> None:
90 from sglang.utils import ( # type: ignore[import-untyped]

Callers

nothing calls this directly

Calls 2

SGLangConfigClass · 0.90
as_dictMethod · 0.45

Tested by

no test coverage detected