Context

TokenSource context management provides a flexible framework for managing AI assistant behaviors and capabilities within the financial services ecosystem. This system implements a primary association between contexts and AI assistants, with optional linking to specific objectives or projects.

Core Architecture

Primary Context-Assistant Association

The system establishes a direct relationship between contexts and AI assistants, ensuring:

  • Each AI assistant maintains a default context that defines its base behavior and knowledge domain

  • Contexts contain specific rules, constraints, and knowledge bases tailored to financial operations

  • Multiple assistants can share standardized contexts for consistent behavior across services

  • Context definitions include specialized knowledge for payment processing, compliance, and security protocols

Secondary Context-Objective Association

The system supports dynamic context assignment to objectives through:

  • Flexible context switching based on project phases or requirements

  • Optional linking between contexts and specific project objectives

  • Support for multiple assistant personalities within a single project

  • Dynamic context adaptation for different stages of financial workflows

Base Path: /v1/contexts

Get All Contexts

Method: GET Endpoint: https://api.tokensource.com/v1/contexts Description: Retrieves all contexts for the authenticated user.

Response (200 OK):

{
  "status": 200,
  "data": [
    {
      "id": 1,
      "name": "Context A",
      "instructionCommentary": "Instructions for context A",
      "apiVersion": "v1",
      "authenticationMethod": "Bearer Token",
      "responseFormat": "JSON",
      "userId": 1
    }
  ]
}

Get Context by ID

Method: GET Endpoint: https://api.tokensource.com/v1/contexts/{id} Description: Retrieves a specific context by its ID.

Parameters:

  • id (integer, required)

Response (200 OK):

{
  "status": 200,
  "data": {
    "id": 1,
    "name": "Context A",
    "instructionCommentary": "Instructions for context A",
    "apiVersion": "v1",
    "authenticationMethod": "Bearer Token",
    "responseFormat": "JSON",
    "userId": 1,
    "components": [
      { "id": 1, "name": "Component X" },
      { "id": 2, "name": "Component Y" }
    ]
  }
}

Response (404 Not Found):

{
  "status": 404,
  "message": "Context not found"
}

Create Context

Method: POST Endpoint: https://api.tokensource.com/v1/contexts Description: Creates a new context.

Request Body:

{
  "name": "Context B",
  "instructionCommentary": "Instructions for context B",
  "apiVersion": "v2",
  "authenticationMethod": "API Key",
  "responseFormat": "XML"
}

Response (201 Created):

{
  "status": 201,
  "data": {
    "id": 2,
    "name": "Context B",
    "instructionCommentary": "Instructions for context B",
    "apiVersion": "v2",
    "authenticationMethod": "API Key",
    "responseFormat": "XML",
    "userId": 1
  }
}

Update Context

Method: PUT Endpoint: https://api.tokensource.com/v1/contexts/{id} Description: Updates an existing context.

Parameters:

  • id (integer, required)

Request Body:

{
  "name": "Context A Updated",
  "instructionCommentary": "Updated instructions",
  "apiVersion": "v1.1",
  "authenticationMethod": "OAuth 2.0",
  "responseFormat": "JSON"
}

Response (200 OK):

{
  "status": 200,
  "message": "Context updated successfully"
}

Delete Context

Method: DELETE Endpoint: https://api.tokensource.com/v1/contexts/{id} Description: Deletes a context.

Parameters:

  • id (integer, required)

Response (200 OK):

{
  "status": 200,
  "message": "Context deleted successfully"
}

Generate and Save Context

Method: POST Endpoint: https://api.tokensource.com/v1/contexts/generate Description: Generates and saves a new context.

Request Body:

{
  "input": "Some input text for context generation",
  "categoryId": 1
}

Response (201 Created):

{
  "status": 201,
  "message": "Context generated and saved successfully"
}

Get All Components

Method: GET Endpoint: https://api.tokensource.com/v1/contexts/components (Refer to the Components section for the response format.)

Get All Categories

Method: GET Endpoint: https://api.tokensource.com/v1/contexts/categories (Refer to the Categories section for the response format.)

Last updated