"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateRerankResponseBody$inboundSchema = exports.CreateRerankUsage$inboundSchema = exports.CreateRerankResults$inboundSchema = exports.CreateRerankDocument$inboundSchema = exports.CreateRerankRouterRerankObject$inboundSchema = exports.CreateRerankObject$inboundSchema = exports.CreateRerankRequestBody$outboundSchema = exports.CreateRerankOrq$outboundSchema = exports.CreateRerankRouterRerankTimeout$outboundSchema = exports.CreateRerankRouterRerankLoadBalancer$outboundSchema = exports.CreateRerankLoadBalancerRouterRerank1$outboundSchema = exports.CreateRerankLoadBalancerRouterRerankModels$outboundSchema = exports.CreateRerankLoadBalancerRouterRerankType$outboundSchema = exports.CreateRerankRouterRerankRetry$outboundSchema = exports.CreateRerankRouterRerankCache$outboundSchema = exports.CreateRerankRouterRerankType$outboundSchema = exports.CreateRerankRouterRerankFallbacks$outboundSchema = exports.CreateRerankTimeout$outboundSchema = exports.CreateRerankLoadBalancer$outboundSchema = exports.CreateRerankLoadBalancer1$outboundSchema = exports.CreateRerankLoadBalancerModels$outboundSchema = exports.CreateRerankLoadBalancerType$outboundSchema = exports.CreateRerankCache$outboundSchema = exports.CreateRerankType$outboundSchema = exports.CreateRerankRetry$outboundSchema = exports.CreateRerankFallbacks$outboundSchema = exports.CreateRerankRouterRerankObject = exports.CreateRerankObject = exports.CreateRerankLoadBalancerRouterRerankType = exports.CreateRerankRouterRerankType = exports.CreateRerankLoadBalancerType = exports.CreateRerankType = void 0;
exports.createRerankFallbacksToJSON = createRerankFallbacksToJSON;
exports.createRerankRetryToJSON = createRerankRetryToJSON;
exports.createRerankCacheToJSON = createRerankCacheToJSON;
exports.createRerankLoadBalancerModelsToJSON = createRerankLoadBalancerModelsToJSON;
exports.createRerankLoadBalancer1ToJSON = createRerankLoadBalancer1ToJSON;
exports.createRerankLoadBalancerToJSON = createRerankLoadBalancerToJSON;
exports.createRerankTimeoutToJSON = createRerankTimeoutToJSON;
exports.createRerankRouterRerankFallbacksToJSON = createRerankRouterRerankFallbacksToJSON;
exports.createRerankRouterRerankCacheToJSON = createRerankRouterRerankCacheToJSON;
exports.createRerankRouterRerankRetryToJSON = createRerankRouterRerankRetryToJSON;
exports.createRerankLoadBalancerRouterRerankModelsToJSON = createRerankLoadBalancerRouterRerankModelsToJSON;
exports.createRerankLoadBalancerRouterRerank1ToJSON = createRerankLoadBalancerRouterRerank1ToJSON;
exports.createRerankRouterRerankLoadBalancerToJSON = createRerankRouterRerankLoadBalancerToJSON;
exports.createRerankRouterRerankTimeoutToJSON = createRerankRouterRerankTimeoutToJSON;
exports.createRerankOrqToJSON = createRerankOrqToJSON;
exports.createRerankRequestBodyToJSON = createRerankRequestBodyToJSON;
exports.createRerankDocumentFromJSON = createRerankDocumentFromJSON;
exports.createRerankResultsFromJSON = createRerankResultsFromJSON;
exports.createRerankUsageFromJSON = createRerankUsageFromJSON;
exports.createRerankResponseBodyFromJSON = createRerankResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const components = __importStar(require("../components/index.js"));
exports.CreateRerankType = {
    ExactMatch: "exact_match",
};
exports.CreateRerankLoadBalancerType = {
    WeightBased: "weight_based",
};
exports.CreateRerankRouterRerankType = {
    ExactMatch: "exact_match",
};
exports.CreateRerankLoadBalancerRouterRerankType = {
    WeightBased: "weight_based",
};
exports.CreateRerankObject = {
    List: "list",
};
/**
 * The object type, which is always `rerank`.
 */
