MCPcopy
hub / github.com/zai-org/GLM-4 / get_client

Function get_client

demo/composite_demo/src/client.py:84–102  ·  view source on GitHub ↗
(model_path, typ: ClientType)

Source from the content-addressed store, hash-verified

82# glm-4v-9b is not available in vLLM backend, use HFClient instead.
83@st.cache_resource(max_entries=1, show_spinner="Loading model...")
84def get_client(model_path, typ: ClientType) -> Client:
85 match typ:
86 case ClientType.HF:
87 from clients.hf import HFClient
88
89 return HFClient(model_path)
90 case ClientType.VLLM:
91 try:
92 from clients.vllm import VLLMClient
93 except ImportError as e:
94 e.msg += "; did you forget to install vLLM?"
95 raise
96 return VLLMClient(model_path)
97 case ClientType.API:
98 from clients.openai import APIClient
99
100 return APIClient(model_path)
101
102 raise NotImplementedError(f"Client type {typ} is not supported.")

Callers 1

build_clientFunction · 0.90

Calls 3

HFClientClass · 0.90
VLLMClientClass · 0.90
APIClientClass · 0.90

Tested by

no test coverage detected