Perceptron

raw JSON →
0.2.1 verified Mon Apr 27 auth: no python

Perceptron is a multimodal SDK for building AI applications that process text, images, and audio. Current version 0.2.1, active development with frequent releases.

pip install perceptron
error AttributeError: module 'perceptron' has no attribute 'Perceptron'
cause Incorrect import: using 'import perceptron' instead of 'from perceptron import Perceptron'.
fix
Use 'from perceptron import Perceptron'.
error TypeError: __init__() missing 1 required positional argument: 'api_key'
cause Instantiating Perceptron without providing the api_key argument.
fix
Pass api_key as a string argument: Perceptron(api_key='your_key').
deprecated The 'old_chat' method is deprecated in v0.2.0, use 'chat' instead.
fix Replace old_chat(...) with chat(...).
gotcha API key must be a string; passing a dict or None will raise a TypeError.
fix Provide a valid string API key, preferably via environment variable.

Initialize the client with an API key and send a chat message.

from perceptron import Perceptron
import os

client = Perceptron(api_key=os.environ.get('PERCEPTRON_API_KEY', ''))
response = client.chat("Hello, world!")
print(response)