API

Neura AI provides a unified API interface that handles multiple capabilities through a single omni-endpoint, with support for long-running operations through a polling mechanism.


Overview

Neura AI provides a unified API interface that handles multiple capabilities through a single omni-endpoint. The API utilizes Bearer token authentication and includes comprehensive NLP capabilities, image processing, and conversational features.

Core Information

Base URL: https://bo.meetneura.ai/api/prediction

Authentication: Bearer Token required for all endpoints

Default Content-Type: multipart/form-data

Endpoints

1. Omni Endpoint (Primary Interaction Point)

Endpoint: POST /prediction/interact

Status Check: GET /prediction/interact

Capabilities

  • Conversational RAG with context management

  • AI-driven RDA decision-making

  • Image generation and similar image generation

  • Image analysis with computer vision

  • Document analysis and URL summarization

  • Natural Language Processing features:

    • Sentiment analysis

    • Intent detection

    • Keyword extraction

    • Lexicon processing

Request Format

Content-Type: multipart/form-data
Authorization: Bearer YOUR_TOKEN

Parameters:

  • text (optional): String - Input text, URL, or command

  • file (optional): File - Image or document for processing

  • chat_history (optional): Array - Previous conversation context

Example Requests

  1. Text Conversation:

curl -X POST "https://bo.meetneuraa.ai/api/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "text=What's the sentiment of this text?"
  1. Image Upload with Analysis:

curl -X POST "https://bo.meetneura.ai/api/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "[email protected]"
  1. URL Analysis:

curl -X POST "https://bo.meetneura.ai/api/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "text=https://example.com/article"

2. History and Logging Endpoints

Fetch Chat History

Endpoint: GET /history/fetch Description: Retrieves conversation history for the authenticated user

Get User IDs

Endpoint: GET /history/users/ids Description: Returns list of user IDs with chat history

Fetch Logs

Endpoint: GET /logs/fetch Description: Retrieves system logs for debugging

Clear Logs

Endpoint: POST /logs/clear Description: Clears system logs

3. NLP Specific Endpoint

Lexicon Access

Endpoint: GET /nlp/lexicon Description: Accesses the proprietary lexicon engine

Features

  • Sentiment Analysis (sentiment_analysis.rs)

  • Intent Detection (detect_intent.rs)

  • Important Terms Extraction (important_terms.rs)

  • Custom Lexicon Processing (lexicon.rs)

4. Proxy Interaction

Endpoint: POST /prediction/proxy/interact

Description: Proxy endpoint for client requests

Response Format

{
  "request_id": "uuid-v4-string",
  "response": "initial-response-or-processing-status",
  "processing_time_ms": 1234
}

2. Status Check Endpoint

GET /prediction/interact

Used to poll for results of long-running operations.

Required Header

X-Request-ID: your-request-id

Response States

  1. Processing Complete:

jsonCopy{
  "request_id": "your-request-id",
  "response": "completed-result"
}
  1. Processing Error:

jsonCopy{
  "error": "error-message",
  "request_id": "your-request-id",
  "code": "PROCESSING_ERROR"
}
  1. Request Not Found:

jsonCopy{
  "error": "Request not found",
  "request_id": "your-request-id"
}

3. History and Logging Endpoints

Get Chat History

GET /history/fetch

  • Retrieves conversation history for authenticated user

  • Requires Bearer token authentication

Get User IDs

GET /history/users/ids

  • Returns list of user IDs with chat history

  • Admin access required

Get Logs

GET /logs/fetch

  • Retrieves system logs

  • Admin access required

Clear Logs

POST /logs/clear

  • Clears system logs

  • Admin access required

4. Proxy Interaction

POST /prediction/proxy/interact

  • Load-balanced request handling

  • Same format as main interaction endpoint

NLP Capabilities

Integrated NLP Features

All text interactions automatically include:

  • Sentiment analysis

  • Intent detection

  • Keyword extraction

  • Lexicon processing

Specialized NLP Endpoints

GET /nlp/lexicon

  • Access to proprietary lexicon engine

  • Advanced language processing features

Implementation Guide

Basic Request Flow

  1. Submit initial request to /prediction/interact

  2. Receive request_id

  3. Poll status endpoint until completion

  4. Process final response

Example Implementation

javascriptCopyasync function interactWithNeuraAI(formData) {
  // Initial request
  const response = await fetch('https://bo.meetneura.ai/api/prediction/interact', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_TOKEN'
    },
    body: formData
  });
  
  const { request_id } = await response.json();
  
  // Polling loop
  while (true) {
    const statusResponse = await fetch('https://bo.meetneuraa.ai/api/prediction/interact', {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN',
        'X-Request-ID': request_id
      }
    });
    
    const result = await statusResponse.json();
    
    if (result.response) {
      return result.response;
    }
    if (result.error) {
      throw new Error(result.error);
    }
    
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
}

Example Requests

Text Conversation

curl -X POST "https://bo.meetneura.ai/api/v1/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "text=What's the sentiment of this text?"

Image Upload

curl -X POST "https://bo.meetneura.ai/api/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "[email protected]"

URL Analysis

curl -X POST "https://bo.meetneura.ai/api/prediction/interact" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "text=https://example.com/article"

System Limitations and Considerations

Request Processing

  • Maximum processing time: 300 seconds

  • Concurrent request management via semaphore

  • Response caching for completed requests

  • UUID v4 for request tracking

Rate Limits

  • Standard requests: 60 per minute

  • Image processing: 30 per minute

  • NLP processing: 100 per minute

Best Practices

  1. Implement exponential backoff for polling

  2. Monitor processing_time_ms

  3. Handle timeouts appropriately

  4. Cache frequent requests

  5. Include proper error handling

Security

  • Bearer token authentication required

  • Cloudflare protection enabled

  • Containerized client data

  • Request validation through dependency injection

  • Rate limiting on all endpoints

Error Handling

All errors follow this format:

jsonCopy{
  "error": "detailed error message",
  "request_id": "associated-request-id",
  "code": "ERROR_CODE",
  "processing_time_ms": 1234
}

Common error codes:

  • PROCESSING_ERROR: General processing failure

  • TIMEOUT_ERROR: Request exceeded time limit

  • VALIDATION_ERROR: Invalid input

  • AUTH_ERROR: Authentication failure

Notes

  • The omni endpoint automatically detects the type of processing needed based on input

  • Image generation triggers are processed automatically through NLP

  • Document analysis supports multiple formats (PDF, DOC, DOCX, TXT)

  • URL summarization works with any valid web URL

  • NLP processing is included by default in all text responses



Last updated