Skip to main content

Galadriel Python SDK - Sentience

Setup

pip install sentience

Usage

Make LLM API call using OpenAI API spec and verify the signature:

import sentience
from openai import OpenAI

client = OpenAI(
    base_url="https://api.galadriel.com/v1/verified",
    api_key="Bearer GALADRIEL_API_KEY",
)

completion = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"},
    ],
)

print("completion:", completion)
is_valid = sentience.verify_signature(completion)
print("is_valid:", is_valid)

Fetch all previous verified inference requests:

from typing import List
import sentience
from sentience.history import GaladrielChatHistory

history: List[GaladrielChatHistory] = sentience.get_history(
    galadriel_api_key="Bearer GALADRIEL_API_KEY"
)

for item in history:
    print("\n\nResult:")
    print(f"Request: {item.request.get('messages')}")
    print(f"Message: {item.response.choices[0].message}")
    print(f"Hash: {item.hash}")
    print(f"Signed public key: {item.public_key}")
    print(f"Signature: {item.signature}")
    print(f"Tx hash: {item.tx_hash}")
    print(f"Attestation: {item.attestation[:10]}...")

    is_valid = sentience.verify_signature(item)
    print("is_valid:", is_valid)

Fetch a single verified inference request by hash:

import sentience
from sentience.history import GaladrielChatHistory

item: GaladrielChatHistory = sentience.get_by_hash(
    galadriel_api_key="Bearer GALADRIEL_API_KEY",
    hash="922e575ef7f07449977001c1caaf78fb6ad8b731cd625434f9215087a6c2b39f"
)
print("\n\nResult:")
print(f"Request: {item.request.get('messages')}")
print(f"Message: {item.response.choices[0].message}")
print(f"Hash: {item.hash}")
print(f"Signed public key: {item.public_key}")
print(f"Signature: {item.signature}")
print(f"Tx hash: {item.tx_hash}")
print(f"Attestation: {item.attestation[:10]}...")

is_valid = sentience.verify_signature(item)
print("is_valid:", is_valid)

Metadata

Release files for sentience 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sentience 0.0.2
File Size Uploaded Provenance Actions
sentience-0.0.2.tar.gz 3.1 kB Without provenance Details for sentience-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sentience 0.0.2
File Interpreter ABI Platform Actions
sentience-0.0.2-py3-none-any.whl Python 3 none any Details for sentience-0.0.2-py3-none-any.whl

Total release size: 6.9 kB

Release files / sentience-0.0.2.tar.gz

Download URL sentience-0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
23612bf685c1f5cabf754c682f0f302584c37562bddd22c2c7693b85c908c771
BLAKE2b-256 checksum
How to use checksums
a83aa5325af253d18dce4e92bf1cde34383c2a484a571facb7e6b8a79b3c6e82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.0

Release files / sentience-0.0.2-py3-none-any.whl

Download URL sentience-0.0.2-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfd68d9ac6148774a61fdf4e535bbd2a9bad3567af636ae144a04303627bddf8
BLAKE2b-256 checksum
How to use checksums
848c59a2755c8e2b675f5f18aaacc639f0cb78a10fa197d57ec99d45ae33e32f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.0

Security for sentience 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page