"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.ParseResponseBody$inboundSchema = exports.Chunks$inboundSchema = exports.ParseMetadata$inboundSchema = exports.ParseChunkingRequest$outboundSchema = exports.TokenChunkerStrategy$outboundSchema = exports.ReturnTypeT$outboundSchema = exports.SentenceChunkerStrategy$outboundSchema = exports.ChunkingRequestReturnType$outboundSchema = exports.RecursiveChunkerStrategy$outboundSchema = exports.ParseChunkingRequestReturnType$outboundSchema = exports.SemanticChunkerStrategy$outboundSchema = exports.ChunkingRequestMode$outboundSchema = exports.Threshold$outboundSchema = exports.Threshold2$outboundSchema = exports.ParseChunkingRequestChunkingReturnType$outboundSchema = exports.AgenticChunkerStrategy$outboundSchema = exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema = exports.FastChunkerStrategy$outboundSchema = exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType$outboundSchema = exports.ReturnTypeT = exports.ChunkingRequestReturnType = exports.ParseChunkingRequestReturnType = exports.ChunkingRequestMode = exports.Threshold2 = exports.ParseChunkingRequestChunkingReturnType = exports.ParseChunkingRequestChunkingRequestReturnType = exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType = void 0;
exports.fastChunkerStrategyToJSON = fastChunkerStrategyToJSON;
exports.agenticChunkerStrategyToJSON = agenticChunkerStrategyToJSON;
exports.thresholdToJSON = thresholdToJSON;
exports.semanticChunkerStrategyToJSON = semanticChunkerStrategyToJSON;
exports.recursiveChunkerStrategyToJSON = recursiveChunkerStrategyToJSON;
exports.sentenceChunkerStrategyToJSON = sentenceChunkerStrategyToJSON;
exports.tokenChunkerStrategyToJSON = tokenChunkerStrategyToJSON;
exports.parseChunkingRequestToJSON = parseChunkingRequestToJSON;
exports.parseMetadataFromJSON = parseMetadataFromJSON;
exports.chunksFromJSON = chunksFromJSON;
exports.parseResponseBodyFromJSON = parseResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestChunkingReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.Threshold2 = {
    Auto: "auto",
};
/**
 * Chunking mode: window-based or sentence-based similarity
 */
exports.ChunkingRequestMode = {
    Window: "window",
    Sentence: "sentence",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ReturnTypeT = {
    Chunks: "chunks",
    Texts: "texts",
};
/** @internal */
exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType$outboundSchema = z.nativeEnum(exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType);
/** @internal */
exports.FastChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestChunkingRequestRequestBodyReturnType$outboundSchema
        .default("chunks"),
    strategy: z.literal("fast"),
    targetSize: z.number().int().default(4096),
    delimiters: z.string().default("\n.?"),
    pattern: z.string().optional(),
    prefix: z.boolean().default(false),
    consecutive: z.boolean().default(false),
    forwardFallback: z.boolean().default(false),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        targetSize: "target_size",
        forwardFallback: "forward_fallback",
    });
});
function fastChunkerStrategyToJSON(fastChunkerStrategy) {
    return JSON.stringify(exports.FastChunkerStrategy$outboundSchema.parse(fastChunkerStrategy));
}
/** @internal */
exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema = z
    .nativeEnum(exports.ParseChunkingRequestChunkingRequestReturnType);
/** @internal */
exports.AgenticChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema
        .default("chunks"),
    strategy: z.literal("agentic"),
    model: z.string(),
    chunkSize: z.number().int().default(1024),
    candidateSize: z.number().int().default(128),
    minCharactersPerChunk: z.number().int().default(24),
    systemPrompt: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        candidateSize: "candidate_size",
        minCharactersPerChunk: "min_characters_per_chunk",
        systemPrompt: "system_prompt",
    });
});
function agenticChunkerStrategyToJSON(agenticChunkerStrategy) {
    return JSON.stringify(exports.AgenticChunkerStrategy$outboundSchema.parse(agenticChunkerStrategy));
}
/** @internal */
exports.ParseChunkingRequestChunkingReturnType$outboundSchema = z.nativeEnum(exports.ParseChunkingRequestChunkingReturnType);
/** @internal */
exports.Threshold2$outboundSchema = z
    .nativeEnum(exports.Threshold2);
