Prismatoid (PARI)

raw JSON →
0.14.4 verified Sat May 09 auth: no python

The Platform-Agnostic Reader Interface for Speech and Messages (PARI). Version 0.14.4. Active development; monthly releases.

pip install prismatoid
error ImportError: cannot import name 'Prismatoid' from 'prismatoid'
cause Old library version (<0.10) had a different structure; or the library is not installed.
fix
pip install --upgrade prismatoid
error TypeError: object Message can't be used in 'await' expression
cause Forgetting await on the send call.
fix
Change to: response = await client.send(msg)
error ValueError: No API key provided and PRISMATOID_API_KEY not set
cause Missing API key.
fix
Set PRISMATOID_API_KEY environment variable or pass api_key='your-key'.
breaking In version 0.12 the models were moved from top-level to prismatoid.models. Old imports (from prismatoid import Message) will break.
fix Change imports to from prismatoid.models import Message, etc.
breaking Async methods (send, receive) now require awaiting. Calling them without await will raise TypeError.
fix Add await before calls: response = await client.send(msg).
gotcha The API key must be set via environment variable or passed to constructor. If not set, client uses a test key that only works in local dev mode.
fix Set PRISMATOID_API_KEY environment variable or pass api_key='key' to Prismatoid().

Basic async usage sending a message.

import os
import asyncio
from prismatoid import Prismatoid
from prismatoid.models import Message

async def main():
    # Uses environment variable PRISMATOID_API_KEY if not provided
    client = Prismatoid(api_key=os.environ.get('PRISMATOID_API_KEY', 'test-key'))
    msg = Message(text="Hello, world!")
    response = await client.send(msg)
    print(response)

asyncio.run(main())