@genkit-ai/compat-oai
Version:
Genkit AI framework plugin for OpenAI APIs.
72 lines (68 loc) • 2.7 kB
TypeScript
import { z, ModelReference } from 'genkit';
import { GenkitPlugin } from 'genkit/plugin';
import { PluginOptions } from '../index.js';
import { SUPPORTED_DEEPSEEK_MODELS, DeepSeekChatCompletionConfigSchema } from './deepseek.js';
import 'genkit/registry';
import 'openai';
import '../audio.js';
import 'genkit/model';
import 'openai/resources/audio/index.mjs';
import '../embedder.js';
import '../image.js';
import 'openai/resources/images.mjs';
import '../model.js';
import 'openai/resources/index.mjs';
/**
* Copyright 2024 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.
*/
type DeepSeekPluginOptions = Omit<PluginOptions, 'name' | 'baseURL'>;
declare function deepSeekPlugin(options?: DeepSeekPluginOptions): GenkitPlugin;
type DeepSeekPlugin = {
(params?: DeepSeekPluginOptions): GenkitPlugin;
model(name: keyof typeof SUPPORTED_DEEPSEEK_MODELS, config?: z.infer<typeof DeepSeekChatCompletionConfigSchema>): ModelReference<typeof DeepSeekChatCompletionConfigSchema>;
model(name: string, config?: any): ModelReference<z.ZodTypeAny>;
};
/**
* This module provides an interface to the DeepSeek models through the Genkit
* plugin system. It allows users to interact with various models by providing
* an API key and optional configuration.
*
* The main export is the `deepseek` plugin, which can be configured with an API
* key either directly or through environment variables. It initializes the
* OpenAI client and makes available the models for use.
*
* Exports:
* - deepSeek: The main plugin function to interact with DeepSeek, via OpenAI
* compatible API.
*
* Usage: To use the models, initialize the deepseek plugin inside
* `configureGenkit` and pass the configuration options. If no API key is
* provided in the options, the environment variable `OPENAI_API_KEY` must be
* set.
*
* Example:
* ```
* import { deepSeek } from '@genkit-ai/compat-oai/deepseek';
*
* export default configureGenkit({
* plugins: [
* deepSeek()
* ... // other plugins
* ]
* });
* ```
*/
declare const deepSeek: DeepSeekPlugin;
export { type DeepSeekPlugin, type DeepSeekPluginOptions, deepSeek, deepSeekPlugin, deepSeek as default };