JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 73
  • Score
    100M100P100Q93877F
  • License MIT

OpenAI adapter for Agentick

Package Exports

  • @agentick/openai
  • @agentick/openai/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@agentick/openai) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@agentick/openai

Native OpenAI adapter for Agentick.

Installation

pnpm add @agentick/openai

Usage

import { openai } from "@agentick/openai";
import { createApp } from "@agentick/core";

const model = openai({ model: "gpt-4o" });

// Use with createApp
const app = createApp(MyAgent, { model });
const session = await app.session();
await session.run({ messages: [{ role: "user", content: [{ type: "text", text: "Hello!" }] }] });

// Or use as JSX component
function MyAgent() {
  return (
    <model temperature={0.9}>
      <System>You are helpful.</System>
      <Timeline />
    </model>
  );
}

// Or call directly
const result = await model.generate({
  messages: [{ role: "user", content: "Hello!" }],
});

JSX Component Pattern

import { OpenAIModel } from "@agentick/openai";

function MyAgent() {
  return (
    <OpenAIModel model="gpt-4o" temperature={0.7} maxTokens={4096}>
      <System>You are helpful.</System>
      <Timeline />
    </OpenAIModel>
  );
}

Azure OpenAI

const model = openai({
  apiKey: process.env.AZURE_OPENAI_KEY,
  baseURL: "https://your-resource.openai.azure.com",
  model: "gpt-4o",
});

Configuration

Option Type Description
model string Model name (e.g., gpt-4o)
apiKey string? OpenAI API key (env: OPENAI_API_KEY)
baseURL string? Custom API endpoint
organization string? OpenAI organization ID
temperature number? Sampling temperature (0-2)
maxTokens number? Maximum tokens to generate

Exports

  • openai(config) - Factory function returning ModelClass
  • createOpenAIModel(config) - Same as openai()
  • OpenAIModel - JSX component for declarative usage