import { GenerateOptions, PromptAction, GenerateResponse, GenerateStreamResponse } from '@genkit-ai/ai';
import { GenerationCommonConfigSchema, MessageData } from '@genkit-ai/ai/model';
import { DocumentData } from '@genkit-ai/ai/retriever';
import z from 'zod';
import { PromptFrontmatter, PromptMetadata } from './metadata.js';
import '@genkit-ai/ai/tool';
import '@genkit-ai/core/schema';

/**
 * 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 PromptData = PromptFrontmatter & {
    template: string;
};
type PromptGenerateOptions<V = unknown> = Omit<GenerateOptions<z.ZodTypeAny, typeof GenerationCommonConfigSchema>, 'prompt' | 'model'> & {
    model?: string;
    input?: V;
};
interface RenderMetadata {
    context?: DocumentData[];
    history?: MessageData[];
}
declare class Dotprompt<Variables = unknown> implements PromptMetadata {
    name: string;
    variant?: string;
    hash: string;
    template: string;
    model?: PromptMetadata['model'];
    metadata: PromptMetadata['metadata'];
    input?: PromptMetadata['input'];
    output?: PromptMetadata['output'];
    tools?: PromptMetadata['tools'];
    config?: PromptMetadata['config'];
    candidates?: PromptMetadata['candidates'];
    private _render;
    static parse(name: string, source: string): Dotprompt<unknown>;
    static fromAction(action: PromptAction): Dotprompt;
    constructor(options: PromptMetadata, template: string);
    renderText(input: Variables, options?: RenderMetadata): string;
    renderMessages(input?: Variables, options?: RenderMetadata): MessageData[];
    toJSON(): PromptData;
    define(options?: {
        ns: string;
    }): void;
    private _generateOptions;
    render<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): GenerateOptions<z.ZodTypeAny, O>;
    generate<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): Promise<GenerateResponse<z.infer<O>>>;
    generateStream(opt: PromptGenerateOptions<Variables>): Promise<GenerateStreamResponse>;
}
declare class DotpromptRef<Variables = unknown> {
    name: string;
    variant?: string;
    dir?: string;
    private _prompt?;
    constructor(name: string, options?: {
        variant?: string;
        dir?: string;
    });
    loadPrompt(): Promise<Dotprompt<Variables>>;
    generate<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): Promise<GenerateResponse<z.infer<O>>>;
    render<O extends z.ZodTypeAny = z.ZodTypeAny>(opt: PromptGenerateOptions<Variables>): Promise<GenerateOptions<z.ZodTypeAny, O>>;
}
declare function defineDotprompt<V extends z.ZodTypeAny = z.ZodTypeAny>(options: PromptMetadata<V>, template: string): Dotprompt<z.infer<V>>;

export { Dotprompt, DotpromptRef, type PromptData, type PromptGenerateOptions, defineDotprompt };
