Skip to content

Conversation

@pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Sep 11, 2025

BEFORE:

import { openAI } from "@genkit-ai/compat-oai/openai";
import { type ModelAction } from "genkit/model";

const oai = openAI({ apiKey: "..." });
const gpt4o = (await oai.resolve!("model", "gpt-4o")) as ModelAction;
if (!gpt4o) {
  throw new Error(`failed to resolve gpt-4o`);
}
const response = await gpt4o({ messages: [ ... ] });

AFTER:

import { openAI } from "@genkit-ai/compat-oai/openai";

const oai = openAI({ apiKey: "..." });
const gpt4o = await oai.model("gpt-4o"); // will throw if unable to resolve
const response = await gpt4o({ messages: [ ... ] });

Checklist (if applicable):

@pavelgj pavelgj changed the title feat(js/plugins): implement plugin wrapper that make it easier to work with plugins directly Sep 12, 2025
@pavelgj pavelgj merged commit e26423c into main Dec 2, 2025
5 checks passed
@pavelgj pavelgj deleted the pj/plugin-wrapper branch December 2, 2025 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants