MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / __init__

Method __init__

llms/api_key_pool.py:165–184  ·  view source on GitHub ↗
(self, client_args: ClientArgs)

Source from the content-addressed store, hash-verified

163
164class Pool:
165 def __init__(self, client_args: ClientArgs) -> None:
166 assert "api_keys" in client_args or "api_key" in client_args
167 assert not ("api_keys" in client_args and "api_key" in client_args)
168
169 if "api_key" in client_args:
170 self.queue: List[Resource] = [Resource(**client_args)]
171 elif "api_keys" in client_args:
172 self.queue: List[Resource] = [
173 Resource(
174 api_key=api_key,
175 base_url=client_args["base_url"],
176 organization=client_args.get("organization", None),
177 project=client_args.get("project", None),
178 max_retries=client_args.get("max_retries", 2),
179 timeout=client_args.get("timeout", None),
180 )
181 for api_key in client_args["api_keys"]
182 ]
183
184 self._index: int = 0
185
186 def __len__(self) -> int:
187 return len(self.queue)

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 1

ResourceClass · 0.85

Tested by

no test coverage detected