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 refactor(js/plugins): implement plugin wrapper that make it easier to work with plugins directly Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants