MCPcopy
hub / github.com/langroid/langroid / get_cerebras_client

Function get_cerebras_client

langroid/language_models/client_cache.py:280–299  ·  view source on GitHub ↗

Get or create a singleton Cerebras client with the given configuration. Args: api_key: Cerebras API key Returns: Cerebras client instance

(api_key: str)

Source from the content-addressed store, hash-verified

278
279
280def get_cerebras_client(api_key: str) -> Cerebras:
281 """
282 Get or create a singleton Cerebras client with the given configuration.
283
284 Args:
285 api_key: Cerebras API key
286
287 Returns:
288 Cerebras client instance
289 """
290 cache_key = _get_cache_key("cerebras", api_key=api_key)
291
292 with _client_cache_lock:
293 cached_client = _get_cached_client(cache_key)
294 if cached_client is not None:
295 return cast(Cerebras, cached_client)
296
297 client = Cerebras(api_key=api_key)
298 _store_client(cache_key, client)
299 return client
300
301
302def get_async_cerebras_client(api_key: str) -> AsyncCerebras:

Callers 2

__init__Method · 0.90

Calls 3

_get_cache_keyFunction · 0.85
_get_cached_clientFunction · 0.85
_store_clientFunction · 0.85

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…