@kognitivedev/adapter-ai-sdk
v0.2.28
Published
Vercel AI SDK adapter layer for Kognitive's provider-agnostic runtime
Downloads
340
Maintainers
Readme
@kognitivedev/adapter-ai-sdk
AI SDK bridge for Kognitive's provider-agnostic runtime.
Installation
bun add @kognitivedev/adapter-ai-sdk ai zodWhat It Provides
createAISDKRuntimeAdapter()createAISDKStructuredGenerationAdapter()AISDKEmbeddingProvidertoAISDKTool()toAISDKTools()toAISDKMessages()
Structured output works through both the low-level runtime adapter and the higher-level @kognitivedev/agents API. Zod and raw JSON Schema are both accepted.
Example
import { createAgent } from "@kognitivedev/agents";
import { createAISDKRuntimeAdapter } from "@kognitivedev/adapter-ai-sdk";
import { openai } from "@ai-sdk/openai";
const agent = createAgent({
name: "assistant",
instructions: "You are helpful.",
runtime: createAISDKRuntimeAdapter({
model: openai("gpt-4o-mini"),
}),
});
const result = await agent.generateObject<{ label: string }>({
messages: [{ role: "user", content: "Label this as urgent or normal." }],
resourceId: {},
structuredOutput: {
schema: {
type: "object",
properties: {
label: { type: "string" },
},
required: ["label"],
},
},
});