"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.CreateKnowledgeResponseBody$inboundSchema = exports.ResponseBody1$inboundSchema = exports.ResponseBodyRetrievalSettings$inboundSchema = exports.ResponseBodyAgenticRagConfig$inboundSchema = exports.ResponseBodyRerankConfig$inboundSchema = exports.ResponseBodyRetrievalType$inboundSchema = exports.CreateKnowledgeResponseBodyType$inboundSchema = exports.ResponseBody2$inboundSchema = exports.ResponseBodyExternalConfig$inboundSchema = exports.CreateKnowledgeResponseBodyRetrievalSettings$inboundSchema = exports.CreateKnowledgeResponseBodyAgenticRagConfig$inboundSchema = exports.CreateKnowledgeResponseBodyRerankConfig$inboundSchema = exports.CreateKnowledgeResponseBodyKnowledgeType$inboundSchema = exports.CreateKnowledgeRequestBody$outboundSchema = exports.CreateKnowledgeRequestBody1$outboundSchema = exports.RetrievalSettings$outboundSchema = exports.CreateKnowledgeRequestBodyAgenticRagConfig$outboundSchema = exports.CreateKnowledgeRequestBodyRerankConfig$outboundSchema = exports.RetrievalType$outboundSchema = exports.CreateKnowledgeRequestBodyType$outboundSchema = exports.CreateKnowledgeRequestBody2$outboundSchema = exports.ExternalConfig$outboundSchema = exports.CreateKnowledgeRequestBodyKnowledgeType$outboundSchema = exports.ResponseBodyRetrievalType = exports.CreateKnowledgeResponseBodyType = exports.CreateKnowledgeResponseBodyKnowledgeType = exports.RetrievalType = exports.CreateKnowledgeRequestBodyType = exports.CreateKnowledgeRequestBodyKnowledgeType = void 0;
exports.externalConfigToJSON = externalConfigToJSON;
exports.createKnowledgeRequestBody2ToJSON = createKnowledgeRequestBody2ToJSON;
exports.createKnowledgeRequestBodyRerankConfigToJSON = createKnowledgeRequestBodyRerankConfigToJSON;
exports.createKnowledgeRequestBodyAgenticRagConfigToJSON = createKnowledgeRequestBodyAgenticRagConfigToJSON;
exports.retrievalSettingsToJSON = retrievalSettingsToJSON;
exports.createKnowledgeRequestBody1ToJSON = createKnowledgeRequestBody1ToJSON;
exports.createKnowledgeRequestBodyToJSON = createKnowledgeRequestBodyToJSON;
exports.createKnowledgeResponseBodyRerankConfigFromJSON = createKnowledgeResponseBodyRerankConfigFromJSON;
exports.createKnowledgeResponseBodyAgenticRagConfigFromJSON = createKnowledgeResponseBodyAgenticRagConfigFromJSON;
exports.createKnowledgeResponseBodyRetrievalSettingsFromJSON = createKnowledgeResponseBodyRetrievalSettingsFromJSON;
exports.responseBodyExternalConfigFromJSON = responseBodyExternalConfigFromJSON;
exports.responseBody2FromJSON = responseBody2FromJSON;
exports.responseBodyRerankConfigFromJSON = responseBodyRerankConfigFromJSON;
exports.responseBodyAgenticRagConfigFromJSON = responseBodyAgenticRagConfigFromJSON;
exports.responseBodyRetrievalSettingsFromJSON = responseBodyRetrievalSettingsFromJSON;
exports.responseBody1FromJSON = responseBody1FromJSON;
exports.createKnowledgeResponseBodyFromJSON = createKnowledgeResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
exports.CreateKnowledgeRequestBodyKnowledgeType = {
    External: "external",
};
exports.CreateKnowledgeRequestBodyType = {
    Internal: "internal",
};
/**
 * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
 */
exports.RetrievalType = {
    VectorSearch: "vector_search",
    KeywordSearch: "keyword_search",
    HybridSearch: "hybrid_search",
};
exports.CreateKnowledgeResponseBodyKnowledgeType = {
    External: "external",
};
exports.CreateKnowledgeResponseBodyType = {
    Internal: "internal",
};
/**
 * The retrieval type to use for the knowledge base. If not provided, Hybrid Search will be used as a default query strategy.
 */
exports.ResponseBodyRetrievalType = {
    VectorSearch: "vector_search",
    KeywordSearch: "keyword_search",
    HybridSearch: "hybrid_search",
};
/** @internal */
exports.CreateKnowledgeRequestBodyKnowledgeType$outboundSchema = z
    .nativeEnum(exports.CreateKnowledgeRequestBodyKnowledgeType);