exports.CreateRerankRouterRerankObject = {
    Rerank: "rerank",
};
/** @internal */
exports.CreateRerankFallbacks$outboundSchema = z.object({
    model: z.string(),
});
function createRerankFallbacksToJSON(createRerankFallbacks) {
    return JSON.stringify(exports.CreateRerankFallbacks$outboundSchema.parse(createRerankFallbacks));
}
/** @internal */
exports.CreateRerankRetry$outboundSchema = z.object({
    count: z.number().default(3),
    onCodes: z.array(z.number()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        onCodes: "on_codes",
    });
});
function createRerankRetryToJSON(createRerankRetry) {
    return JSON.stringify(exports.CreateRerankRetry$outboundSchema.parse(createRerankRetry));
}
/** @internal */
exports.CreateRerankType$outboundSchema = z.nativeEnum(exports.CreateRerankType);
/** @internal */
exports.CreateRerankCache$outboundSchema = z.object({
    ttl: z.number().default(1800),
    type: exports.CreateRerankType$outboundSchema,
});
function createRerankCacheToJSON(createRerankCache) {
    return JSON.stringify(exports.CreateRerankCache$outboundSchema.parse(createRerankCache));
}
/** @internal */
exports.CreateRerankLoadBalancerType$outboundSchema = z.nativeEnum(exports.CreateRerankLoadBalancerType);
/** @internal */
exports.CreateRerankLoadBalancerModels$outboundSchema = z.object({
    model: z.string(),
    weight: z.number().default(0.5),
});
function createRerankLoadBalancerModelsToJSON(createRerankLoadBalancerModels) {
    return JSON.stringify(exports.CreateRerankLoadBalancerModels$outboundSchema.parse(createRerankLoadBalancerModels));
}
/** @internal */
exports.CreateRerankLoadBalancer1$outboundSchema = z.object({
    type: exports.CreateRerankLoadBalancerType$outboundSchema,
    models: z.array(z.lazy(() => exports.CreateRerankLoadBalancerModels$outboundSchema)),
});
function createRerankLoadBalancer1ToJSON(createRerankLoadBalancer1) {
    return JSON.stringify(exports.CreateRerankLoadBalancer1$outboundSchema.parse(createRerankLoadBalancer1));
}
/** @internal */
exports.CreateRerankLoadBalancer$outboundSchema = z.lazy(() => exports.CreateRerankLoadBalancer1$outboundSchema);
function createRerankLoadBalancerToJSON(createRerankLoadBalancer) {
    return JSON.stringify(exports.CreateRerankLoadBalancer$outboundSchema.parse(createRerankLoadBalancer));
}
/** @internal */
exports.CreateRerankTimeout$outboundSchema = z.object({
    callTimeout: z.number(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        callTimeout: "call_timeout",
    });
});
function createRerankTimeoutToJSON(createRerankTimeout) {
    return JSON.stringify(exports.CreateRerankTimeout$outboundSchema.parse(createRerankTimeout));
}
/** @internal */
exports.CreateRerankRouterRerankFallbacks$outboundSchema = z.object({
    model: z.string(),
});
function createRerankRouterRerankFallbacksToJSON(createRerankRouterRerankFallbacks) {
    return JSON.stringify(exports.CreateRerankRouterRerankFallbacks$outboundSchema.parse(createRerankRouterRerankFallbacks));
}
/** @internal */
exports.CreateRerankRouterRerankType$outboundSchema = z.nativeEnum(exports.CreateRerankRouterRerankType);
/** @internal */
exports.CreateRerankRouterRerankCache$outboundSchema = z.object({
    ttl: z.number().default(1800),
    type: exports.CreateRerankRouterRerankType$outboundSchema,
});
function createRerankRouterRerankCacheToJSON(createRerankRouterRerankCache) {
    return JSON.stringify(exports.CreateRerankRouterRerankCache$outboundSchema.parse(createRerankRouterRerankCache));
}
/** @internal */
exports.CreateRerankRouterRerankRetry$outboundSchema = z.object({
    count: z.number().default(3),
    onCodes: z.array(z.number()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        onCodes: "on_codes",
    });
});
function createRerankRouterRerankRetryToJSON(createRerankRouterRerankRetry) {
    return JSON.stringify(exports.CreateRerankRouterRerankRetry$outboundSchema.parse(createRerankRouterRerankRetry));
}
/** @internal */
exports.CreateRerankLoadBalancerRouterRerankType$outboundSchema = z
    .nativeEnum(exports.CreateRerankLoadBalancerRouterRerankType);
