Skip to main content
Version: 0.4.1

Getting Started

The invera SDK streams chat completions in which every generated word carries word-level attributions back to the words of your prompt. This page installs the SDK and streams a first attributed completion against a running invera Engine deployment.

Install​

npm install @layerwise/invera-sdk

Stream your first attributed completion​

Point the client at your Engine deployment. Discovery, compatibility checks, and tokenizer initialization happen lazily on the first request — constructing the client performs no I/O.

import { InveraClient } from "@layerwise/invera-sdk";

const client = new InveraClient({
baseUrl: "https://host.example/api/invera-engine/v1",
});

for await (const chunk of client.chat.completions.stream({
messages: [{ role: "user", content: "What is attention attribution?" }],
maxTokens: 256,
})) {
console.log(chunk.content, chunk.input_attributions);
}

Deploying this default tokenizer in a Node.js container requires a glibc image and an explicitly preserved native dependency tree. Follow the Node.js and Docker deployment guide.

What each chunk contains​

Every streamed chunk is a ready-to-consume fragment:

  • type — text for visible assistant output, or tool_start / tool_delta / tool_end for parsed tool-call fragments.
  • content — the text of this fragment.
  • input_attributions — scored links from this fragment's words back to words of the prompt (messages and tool definitions).
  • output_attributions — scored links to previously generated output words.

How the attribution entries are structured and what the scores mean is covered in Understanding attribution.

Checking the connected model​

client.models.current() returns stable model information for UI and diagnostics without exposing the Engine's raw discovery schema.

Next steps​