/** @internal */
exports.ExternalConfig$outboundSchema = z.object({
    name: z.string(),
    apiUrl: z.string(),
    apiKey: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        apiUrl: "api_url",
        apiKey: "api_key",
    });
});
function externalConfigToJSON(externalConfig) {
    return JSON.stringify(exports.ExternalConfig$outboundSchema.parse(externalConfig));
}
/** @internal */
exports.CreateKnowledgeRequestBody2$outboundSchema = z.object({
    type: exports.CreateKnowledgeRequestBodyKnowledgeType$outboundSchema.default("external"),
    key: z.string(),
    description: z.string().optional(),
    externalConfig: z.lazy(() => exports.ExternalConfig$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        externalConfig: "external_config",
    });
});
function createKnowledgeRequestBody2ToJSON(createKnowledgeRequestBody2) {
    return JSON.stringify(exports.CreateKnowledgeRequestBody2$outboundSchema.parse(createKnowledgeRequestBody2));
}
/** @internal */
exports.CreateKnowledgeRequestBodyType$outboundSchema = z.nativeEnum(exports.CreateKnowledgeRequestBodyType);
/** @internal */
exports.RetrievalType$outboundSchema = z.nativeEnum(exports.RetrievalType);
/** @internal */
exports.CreateKnowledgeRequestBodyRerankConfig$outboundSchema = z.object({
    topK: z.number().int().default(5),
    rerankThreshold: z.number().default(0.5),
    rerankModel: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        topK: "top_k",
        rerankThreshold: "rerank_threshold",
        rerankModel: "rerank_model",
    });
});
function createKnowledgeRequestBodyRerankConfigToJSON(createKnowledgeRequestBodyRerankConfig) {
    return JSON.stringify(exports.CreateKnowledgeRequestBodyRerankConfig$outboundSchema.parse(createKnowledgeRequestBodyRerankConfig));
}
/** @internal */
exports.CreateKnowledgeRequestBodyAgenticRagConfig$outboundSchema = z.object({
    model: z.string(),
});
function createKnowledgeRequestBodyAgenticRagConfigToJSON(createKnowledgeRequestBodyAgenticRagConfig) {
    return JSON.stringify(exports.CreateKnowledgeRequestBodyAgenticRagConfig$outboundSchema.parse(createKnowledgeRequestBodyAgenticRagConfig));
}
/** @internal */
exports.RetrievalSettings$outboundSchema = z.object({
    retrievalType: exports.RetrievalType$outboundSchema.default("hybrid_search"),
    topK: z.number().int().default(5),
    threshold: z.number().default(0),
    rerankConfig: z.nullable(z.lazy(() => exports.CreateKnowledgeRequestBodyRerankConfig$outboundSchema)).optional(),
    agenticRagConfig: z.nullable(z.lazy(() => exports.CreateKnowledgeRequestBodyAgenticRagConfig$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        retrievalType: "retrieval_type",
        topK: "top_k",
        rerankConfig: "rerank_config",
        agenticRagConfig: "agentic_rag_config",
    });
});
function retrievalSettingsToJSON(retrievalSettings) {
    return JSON.stringify(exports.RetrievalSettings$outboundSchema.parse(retrievalSettings));
}
/** @internal */
exports.CreateKnowledgeRequestBody1$outboundSchema = z.object({
    type: exports.CreateKnowledgeRequestBodyType$outboundSchema.default("internal"),
    key: z.string(),
    description: z.string().optional(),
    embeddingModel: z.string(),
    retrievalSettings: z.lazy(() => exports.RetrievalSettings$outboundSchema).optional(),
    path: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        embeddingModel: "embedding_model",
        retrievalSettings: "retrieval_settings",
    });
});
function createKnowledgeRequestBody1ToJSON(createKnowledgeRequestBody1) {
    return JSON.stringify(exports.CreateKnowledgeRequestBody1$outboundSchema.parse(createKnowledgeRequestBody1));
}
/** @internal */
exports.CreateKnowledgeRequestBody$outboundSchema = z.union([
    z.lazy(() => exports.CreateKnowledgeRequestBody1$outboundSchema),
    z.lazy(() => exports.CreateKnowledgeRequestBody2$outboundSchema),
]);
function createKnowledgeRequestBodyToJSON(createKnowledgeRequestBody) {
    return JSON.stringify(exports.CreateKnowledgeRequestBody$outboundSchema.parse(createKnowledgeRequestBody));
}
/** @internal */
exports.CreateKnowledgeResponseBodyKnowledgeType$inboundSchema = z
    .nativeEnum(exports.CreateKnowledgeResponseBodyKnowledgeType);
