(
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,
)
| 80 | ] |
| 81 | ) |
| 82 | def __init__( |
| 83 | self, |
| 84 | model_type: Union[ModelType, str], |
| 85 | model_config_dict: Optional[Dict[str, Any]] = None, |
| 86 | api_key: Optional[str] = None, |
| 87 | url: Optional[str] = None, |
| 88 | token_counter: Optional[BaseTokenCounter] = None, |
| 89 | ) -> None: |
| 90 | if model_config_dict is None: |
| 91 | model_config_dict = SambaCloudAPIConfig().as_dict() |
| 92 | api_key = api_key or os.environ.get("SAMBA_API_KEY") |
| 93 | url = url or os.environ.get( |
| 94 | "SAMBA_API_BASE_URL", |
| 95 | "https://api.sambanova.ai/v1", |
| 96 | ) |
| 97 | super().__init__( |
| 98 | model_type, model_config_dict, api_key, url, token_counter |
| 99 | ) |
| 100 | |
| 101 | if self._url == "https://api.sambanova.ai/v1": |
| 102 | self._client = OpenAI( |
| 103 | timeout=180, |
| 104 | max_retries=3, |
| 105 | base_url=self._url, |
| 106 | api_key=self._api_key, |
| 107 | ) |
| 108 | |
| 109 | @property |
| 110 | def token_counter(self) -> BaseTokenCounter: |
nothing calls this directly
no test coverage detected