(model_path, typ: ClientType)
| 82 | # glm-4v-9b is not available in vLLM backend, use HFClient instead. |
| 83 | @st.cache_resource(max_entries=1, show_spinner="Loading model...") |
| 84 | def 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.") |
no test coverage detected