genkitx-ollama
Version:
Genkit AI framework plugin for Ollama APIs.
59 lines (55 loc) • 2.31 kB
text/typescript
import { z, ModelReference, EmbedderReference } from 'genkit';
import { GenkitPlugin } from 'genkit/plugin';
import { OllamaPluginParams } from './types.mjs';
import 'ollama';
/**
* 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 OllamaPlugin = {
(params?: OllamaPluginParams): GenkitPlugin;
model(name: string, config?: z.infer<typeof OllamaConfigSchema>): ModelReference<typeof OllamaConfigSchema>;
embedder(name: string, config?: Record<string, any>): EmbedderReference;
};
/**
* Please refer to: https://github.com/ollama/ollama/blob/main/docs/modelfile.md
* for further information.
*/
declare const OllamaConfigSchema: z.ZodObject<{
version: z.ZodOptional<z.ZodString>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
} & {
temperature: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
topP: z.ZodOptional<z.ZodNumber>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
version: z.ZodOptional<z.ZodString>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
} & {
temperature: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
version: z.ZodOptional<z.ZodString>;
maxOutputTokens: z.ZodOptional<z.ZodNumber>;
stopSequences: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
} & {
temperature: z.ZodOptional<z.ZodNumber>;
topK: z.ZodOptional<z.ZodNumber>;
topP: z.ZodOptional<z.ZodNumber>;
}, z.ZodTypeAny, "passthrough">>;
declare const ollama: OllamaPlugin;
export { OllamaConfigSchema, type OllamaPlugin, OllamaPluginParams, ollama };