/** @internal */
exports.CreateKnowledgeResponseBodyRerankConfig$inboundSchema = z.object({
    top_k: z.number().int().default(5),
    rerank_threshold: z.number().default(0.5),
    rerank_model: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "top_k": "topK",
        "rerank_threshold": "rerankThreshold",
        "rerank_model": "rerankModel",
    });
});
function createKnowledgeResponseBodyRerankConfigFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateKnowledgeResponseBodyRerankConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateKnowledgeResponseBodyRerankConfig' from JSON`);
}
/** @internal */
exports.CreateKnowledgeResponseBodyAgenticRagConfig$inboundSchema = z.object({
    model: z.string(),
});
function createKnowledgeResponseBodyAgenticRagConfigFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateKnowledgeResponseBodyAgenticRagConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateKnowledgeResponseBodyAgenticRagConfig' from JSON`);
}
/** @internal */
exports.CreateKnowledgeResponseBodyRetrievalSettings$inboundSchema = z.object({
    top_k: z.number().int().default(5),
    threshold: z.number().default(0),
    rerank_config: z.nullable(z.lazy(() => exports.CreateKnowledgeResponseBodyRerankConfig$inboundSchema)).optional(),
    agentic_rag_config: z.nullable(z.lazy(() => exports.CreateKnowledgeResponseBodyAgenticRagConfig$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "top_k": "topK",
        "rerank_config": "rerankConfig",
        "agentic_rag_config": "agenticRagConfig",
    });
});
function createKnowledgeResponseBodyRetrievalSettingsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateKnowledgeResponseBodyRetrievalSettings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateKnowledgeResponseBodyRetrievalSettings' from JSON`);
}
/** @internal */
exports.ResponseBodyExternalConfig$inboundSchema = z.object({
    name: z.string(),
    api_url: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "api_url": "apiUrl",
    });
});
function responseBodyExternalConfigFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBodyExternalConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyExternalConfig' from JSON`);
}
/** @internal */
exports.ResponseBody2$inboundSchema = z.object({
    _id: z.string(),
    created: z.string(),
    description: z.string().optional(),
    key: z.string(),
    domain_id: z.string(),
    path: z.string().optional(),
    created_by_id: z.nullable(z.string()).optional(),
    updated_by_id: z.nullable(z.string()).optional(),
    updated: z.string(),
    type: exports.CreateKnowledgeResponseBodyKnowledgeType$inboundSchema.default("external"),
    retrieval_settings: z.lazy(() => exports.CreateKnowledgeResponseBodyRetrievalSettings$inboundSchema).optional(),
    external_config: z.lazy(() => exports.ResponseBodyExternalConfig$inboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "domain_id": "domainId",
        "created_by_id": "createdById",
        "updated_by_id": "updatedById",
        "retrieval_settings": "retrievalSettings",
        "external_config": "externalConfig",
    });
});
function responseBody2FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBody2' from JSON`);
}
/** @internal */
exports.CreateKnowledgeResponseBodyType$inboundSchema = z.nativeEnum(exports.CreateKnowledgeResponseBodyType);
/** @internal */
exports.ResponseBodyRetrievalType$inboundSchema = z.nativeEnum(exports.ResponseBodyRetrievalType);
/** @internal */
exports.ResponseBodyRerankConfig$inboundSchema = z.object({
    top_k: z.number().int().default(5),
    rerank_threshold: z.number().default(0.5),
    rerank_model: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "top_k": "topK",
        "rerank_threshold": "rerankThreshold",
        "rerank_model": "rerankModel",
    });
});
function responseBodyRerankConfigFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBodyRerankConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyRerankConfig' from JSON`);
}
/** @internal */
exports.ResponseBodyAgenticRagConfig$inboundSchema = z.object({
    model: z.string(),
});
function responseBodyAgenticRagConfigFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBodyAgenticRagConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyAgenticRagConfig' from JSON`);
}
/** @internal */
exports.ResponseBodyRetrievalSettings$inboundSchema = z.object({
    retrieval_type: exports.ResponseBodyRetrievalType$inboundSchema.default("hybrid_search"),
    top_k: z.number().int().default(5),
    threshold: z.number().default(0),
    rerank_config: z.nullable(z.lazy(() => exports.ResponseBodyRerankConfig$inboundSchema)).optional(),
    agentic_rag_config: z.nullable(z.lazy(() => exports.ResponseBodyAgenticRagConfig$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "retrieval_type": "retrievalType",
        "top_k": "topK",
        "rerank_config": "rerankConfig",
        "agentic_rag_config": "agenticRagConfig",
    });
});
function responseBodyRetrievalSettingsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBodyRetrievalSettings$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBodyRetrievalSettings' from JSON`);
}
/** @internal */
exports.ResponseBody1$inboundSchema = z.object({
    _id: z.string(),
    created: z.string(),
    description: z.string().optional(),
    key: z.string(),
    domain_id: z.string(),
    path: z.string().optional(),
    created_by_id: z.nullable(z.string()).optional(),
    updated_by_id: z.nullable(z.string()).optional(),
    updated: z.string(),
    type: exports.CreateKnowledgeResponseBodyType$inboundSchema.default("internal"),
    retrieval_settings: z.lazy(() => exports.ResponseBodyRetrievalSettings$inboundSchema)
        .optional(),
    model: z.string(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "domain_id": "domainId",
        "created_by_id": "createdById",
        "updated_by_id": "updatedById",
        "retrieval_settings": "retrievalSettings",
    });
});
function responseBody1FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ResponseBody1' from JSON`);
}
/** @internal */
exports.CreateKnowledgeResponseBody$inboundSchema = z.union([
    z.lazy(() => exports.ResponseBody1$inboundSchema),
    z.lazy(() => exports.ResponseBody2$inboundSchema),
]);
function createKnowledgeResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateKnowledgeResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateKnowledgeResponseBody' from JSON`);
}
//# sourceMappingURL=createknowledge.js.map