MCPcopy Create free account
hub / github.com/InferCore/InferCore / __init__

Method __init__

sdk/python/infercore/client.py:22–40  ·  view source on GitHub ↗
(
        self,
        base_url: str,
        api_key: Optional[str] = None,
        *,
        auth: AuthMode = "header",
        timeout: float = 120.0,
        session: Optional[requests.Session] = None,
    )

Source from the content-addressed store, hash-verified

20 """
21
22 def __init__(
23 self,
24 base_url: str,
25 api_key: Optional[str] = None,
26 *,
27 auth: AuthMode = "header",
28 timeout: float = 120.0,
29 session: Optional[requests.Session] = None,
30 ) -> None:
31 self.base_url = base_url.rstrip("/")
32 self._timeout = timeout
33 self._session = session or requests.Session()
34 if api_key:
35 if auth == "header":
36 self._session.headers["X-InferCore-Api-Key"] = api_key
37 elif auth == "bearer":
38 self._session.headers["Authorization"] = f"Bearer {api_key}"
39 else:
40 raise ValueError("auth must be 'header' or 'bearer'")
41
42 def infer(self, body: Dict[str, Any]) -> Dict[str, Any]:
43 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected