> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praxis-ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Object Definitions

> This document describes the object definitions used by the Praxis AI Javascript SDK.

## Post Request Object

```javascript theme={null}
const request = {
	command: 'post',
	inputs: [<string>],
	assistantId: <string>,
	selectedCourse: {
		course_id: <string>,
		course_name: <string>
	}
}
```

## Post Response Object

```json theme={null}
{
   "type": "pria-response",
   "response": {
      "content": {
         "success": true,
         "outputs": [
            "I am doing great ! Happy birthday by the way, doing anything special?"
         ],
         "usage": 12048,
         "institutioncredits": 991,
         "credits": 991,
         "creditsUsed": 59,
         "totalLength": 12048,
         "totalCredits": 2,
         "query_duration_ms": 9404,
         "requestArgs": {
            "userISODate": "2024-12-23T14:25:48.245Z",
            "userTimezone": "Indian/Mauritius",
            "socketId": "kdzUm6yzkFd9YDcWAAAP",
            "assistantId":"67568474f66f51c8dc860c1f",
            "selectedCourse" : {
		"course_id": 123456,
		"course_name": "Pre-assessment (AI for Analysts)"
	     }
          },
         "model": "us.anthropic.claude-3-5-sonnet-20240620-v1:0"
      },
      "type": "object"
   },
   "version": 1
}
```

## Assistants List Request

```json theme={null}
{
	command: 'assistants.list'
}
```

## Assistants List Response Object

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "content": [
      {
        "_id": "68c6f230d9c782aee842fc04",
        "name": " New Conversation",
        "description": "Start a new conversation! This assistant is designed to initiate and facilitate fresh, engaging dialogues on a wide range of topics, adapting to the user's interests and needs.✏️📝 It employs a dynamic approach, utilizing available tools and user memory to personalize interactions, while maintaining a focus on the current conversation's context and goals. The primary benefit of this assistant is its ability to provide tailored, informative, and thought-provoking exchanges that encourage learning, exploration, and meaningful interaction, all while adhering to strict guidelines for accuracy, citation, and ethical communication.",
        "picture_url": "/assistant_new_conversation.webp",
        "status": "active",
        "liked_count": 0,
        "admin_only": false,
        "institution_shared": false,
        "editable_others": false,
        "remember_history": 3,
        "created": "2025-09-14T16:49:52.983Z"
      },
      {
        "_id": "68c6f231d9c782aee842fc16",
        "name": "Code Analyzer",
        "description": "The Code Analyzer systematically examines your code through a comprehensive three-phase approach to identify critical bugs, security vulnerabilities, and performance bottlenecks before they impact your production systems, transforming potentially costly runtime failures into proactive development wins. 🔍 🛡️ Experience the confidence that comes from receiving severity-ranked findings with targeted code fixes and actionable remediation examples, allowing you to strengthen your codebase methodically while learning best practices that elevate your programming skills with every analysis session.",
        "picture_url": "/assistant_code_analyzer.png",
        "status": "active",
        "liked_count": 0,
        "admin_only": false,
        "institution_shared": false,
        "editable_others": false,
        "remember_history": 3,
        "created": "2025-09-14T16:49:53.079Z"
      },
     ...
    ],
    "command": "assistants.list",
    "type": "object",
    "isError": false
  },
  "version": 1
}
```

## Conversations List Request

```json theme={null}
const request = {
	command: 'conversations.list'
}
```

## Assistant List Response Object

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "content": [
      {
        "course_name": " New Conversation Wednesday, Oct 1, 2025",
        "assistant": {
          "_id": "68c6f230d9c782aee842fc04",
          "name": " New Conversation",
          "picture_url": "/assistant_new_conversation.webp",
          "liked_count": 0
        },
        "history_count": 1,
        "last_dialogue_date": "2025-10-01T04:50:28.099Z",
        "course_id": 1759294218187
      },
      {
        "course_name": "",
        "assistant": null,
        "history_count": 1,
        "last_dialogue_date": "2025-09-25T07:46:05.719Z",
        "course_id": 0
      }
    ],
    "command": "conversations.list",
    "type": "object",
    "isError": false
  },
  "version": 1
}
```

## Favorites List Request

```json theme={null}
const request = {
	command: 'favorites.list'
}
```

## Favorites List Response Object

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "content": [
      {
        "id": "68dcb3bfdaaf57e9576ea6b6",
        "created": "2025-10-01T04:53:19.729Z",
        "credits": 2,
        "usage": 11455,
        "cached": 0,
        "completion": 0,
        "latencyMs": 0,
        "institution": "68c6f230d9c782aee842fb12",
        "favorite": true,
        "forgotten": false,
        "course_id": 22345,
        "course_name": "Conversational Assist",
        "role_id": 123,
        "role_name": "Course ABC",
        "query_duration_ms": 47224,
        "conversation_model": "gpt-realtime",
        "success": true,
        "in": {
          "input": "Transcripts for conversation conv_CLj7EQXPBb6sAUTAotBRD"
        },
        "out": {
          "outputs": [
            "Hey there! Great to have you here – let’s dive right in! What’s on your mind today?"
          ]
        }
      }
    ],
    "command": "favorites.list",
    "type": "object",
    "isError": false
  },
  "version": 1
}
```

## Convo Ready Event

The `convo.ready` event is sent proactively by the Digital Twin after the user logs in. It notifies the embedding application whether real-time voice (speech-to-speech) mode is authorized for the current user. This event is not a response to a command — it is sent automatically.

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "command": "convo.ready",
    "content": {
      "authorized": true
    },
    "type": "object",
    "isError": false
  },
  "version": 1
}
```

| Field                | Type    | Description                                                                  |
| -------------------- | ------- | ---------------------------------------------------------------------------- |
| `content.authorized` | Boolean | `true` if real-time voice mode is available for this user, `false` otherwise |

Authorization depends on the institution's voice settings (`rtEnabled`) and whether the user has the required role.

<Note>
  This event is also intercepted by the SDK itself to set the `pria.isConvoReady()` flag and optionally trigger `convoMode` auto-start. Subscribers receive it after the SDK processes it.
</Note>

## Start Convo Request

```json theme={null}
{
	command: 'convo.start'
}
```

## Start Convo Response

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "content": "Convo started (STS)",
    "command": "convo.start",
    "type": "string",
    "isError": false
  },
  "version": 1
}
```

## Stop Convo Request

```json theme={null}
{
	command: 'convo.stop'
}
```

## Start Convo Response

```json theme={null}
{
  "type": "pria-response",
  "response": {
    "content": "Convo stopped (STS)",
    "command": "convo.stop",
    "type": "string",
    "isError": false
  },
  "version": 1
}
```