/** @internal */
exports.Threshold$outboundSchema = z.union([z.number(), exports.Threshold2$outboundSchema]);
function thresholdToJSON(threshold) {
    return JSON.stringify(exports.Threshold$outboundSchema.parse(threshold));
}
/** @internal */
exports.ChunkingRequestMode$outboundSchema = z.nativeEnum(exports.ChunkingRequestMode);
/** @internal */
exports.SemanticChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestChunkingReturnType$outboundSchema.default("chunks"),
    strategy: z.literal("semantic"),
    chunkSize: z.number().int().default(512),
    threshold: z.union([z.number(), exports.Threshold2$outboundSchema]).optional(),
    embeddingModel: z.string(),
    dimensions: z.number().int().optional(),
    maxTokens: z.number().int().optional(),
    mode: exports.ChunkingRequestMode$outboundSchema.default("window"),
    similarityWindow: z.number().int().default(1),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        embeddingModel: "embedding_model",
        maxTokens: "max_tokens",
        similarityWindow: "similarity_window",
    });
});
function semanticChunkerStrategyToJSON(semanticChunkerStrategy) {
    return JSON.stringify(exports.SemanticChunkerStrategy$outboundSchema.parse(semanticChunkerStrategy));
}
/** @internal */
exports.ParseChunkingRequestReturnType$outboundSchema = z.nativeEnum(exports.ParseChunkingRequestReturnType);
/** @internal */
exports.RecursiveChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestReturnType$outboundSchema.default("chunks"),
    strategy: z.literal("recursive"),
    chunkSize: z.number().int().default(512),
    separators: z.array(z.string()).optional(),
    minCharactersPerChunk: z.number().int().default(24),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        minCharactersPerChunk: "min_characters_per_chunk",
    });
});
function recursiveChunkerStrategyToJSON(recursiveChunkerStrategy) {
    return JSON.stringify(exports.RecursiveChunkerStrategy$outboundSchema.parse(recursiveChunkerStrategy));
}
/** @internal */
exports.ChunkingRequestReturnType$outboundSchema = z.nativeEnum(exports.ChunkingRequestReturnType);
/** @internal */
exports.SentenceChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ChunkingRequestReturnType$outboundSchema.default("chunks"),
    strategy: z.literal("sentence"),
    chunkSize: z.number().int().default(512),
    chunkOverlap: z.number().int().default(0),
    minSentencesPerChunk: z.number().int().default(1),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        chunkOverlap: "chunk_overlap",
        minSentencesPerChunk: "min_sentences_per_chunk",
    });
});
function sentenceChunkerStrategyToJSON(sentenceChunkerStrategy) {
    return JSON.stringify(exports.SentenceChunkerStrategy$outboundSchema.parse(sentenceChunkerStrategy));
}
/** @internal */
exports.ReturnTypeT$outboundSchema = z
    .nativeEnum(exports.ReturnTypeT);
/** @internal */
exports.TokenChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ReturnTypeT$outboundSchema.default("chunks"),
    strategy: z.literal("token"),
    chunkSize: z.number().int().default(512),
    chunkOverlap: z.number().int().default(0),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        chunkOverlap: "chunk_overlap",
    });
});
function tokenChunkerStrategyToJSON(tokenChunkerStrategy) {
    return JSON.stringify(exports.TokenChunkerStrategy$outboundSchema.parse(tokenChunkerStrategy));
}
/** @internal */
exports.ParseChunkingRequest$outboundSchema = z.union([
    z.lazy(() => exports.TokenChunkerStrategy$outboundSchema),
    z.lazy(() => exports.SentenceChunkerStrategy$outboundSchema),
    z.lazy(() => exports.RecursiveChunkerStrategy$outboundSchema),
    z.lazy(() => exports.SemanticChunkerStrategy$outboundSchema),
    z.lazy(() => exports.AgenticChunkerStrategy$outboundSchema),
    z.lazy(() => exports.FastChunkerStrategy$outboundSchema),
]);
function parseChunkingRequestToJSON(parseChunkingRequest) {
    return JSON.stringify(exports.ParseChunkingRequest$outboundSchema.parse(parseChunkingRequest));
}
/** @internal */
exports.ParseMetadata$inboundSchema = z.object({
    start_index: z.nullable(z.number()),
    end_index: z.nullable(z.number()),
    token_count: z.nullable(z.number()),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "start_index": "startIndex",
        "end_index": "endIndex",
        "token_count": "tokenCount",
    });
});
function parseMetadataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParseMetadata$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParseMetadata' from JSON`);
}
/** @internal */
exports.Chunks$inboundSchema = z
    .object({
    text: z.string(),
    index: z.number(),
    metadata: z.lazy(() => exports.ParseMetadata$inboundSchema).optional(),
});
function chunksFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Chunks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Chunks' from JSON`);
}
/** @internal */
exports.ParseResponseBody$inboundSchema = z.object({
    chunks: z.array(z.lazy(() => exports.Chunks$inboundSchema)),
});
function parseResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParseResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParseResponseBody' from JSON`);
}
//# sourceMappingURL=parse.js.map