Usage instructions for the Client SDK for Inference
Quickstart
To read all inferences for a patient with MRN $PATIENT_MRN and model ID $MODEL_ID with username $USERNAME and private key filename $PRIVATE_KEY_FILENAME, run:
from client_sdk import InferenceAPIClient
async with InferenceAPIClient(
username="$USERNAME",
private_key_filename="$PRIVATE_KEY_FILENAME",
) as client:
inferences = await client.get_inferences(
model_id="$MODEL_ID",
patient_mrn="$PATIENT_MRN",
)
import { InferenceAPIClient } from 'bunkerhill-inference-api/client';
const client = new InferenceAPIClient('$USERNAME', '$PRIVATE_KEY_FILENAME');
const inferences = await client.getInferences(
'$MODEL_ID',
'$PATIENT_MRN',
);
username (str): The username to authenticate the client.
private_key_filename (Optional[str]): Filename of the RSA private key.
private_key_string (Optional[str]): The RSA private key as a string.
base_url (str, has a default): The base URL of the Inference API. Defaults to 'https://api.bunkerhillhealth.com/'.
Notes
At least one of private_key_filename or private_key_string must be provided.
get_inferences
Gets a list of Inference objects for a given patient and a given model from the Inference API. Must be called from an async context.
Hint: The get_inferences method is asynchronous. To make use of this method from a synchronous application, calls to the InferenceAPIClient can be wrapped in asyncio.run().