|
8 | 8 | from pydantic import Field, SecretStr, model_validator |
9 | 9 | from pydantic_settings import SettingsConfigDict |
10 | 10 | from uipath._cli._auth._auth_service import AuthService |
| 11 | +from uipath.utils import EndpointManager |
11 | 12 |
|
12 | | -from uipath_llm_client.settings.agenthub.utils import AgentHubEndpoints |
13 | 13 | from uipath_llm_client.settings.base import UiPathAPIConfig, UiPathBaseSettings |
14 | 14 |
|
15 | 15 |
|
@@ -99,13 +99,16 @@ def build_base_url( |
99 | 99 | api_config: UiPathAPIConfig | None = None, |
100 | 100 | ) -> str: |
101 | 101 | """Build the base URL for API requests.""" |
102 | | - if api_config is not None and api_config.client_type == "normalized": |
103 | | - url = f"{self.base_url}/{AgentHubEndpoints.NORMALIZED_ENDPOINT.value.format(api_type=api_config.api_type)}" |
| 102 | + assert model_name is not None |
| 103 | + assert api_config is not None |
| 104 | + if api_config.client_type == "normalized" and api_config.api_type == "completions": |
| 105 | + url = f"{self.base_url}/{EndpointManager.get_normalized_endpoint()}" |
| 106 | + elif api_config.client_type == "passthrough" and api_config.api_type == "embeddings": |
| 107 | + assert api_config.api_version is not None |
| 108 | + url = f"{self.base_url}/{EndpointManager.get_embeddings_endpoint().format(model=model_name, api_version=api_config.api_version)}" |
104 | 109 | else: |
105 | | - assert api_config is not None |
106 | | - assert api_config.api_type is not None |
107 | 110 | assert api_config.vendor_type is not None |
108 | | - url = f"{self.base_url}/{AgentHubEndpoints.PASSTHROUGH_ENDPOINT.value.format(model=model_name, vendor=api_config.vendor_type, api_type=api_config.api_type)}" |
| 111 | + url = f"{self.base_url}/{EndpointManager.get_vendor_endpoint().format(model=model_name, vendor=api_config.vendor_type)}" |
109 | 112 | return url |
110 | 113 |
|
111 | 114 | @override |
|
0 commit comments