/** @internal */
exports.CreateRerankLoadBalancerRouterRerankModels$outboundSchema = z.object({
    model: z.string(),
    weight: z.number().default(0.5),
});
function createRerankLoadBalancerRouterRerankModelsToJSON(createRerankLoadBalancerRouterRerankModels) {
    return JSON.stringify(exports.CreateRerankLoadBalancerRouterRerankModels$outboundSchema.parse(createRerankLoadBalancerRouterRerankModels));
}
/** @internal */
exports.CreateRerankLoadBalancerRouterRerank1$outboundSchema = z.object({
    type: exports.CreateRerankLoadBalancerRouterRerankType$outboundSchema,
    models: z.array(z.lazy(() => exports.CreateRerankLoadBalancerRouterRerankModels$outboundSchema)),
});
function createRerankLoadBalancerRouterRerank1ToJSON(createRerankLoadBalancerRouterRerank1) {
    return JSON.stringify(exports.CreateRerankLoadBalancerRouterRerank1$outboundSchema.parse(createRerankLoadBalancerRouterRerank1));
}
/** @internal */
exports.CreateRerankRouterRerankLoadBalancer$outboundSchema = z.lazy(() => exports.CreateRerankLoadBalancerRouterRerank1$outboundSchema);
function createRerankRouterRerankLoadBalancerToJSON(createRerankRouterRerankLoadBalancer) {
    return JSON.stringify(exports.CreateRerankRouterRerankLoadBalancer$outboundSchema.parse(createRerankRouterRerankLoadBalancer));
}
/** @internal */
exports.CreateRerankRouterRerankTimeout$outboundSchema = z.object({
    callTimeout: z.number(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        callTimeout: "call_timeout",
    });
});
function createRerankRouterRerankTimeoutToJSON(createRerankRouterRerankTimeout) {
    return JSON.stringify(exports.CreateRerankRouterRerankTimeout$outboundSchema.parse(createRerankRouterRerankTimeout));
}
/** @internal */
exports.CreateRerankOrq$outboundSchema = z.object({
    name: z.string().optional(),
    fallbacks: z.array(z.lazy(() => exports.CreateRerankRouterRerankFallbacks$outboundSchema)).optional(),
    cache: z.lazy(() => exports.CreateRerankRouterRerankCache$outboundSchema).optional(),
    retry: z.lazy(() => exports.CreateRerankRouterRerankRetry$outboundSchema).optional(),
    identity: components.PublicIdentity$outboundSchema.optional(),
    contact: components.PublicContact$outboundSchema.optional(),
    loadBalancer: z.lazy(() => exports.CreateRerankLoadBalancerRouterRerank1$outboundSchema).optional(),
    timeout: z.lazy(() => exports.CreateRerankRouterRerankTimeout$outboundSchema)
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        loadBalancer: "load_balancer",
    });
});
function createRerankOrqToJSON(createRerankOrq) {
    return JSON.stringify(exports.CreateRerankOrq$outboundSchema.parse(createRerankOrq));
}
/** @internal */
exports.CreateRerankRequestBody$outboundSchema = z.object({
    query: z.string(),
    documents: z.array(z.string()),
    model: z.string(),
    topN: z.number().optional(),
    filename: z.nullable(z.string()).optional(),
    name: z.string().optional(),
    fallbacks: z.array(z.lazy(() => exports.CreateRerankFallbacks$outboundSchema))
        .optional(),
    retry: z.lazy(() => exports.CreateRerankRetry$outboundSchema).optional(),
    cache: z.lazy(() => exports.CreateRerankCache$outboundSchema).optional(),
    loadBalancer: z.lazy(() => exports.CreateRerankLoadBalancer1$outboundSchema)
        .optional(),
    timeout: z.lazy(() => exports.CreateRerankTimeout$outboundSchema).optional(),
    orq: z.lazy(() => exports.CreateRerankOrq$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        topN: "top_n",
        loadBalancer: "load_balancer",
    });
});
function createRerankRequestBodyToJSON(createRerankRequestBody) {
    return JSON.stringify(exports.CreateRerankRequestBody$outboundSchema.parse(createRerankRequestBody));
}
/** @internal */
exports.CreateRerankObject$inboundSchema = z.nativeEnum(exports.CreateRerankObject);
/** @internal */
exports.CreateRerankRouterRerankObject$inboundSchema = z.nativeEnum(exports.CreateRerankRouterRerankObject);
/** @internal */
exports.CreateRerankDocument$inboundSchema = z.object({
    text: z.string(),
});
function createRerankDocumentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateRerankDocument$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRerankDocument' from JSON`);
}
/** @internal */
exports.CreateRerankResults$inboundSchema = z.object({
    object: exports.CreateRerankRouterRerankObject$inboundSchema,
    index: z.number(),
    relevance_score: z.number(),
    document: z.lazy(() => exports.CreateRerankDocument$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "relevance_score": "relevanceScore",
    });
});
function createRerankResultsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateRerankResults$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRerankResults' from JSON`);
}
/** @internal */
exports.CreateRerankUsage$inboundSchema = z.object({
    total_tokens: z.number(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "total_tokens": "totalTokens",
    });
});
function createRerankUsageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateRerankUsage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRerankUsage' from JSON`);
}
/** @internal */
exports.CreateRerankResponseBody$inboundSchema = z.object({
    id: z.string().optional(),
    object: exports.CreateRerankObject$inboundSchema,
    results: z.array(z.lazy(() => exports.CreateRerankResults$inboundSchema)),
    usage: z.lazy(() => exports.CreateRerankUsage$inboundSchema).optional(),
});
function createRerankResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateRerankResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRerankResponseBody' from JSON`);
}
//# sourceMappingURL=creatererank.js.map