Package blind_llama
Sub-modules
blind_llama.completion
blind_llama.errors
blind_llama.logging
blind_llama.pb
blind_llama.request_adapters
-
This module implements a set of requests TransportAdapter, PoolManager, ConnectionPool and HTTPSConnection with one goal only: …
blind_llama.verify
Functions
def create(model: str = 'meta-llama/Llama-2-70b-chat-hf', prompt: str = '', temperature: float = 0.7, verbose: bool = False) ‑> str
-
Start a prediction.
Args
- model (str, default = "meta-llama/Llama-2-70b-chat-hf"): The model on which you want to run a prediction on.
prompt
:str
- The prompt on which you want to run a prediction on.
temperature
:float
, default= 0.7
- The temperature requested (default to 0.7).
verbose
:bool
, default= False
- Allows to print all details of the verification process.
Returns
str
- The result of the prediction made by the server
Classes
class Client (verbose: bool = False)
-
A class to represent a connection to a BlindLlama server.
Init the Client class.
Args
verbose
:bool
, default= False
- Allows to print all details of the verification process.
Returns
Client
- Client object.
Methods
def predict(self, prompt: str, temperature: float = 0.7) ‑> str
-
Start a prediction.
Args
prompt
:str
- The prompt on which you want to run a prediction on.
temperature
:float
, default= 0.7
- The temperature requested.
Returns
str
- The result of the prediction made by the server
def verify_build_response(self, build_response: bytes, ca_cert='', expected_pcr='')
-
Verify received attesation validity
- Parse the JSON reponse
- Check simulation mode
- Verify certificate chain
- Verify quote signature
- Verify boot PCRs (firmware, bootloader, initramfs, OS)
- Verify event log (final hash in PCR_FOR_MEASUREMENT) by replaying it (works like a chain of hashes)
- Verify TLS certificate (final hash in PCR_FOR_CERTIFICATE)
Args
build_response
:bytes
- reponse of the attestation endpoint
verbose
:bool
, default= False
- whether to print verification information in stdout
def verify_server_certificate(self, expected_pcr)
-
Retrieve server certificate and validate it with the attestation report.