Agent LLMs
OpenAI
Agent LLMs
OpenAI
Using OpenAI models with SpinAI
Usage
import { createAgent, createOpenAILLM } from "spinai";
const llm = createOpenAILLM({
apiKey: process.env.OPENAI_API_KEY,
model: "gpt-4-turbo-preview", // Optional
temperature: 0.7, // Optional
});
const agent = createAgent({
instructions: "Help users with support tickets",
actions: [getCustomerInfo, createTicket],
llm,
});
Configuration
interface OpenAIConfig {
apiKey: string;
model?: string; // Defaults to gpt-4-turbo-preview
temperature?: number; // Defaults to 0.7
}
On this page