@formula-monks/kurt-open-ai
v1.2.0
Published
OpenAI plugin for Kurt - A wrapper for AI SDKs, for building LLM-agnostic structured AI applications
Downloads
226
Keywords
Readme
Kurt Adapter for OpenAI
Kurt is a TypeScript library by Formula.Monks that wraps AI SDKs, making it easy to build structured LLM-based applications (RAG, agents, etc) that work with any LLM that supports structured output (via function calling features).
This package implements an adapter for Kurt that works with OpenAI's GPT models.
Read here for more information about Kurt.
Usage Example
import { Kurt } from "@formula-monks/kurt"
import { KurtOpenAI } from "@formula-monks/kurt-open-ai"
import { OpenAI } from "openai"
import { z } from "zod"
const kurt = new Kurt(
new KurtOpenAI({
openAI: new OpenAI(),
model: "gpt-3.5-turbo-0125", // or any other supported model
})
)
const stream = kurt.generateStructuredData({ // or any other generation method
prompt: "Say hello!",
schema: z.object({
say: z.string().describe("A single word to say"),
}),
})
const { data } = await stream.result
console.log(data) // { say: "hello" }