Skip to main content

Player2 for Python

A lightweight Python client designed to easily interact with Player2 Local Endpoints.

Installation

Install the package via pip:

pip install player2

Usage

1. Initialize the Client

When initializing the client, pass your game_id. It will automatically handle web login to fetch authorization keys and spin up a background health-check loop.

from player2 import APIClient

client = APIClient(game_id="your_game_id")  # Get the gameID from the player2 website

2. Chat Completions

Send user queries with optional system instructions:

response = client.chat(
    user="Hello, how are you doing today?",
    system="You are a helpful and witty assistant."
)

print(response)

3. Text-to-Speech (TTS)

Trigger speech generation locally:

tts_response = client.speak(
    text="Hello, how are you doing today?",
    instructions="Speak with a cheerful tone",
    speed=1.0
)

print(tts_response)

4. Speech-to-Text (STT)

Info This function is still untested and might not work, It's still W.I.P.

Trigger speech recording for 5 seconds and then stop.

from time import sleep # For this example, we will use time.sleep

client.start_stt()
sleep(5)
recording = client.stop_stt()

print(recording) # Returns the text in a JSON format.

Metadata

Release files for player2 0.0.3

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

Source distribution (sdist)

Source distribution for player2 0.0.3
File Size Uploaded Provenance
player2-0.0.3.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 9.2 kB

Release files / player2-0.0.3.tar.gz

Download URL player2-0.0.3.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6207a5d7409b0b6bba1a73ef6f8d2003eb8569885821246d7bd126c2afe51d1a
BLAKE2b-256 checksum
How to use checksums
9ead009e223cf1d77c75e7ba40769ef3d39aa4e53217b1e1362b462d20434c4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / player2-0.0.3-py3-none-any.whl

Download URL player2-0.0.3-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af96b615cba70ad4dc5c30896c0235d607f284a2274efd420849888a0639bc87
BLAKE2b-256 checksum
How to use checksums
b804dcc6eb2d1dc7eb80068196353464b9eb40b74a7bd48ebba0b24813575ce6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for player2 0.0.3

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.

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