import { generateTextWithModelId } from "../llm/generate-text.js";
import { resolveGoogleModelForUsage } from "../llm/google-models.js";
export async function resolveModelIdForLlmCall({ parsedModel, apiKeys, fetchImpl, timeoutMs, }) {
    if (parsedModel.provider !== "google") {
        return { modelId: parsedModel.canonical, note: null, forceStreamOff: false };
    }
    const key = apiKeys.googleApiKey;
    if (!key) {
        return { modelId: parsedModel.canonical, note: null, forceStreamOff: false };
    }
    const resolved = await resolveGoogleModelForUsage({
        requestedModelId: parsedModel.model,
        apiKey: key,
        fetchImpl,
        timeoutMs,
    });
    return {
        modelId: `google/${resolved.resolvedModelId}`,
        note: resolved.note,
        forceStreamOff: false,
    };
}
export async function summarizeWithModelId({ modelId, prompt, maxOutputTokens, timeoutMs, fetchImpl, apiKeys, forceOpenRouter, openaiBaseUrlOverride, anthropicBaseUrlOverride, googleBaseUrlOverride, xaiBaseUrlOverride, zaiBaseUrlOverride, ollamaBaseUrlOverride, forceChatCompletions, requestOptions, retries, onRetry, }) {
    const result = await generateTextWithModelId({
        modelId,
        apiKeys,
        forceOpenRouter,
        openaiBaseUrlOverride,
        anthropicBaseUrlOverride,
        googleBaseUrlOverride,
        xaiBaseUrlOverride,
        zaiBaseUrlOverride,
        ollamaBaseUrlOverride,
        forceChatCompletions,
        requestOptions,
        prompt,
        temperature: 0,
        maxOutputTokens,
        timeoutMs,
        fetchImpl,
        retries,
        onRetry,
    });
    return {
        text: result.text,
        provider: result.provider,
        canonicalModelId: result.canonicalModelId,
        usage: result.usage,
    };
}
//# sourceMappingURL=model-call.js.map