Intégration SDK
Référence API
Les symboles publics, les variables d'environnement et le contrat HTTP. Pour la référence exhaustive (taxonomie complète, configs d'assets typées), voyez les READMEs du SDK.
Initialiser le client
from niaone_sdk import NiaoneSDKclient = NiaoneSDK(api_key="sk_...", base_url="https://api.niaone.example")# ou zéro-config depuis l'environnementclient = NiaoneSDK.from_env()# ou désactivé (no-op, ne casse jamais votre code)client = NiaoneSDK.disabled()Symboles publics principaux
from niaone_sdk import ( NiaoneSDK, start_flow, end_flow, start_step, end_step, # cycle de vie flow, step, async_flow, async_step, # context managers instrument, # décorateur payload, metric, log, score, # émission de données trace_llm_call, submit_feedback, # helpers resume_flow, # propagation distribuée)from niaone_sdk.models import Asset, Flow, Branch, Data, JudgeRef, ScoreDetailsfrom niaone_sdk.enums import ( RecordType, AssetKind, AssetRole, FlowPhase, SpanKind, DataRole, DataKind, DataFormat, StandardMetric,)« instrument », pas « flow_step »
Le décorateur/HOF d'auto-step s'appelle instrument. Il n'existe pas de flow_step.
Variables d'environnement
| Variable | Rôle | Défaut |
|---|---|---|
| NIAONE_API_KEY | Clé API (sinon SDK no-op) | — |
| NIAONE_BASE_URL | Endpoint de l'intake | https://api.niaone.com |
| NIAONE_TENANT_ID | Scope multi-tenant | — |
| NIAONE_DISABLED | 1 → client no-op | — |
| NIAONE_SAFE_MODE | 1 → erreurs vers on_error | — |
| NIAONE_SERVICE_NAME | Identité (logique) pour le heartbeat | — |
| NIAONE_INSTANCE_ID | Identité physique de l’instance | hostname:pid |
| NIAONE_HEARTBEAT_INTERVAL | Intervalle heartbeat (s) | 30 |
| NIAONE_HEARTBEAT_DISABLED | true → stoppe le heartbeat | — |
| NIAONE_DISABLE_ENV_DETECTION | true → désactive l'introspection runtime | — |
| NIAONE_REGION | Force la région du SIA (sinon inférée) | — |
| NIAONE_EXTRA_AI_FRAMEWORKS | Frameworks IA custom (CSV logical:pkg) | — |
| NIAONE_EXTRA_DB_CLIENTS | Clients DB custom (CSV logical:pkg) | — |
| NIAONE_EXTRA_VECTOR_STORES | Vector stores custom (CSV logical:pkg) | — |
Endpoints HTTP de l'Intake (appelés par le SDK)
| Méthode | Route | Auth |
|---|---|---|
| POST | /v1/intake/batch | Bearer clé API |
| POST | /v1/intake/record | Bearer clé API |
| POST | /v1/intake/validate | Bearer clé API |
| GET | /v1/intake/health | aucune |
| GET | /v1/intake/capabilities | aucune |
Aller plus loin
Les READMEs du SDK couvrent la taxonomie complète (tous les enums), les configurations d'assets typées (LLM, embedding, vector store, guardrail, cache, prompt), le sampling, le scrubbing PII et le modèle asynchrone :
- Python :
sdk/python/README.md - TypeScript :
sdk/typescript/README.md