@kognitivedev/client
v0.2.28
Published
SDK client for connecting to remote Kognitive runtime servers
Maintainers
Readme
@kognitivedev/client
Remote SDK for Kognitive runtime APIs, including agents, workflows, tools, and cloud document APIs through client.documents().
Document Intelligence
import { KognitiveClient } from "@kognitivedev/client";
const client = new KognitiveClient({ baseUrl: "http://localhost:3001" });
const documents = client.documents();
const file = await documents.files.upload({
data: new TextEncoder().encode("Invoice Number: INV-001"),
filename: "invoice.txt",
mimeType: "text/plain",
});
const parseJob = await documents.parsing.createJob({ fileId: file.id });
const parsed = await documents.parsing.waitForCompletion(parseJob.id);
const configs = await documents.extract.listConfigs();
const pipelines = await documents.pipelines.list();TypeScript client for connecting to Kognitive runtime servers.
Installation
bun add @kognitivedev/clientQuick Start
import { KognitiveClient } from "@kognitivedev/client";
const client = new KognitiveClient({
baseUrl: "http://localhost:3001",
apiKey: "your-api-key",
});
await client.connect();
const result = await client.generateAgent("support", {
messages: [{ role: "user", content: "Help me" }],
});
console.log(result.text);Agents
const agents = await client.listAgents();
const agent = await client.getAgent("support");
const result = await client.generateAgent("support", { messages });
const response = await client.streamAgent("support", {
messages,
streamMode: "values,messages",
});messages use Kognitive's neutral message format, not AI SDK ModelMessage[].
Remote Proxies
const remoteAgent = await client.getRemoteAgent("support");
const result = await remoteAgent.generate({ messages, resourceId });
const streamResponse = await remoteAgent.stream({ messages, resourceId });remoteAgent.stream() returns the raw SSE Response.
