Skip to main content

Python SDK for LingxinAI Psychology Open APIs

Project description

LingxinAI Psychology Python SDK

Python SDK for LingxinAI Psychology Open APIs.

Install

pip install lingxinai-psychology

Quick Start

from lingxinai.psychology import PsychologyClient
from lingxinai.psychology.types import OpenStudentQueryRequest

client = PsychologyClient.builder() \
    .admin("your-api-key", "your-api-secret") \
    .build()

students = client.open_api().student().list(OpenStudentQueryRequest(
    orgCode="school001",
    pageNum=0,
    pageSize=20,
))

print(students.content)

Client Identity

Create one client per identity. Do not mix admin, user, student, or parent calls on the same client.

admin_client = PsychologyClient.builder() \
    .admin("your-api-key", "your-api-secret") \
    .build()

user_client = PsychologyClient.builder() \
    .user("your-api-key", "your-api-secret", "external-user-001") \
    .build()

student_client = PsychologyClient.builder() \
    .student("your-api-key", "your-api-secret", 10001) \
    .build()

parent_client = PsychologyClient.builder() \
    .access_token(parent_login_response.token) \
    .build()

API Groups

  • auth() - login helpers
  • org() - organization APIs
  • dept() - department/class APIs
  • student() - student APIs
  • orgUser() - organization staff APIs
  • device() - device APIs
  • bot() - bot APIs
  • chat() - chat APIs
  • course() - micro course APIs
  • algo() - HTTP ASR/TTS and realtime ASR/TTS WebSocket APIs
  • crisis() - crisis warning APIs
  • meditation() - meditation APIs
  • overview() - dashboard/statistics APIs
  • parent() - parent-side APIs
  • quickInterview() - quick interview APIs
  • activity() - activity APIs
  • scale() - scale/interview runtime APIs

Realtime ASR

from lingxinai.psychology.types import RealtimeAsrOptions

ws = student_client.open_api().algo().realtimeAsr(RealtimeAsrOptions(
    voiceFormat=1,
    inputSampleRate=16000,
))

ws.send('{"type":"start"}')
ws.send(audio_chunk, opcode=0x2)
ws.send('{"type":"end"}')
print(ws.recv())
ws.close()

Verification

python -m unittest discover -s test
python -m build --sdist --wheel
python -m twine check dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lingxinai_psychology-1.0.2.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lingxinai_psychology-1.0.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file lingxinai_psychology-1.0.2.tar.gz.

File metadata

  • Download URL: lingxinai_psychology-1.0.2.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for lingxinai_psychology-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e3223e4c71094c38b0c935b14f96fe2a408a8e390bb2debd4813dc2bceecf04f
MD5 ec93684b7b0db0e00dedca4a63d8fab0
BLAKE2b-256 70458c827beb13b8437bce70dbebd2c294f3f1c90d23c2978ee91c14cd4e06d6

See more details on using hashes here.

File details

Details for the file lingxinai_psychology-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lingxinai_psychology-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1cab31a2e39f2a01286b461ba5e9c252c6b54ba00a86a5b69fb06c866b56beff
MD5 3e16298754afaa8e516441837ae3d3b6
BLAKE2b-256 cb77ab4614b7e521a44fd110c06343b3cb8a9d784a36ca36c45ae43ec2e96e78

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page