
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
genkitx-openai
Advanced tools
This Genkit plugin allows to use OpenAI models through their official APIs.
npm install genkitx-openai
# or
pnpm add genkitx-openai
# or
yarn add genkitx-openai
The plugin depends on Genkit core packages, so make sure to have them installed as well:
npm install @genkit-ai/core @genkit-ai/ai
# or
pnpm add @genkit-ai/core @genkit-ai/ai
# or
yarn add @genkit-ai/core @genkit-ai/ai
import { generate } from '@genkit-ai/ai';
import { configureGenkit } from '@genkit-ai/core';
import { defineFlow, startFlowsServer } from '@genkit-ai/flow';
import { openAI, gpt4o } from 'genkitx-openai';
import * as z from 'zod';
configureGenkit({
plugins: [
// OpenAI API key is required and defaults to the OPENAI_API_KEY environment variable
openAI({ apiKey: process.env.OPENAI_API_KEY }),
],
logLevel: 'debug',
enableTracingAndMetrics: true,
});
export const menuSuggestionFlow = defineFlow(
{
name: 'menuSuggestionFlow',
inputSchema: z.string(),
outputSchema: z.string(),
},
async (subject, streamingCallback) => {
const llmResponse = await generate({
prompt: `Suggest an item for the menu of a ${subject} themed restaurant`,
model: gpt4o,
streamingCallback: ({ content }) => {
streamingCallback?.(content[0]?.text ?? '');
},
});
return llmResponse.text();
},
);
startFlowsServer();
FAQs
Firebase Genkit AI framework plugin for OpenAI APIs.
We found that genkitx-openai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.