Dexa APIv0.5.0

Dexa API

Run many decider and extractor tasks in one compact, non-streaming request. Official SDKs for TypeScript, Python, Ruby, Rust, Java and .NET.

The Dexa API runs many small judgement tasks against the same context in a single request. Instead of paying for one completion per question, you send a list of tasks and get back every answer in one response.

json{
  "model": "decider-extractor-v1",
  "context": "User says: renew subscription for 2 years. Previous plan expired 3 months ago.",
  "tasks": [
    { "type": "decide", "name": "should_renew", "question": "Should we offer a renewal discount?", "options": ["yes", "no"] },
    { "type": "extract", "name": "renew_term", "instruction": "Extract the renewal term in months", "keys": ["months"] }
  ]
}
json{
  "id": "req_9X2kFvTnQpR4w",
  "model": "decider-extractor-v1",
  "results": {
    "should_renew": { "value": "yes" },
    "renew_term": { "months": 24 }
  },
  "usage": { "prompt_tokens": 61, "completion_tokens": 9, "total_tokens": 70 }
}

What it is built for#

Note

The API is non-streaming by design. There is no SSE endpoint and none is planned for the current version.

Start here#

Endpoints#

Endpoint Use it for
POST /v1/tasks Any mix of decider and extractor tasks
POST /v1/decide-extract Backwards-compatible alias of /v1/tasks
POST /decide A single decider task, without wrapping it in a list
POST /extract A single extractor task, without wrapping it in a list

Prefer /v1/tasks. The other three exist so that simple calls stay simple and so that clients written against the first version of the contract keep working.

Client libraries#

Language Package Client class
TypeScript @dsainvg/dexa-ai-sdk DexaAiSdkClient
Python dexa-ai-sdk DexaAiSdk
Ruby gem DexaAiSdk
Rust dexa-ai-sdk crate DexaAiSdk
Java Maven artifact DexaAiSdk
.NET DexaAiSdk package DexaAiSdkClient

C++ has no generated client. Call the HTTP API directly from any HTTP library, the payloads are plain JSON. See clients for a worked C++ example.