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.3.tar.gz (38.3 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.3-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lingxinai_psychology-1.0.3.tar.gz
  • Upload date:
  • Size: 38.3 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.3.tar.gz
Algorithm Hash digest
SHA256 686d2fd673df252facfcc55ca5bbf34ea11f8fc6dc37764eadb72b4edd35ea72
MD5 b9541f319177c3b6a8ffa4cf91e51515
BLAKE2b-256 9ee92213fc57067c71c8e0be82b39f470b82e96596992b4ac33ff5e378198636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lingxinai_psychology-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 28220cb68b3fe6bfacf3035ae0c6052448424a2be39421cd8f830ac496387dc7
MD5 a601832774eb1e7f06ecafae1bb86eed
BLAKE2b-256 0fea03cd80d6b14ac1c9f1519af44c0f5bf01fa9bfc99c6d2b44f475365a4e77

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