@genkit-ai/compat-oai
Version:
Genkit AI framework plugin for OpenAI APIs.
42 lines (37 loc) • 1.42 kB
text/typescript
import { Genkit, EmbedderReference, EmbedderAction } from 'genkit';
import OpenAI from 'openai';
/**
* Copyright 2024 The Fire Company
* 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.
*/
/**
* Method to define a new Genkit Embedder that is compatibale with the Open AI
* Embeddings API.
*
* @param params An object containing parameters for defining the OpenAI embedder.
* @param params.ai The Genkit AI instance.
* @param params.name The name of the embedder.
* @param params.client The OpenAI client instance.
* @param params.embedderRef Optional reference to the embedder's configuration and
* custom options.
* @returns the created {@link EmbedderAction}
*/
declare function defineCompatOpenAIEmbedder(params: {
ai: Genkit;
name: string;
client: OpenAI;
embedderRef?: EmbedderReference;
}): EmbedderAction;
export { defineCompatOpenAIEmbedder };