Document Detail

DZ

SDK Quickstart — JavaScript / TypeScript

SDK Quickstart — JavaScript / TypeScript
TXT
Page 1 of 1
Page 1

SDK Quickstart — JavaScript / TypeScript. Install the official SDK via npm: npm install @acme/sdk. Import the client and initialise it with your API key: import { AcmeClient } from "@acme/sdk"; const client = new AcmeClient({ apiKey: process.env.ACME_API_KEY }). The client automatically handles authentication token refresh, retry logic with exponential backoff, and request signing. To upload a document: const doc = await client.documents.upload({ file: fs.createReadStream("contract.pdf"), collection: "legal-contracts" }). To query across collections: const result = await client.query({ question: "What is the liability cap?", collections: ["legal-contracts"], topK: 5 }). The response includes the generated answer, source citations with page numbers and relevance scores, token usage breakdown, and processing latency. TypeScript type definitions are included in the package and cover all request and response interfaces. The SDK supports both ESM and CommonJS module systems. For server-side usage in Node.js 18+, the SDK uses the built-in fetch API; for older runtimes, a polyfill is automatically applied.

Intelligence

Title

SDK Quickstart — JavaScript / TypeScript

Type

TXT

Pages

6

Words

4,200

Collection

Tech Documentation

Chunks

12

Embedding model

text-embedding-3-large

Total queries

198

Uploaded

Feb 8

Last queried

2h ago