@genkit-ai/compat-oai
Version:
Genkit AI framework plugin for OpenAI APIs.
40 lines (36 loc) • 1.49 kB
text/typescript
import { GenerateRequest } from 'genkit';
import { EmbedRequest } from 'genkit/embedder';
import OpenAI from 'openai';
import { P as PluginOptions } from './audio-CW-qdV9D.mjs';
import 'genkit/model';
import 'openai/core.mjs';
import 'openai/resources/audio/index.mjs';
import 'genkit/plugin';
import 'genkit/registry';
import 'openai/resources/images.mjs';
import 'openai/resources/index.mjs';
/**
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Inspects the request and if apiKey is provided in config, creates a new client.
* Otherwise falls back on the `defaultClient`.
*/
declare function maybeCreateRequestScopedOpenAIClient(pluginOptions: PluginOptions | undefined, request: GenerateRequest | EmbedRequest, defaultClient: OpenAI): OpenAI;
/**
* Gets the model name without certain prefixes.
*/
declare function toModelName(name: string, prefix?: string): string;
export { maybeCreateRequestScopedOpenAIClient, toModelName };