Skip to content

SDKs

Generation Model

SDKs are generated from the committed external OpenAPI schema at docs/openapi.json. Refresh that artifact locally with scripts/generate_external_openapi.py before SDK generation.

Generated output targets:

  • sdks/python
  • sdks/typescript

Current Status

The repository now includes the generation pipeline and placeholder SDK directory. Package publishing is not wired in this task, so direct HTTP remains the supported integration path until release packaging is added.

Python Example

import requests

response = requests.post(
    "https://api.tanfi.ai/api/v1/ext/kb/query",
    headers={
        "X-API-Key": "bach_live_...",
        "Content-Type": "application/json",
    },
    json={"query": "Basel operational risk", "top_k": 5},
    timeout=10,
)
response.raise_for_status()
print(response.json())

TypeScript Example

const response = await fetch("https://api.tanfi.ai/api/v1/ext/kb/query", {
  method: "POST",
  headers: {
    "X-API-Key": "bach_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ query: "model risk management", top_k: 5 }),
});

if (!response.ok) {
  throw new Error(`Request failed: ${response.status}`);
}

console.log(await response.json());

Regenerate Locally

python scripts/generate_external_openapi.py --write

docker run --rm \
  -v "${PWD}:/local" \
  openapitools/openapi-generator-cli:v7.4.0 generate \
  -i /local/docs/openapi.json \
  -g python \
  -o /local/sdks/python