← Back to Articles & Artefacts
artefactswest

API Specification: Indigenous Paradigm-Aware QA Chain

IAIP Research
rag-rephraser

API Specification: Indigenous Paradigm-Aware QA Chain

Version: 1.0
Status: Production-Ready


Overview

This API enables the Indigenous Paradigm-Aware Conversational Retrieval QA Chain via REST endpoints. It extends FloWise prediction endpoints with paradigm-direction selection and dynamic prompt injection.


Core Endpoint

POST /api/v1/prediction/{chatbotId}

Execute a query with specified Indigenous paradigm direction.

Request

```json { "question": "How do we understand knowledge in networked systems?", "paradigmDirection": "relational_ontology" } ```

Valid Paradigm Directions

DirectionFocusUse Case
relational_ontologyInterconnected relationshipsDefault; universal baseline
land_based_knowingPlace/ecological specificityTerritory-focused research
ceremonial_knowledgeStructured practices/timingCommunity protocols
oral_traditionNarrative continuityStorytelling/documentation
governance_sovereigntyCollective authorityInstitutional research
healing_wholenessIntegrated wellnessHealth/trauma-informed inquiry
knowledge_sovereignty_epistemologyEpistemological pluralismDecolonial research

Response

```json { "text": "Networked systems reflect relational principles where knowledge emerges through interconnection rather than hierarchy. Each perspective holds validity within its relational context...", "sourceDocuments": [ { "pageContent": "...", "metadata": { "source": "document_id", "loc": { "lines": { "from": 10, "to": 20 } } } } ], "paradigmDirection": "relational_ontology", "responseMetadata": { "rephraseUsed": true, "wordCount": 145, "references": [1, 2] } } ```

HTTP Status Codes

CodeMeaningAction
200SuccessResponse object with text and sources
400Bad RequestInvalid question or paradigm direction
401UnauthorizedMissing/invalid authentication
404Not FoundChatbot ID doesn't exist
422Unprocessable EntityMalformed payload or prompt syntax error
429Too Many RequestsRate limit exceeded
500Server ErrorInternal FloWise error

Examples

cURL - Relational Ontology

```bash curl -X POST https://beagle-emerging-gnu.ngrok-free.app/api/v1/prediction/92b3d7ce-0eef-4be8-ad5b-b5d731cabf80
-H "Content-Type: application/json"
-d '{ "question": "What frameworks guide knowledge integration?", "paradigmDirection": "relational_ontology" }' ```

cURL - Land-Based Knowing

```bash curl -X POST https://beagle-emerging-gnu.ngrok-free.app/api/v1/prediction/92b3d7ce-0eef-4be8-ad5b-b5d731cabf80
-H "Content-Type: application/json"
-d '{ "question": "How does territory shape research practice?", "paradigmDirection": "land_based_knowing" }' ```

JavaScript/Fetch

```javascript const response = await fetch( 'https://beagle-emerging-gnu.ngrok-free.app/api/v1/prediction/92b3d7ce-0eef-4be8-ad5b-b5d731cabf80', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ question: 'Your question here', paradigmDirection: 'relational_ontology' }) } ); const result = await response.json(); console.log(result.text); ```

Python/Requests

```python import requests

response = requests.post( 'https://beagle-emerging-gnu.ngrok-free.app/api/v1/prediction/92b3d7ce-0eef-4be8-ad5b-b5d731cabf80', json={ 'question': 'Your question here', 'paradigmDirection': 'relational_ontology' } ) print(response.json()['text']) ```


Error Handling

Standard Error Response

```json { "error": { "code": "INVALID_PARADIGM_DIRECTION", "message": "Unknown paradigm direction: 'invalid_name'", "details": { "requested": "invalid_name", "valid_options": [ "relational_ontology", "land_based_knowing", "ceremonial_knowledge", "oral_tradition", "governance_sovereignty", "healing_wholeness", "knowledge_sovereignty_epistemology" ] }, "timestamp": "2026-01-03T05:11:00Z" } } ```

Common Error Codes

CodeHTTPCauseSolution
INVALID_PARADIGM_DIRECTION400Unknown directionUse valid direction from list above
MISSING_QUESTION400Empty questionProvide non-empty question field
UNAUTHORIZED401Invalid API keyProvide valid authentication
CHATBOT_NOT_FOUND404Invalid chatbot IDVerify chatbot ID is correct
MALFORMED_PROMPT422Syntax errorVerify template variables
RATE_LIMITED429Too many requestsImplement exponential backoff
BACKEND_ERROR500FloWise service errorCheck FloWise logs; retry

Request/Response Patterns

Chat History Format

```json { "question": "Follow-up question", "chatHistory": "User: First question\nAssistant: First response\nUser: Second question" } ```

Context Variable

The {context} variable in responder prompts is populated from retrieval:

``` Context: [Document 1 excerpt] [Document 2 excerpt] [Document 3 excerpt] ```

Citation Format

Responses use numbered citations with APA7 appendix:

``` Text with citation [1] and another [2].

APPENDIX - References [1] Author, A. (Year). Title. Journal. [2] Author, B. (Year). Title. Publisher. ```


Rate Limiting

  • Standard: 100 requests/minute
  • Burst: 150 requests/10 seconds
  • Headers: ``` X-RateLimit-Limit: 100 X-RateLimit-Remaining: 87 X-RateLimit-Reset: 1704200400 ```

Implementation Checklist

  • FloWise instance accessible
  • Chatbot ID verified
  • Direction selector implemented
  • Request/response validation working
  • Error handling implemented
  • Rate limiting understood
  • Logging active
  • All 7 directions tested

Status: Production Ready | Version: 1.0 | Last Updated: 2026-01-03