"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.ParseChunkingRequest$outboundSchema = exports.ParseChunkingRequest$inboundSchema = exports.TokenChunkerStrategy$outboundSchema = exports.TokenChunkerStrategy$inboundSchema = exports.TokenChunker$outboundSchema = exports.TokenChunker$inboundSchema = exports.ReturnTypeT$outboundSchema = exports.ReturnTypeT$inboundSchema = exports.SentenceChunkerStrategy$outboundSchema = exports.SentenceChunkerStrategy$inboundSchema = exports.SentenceChunker$outboundSchema = exports.SentenceChunker$inboundSchema = exports.ChunkingRequestReturnType$outboundSchema = exports.ChunkingRequestReturnType$inboundSchema = exports.RecursiveChunkerStrategy$outboundSchema = exports.RecursiveChunkerStrategy$inboundSchema = exports.RecursiveChunker$outboundSchema = exports.RecursiveChunker$inboundSchema = exports.ParseChunkingRequestReturnType$outboundSchema = exports.ParseChunkingRequestReturnType$inboundSchema = exports.SemanticChunkerStrategy$outboundSchema = exports.SemanticChunkerStrategy$inboundSchema = exports.Mode$outboundSchema = exports.Mode$inboundSchema = exports.Threshold$outboundSchema = exports.Threshold$inboundSchema = exports.Threshold2$outboundSchema = exports.Threshold2$inboundSchema = exports.SemanticChunker$outboundSchema = exports.SemanticChunker$inboundSchema = exports.ParseChunkingRequestChunkingReturnType$outboundSchema = exports.ParseChunkingRequestChunkingReturnType$inboundSchema = exports.AgenticChunkerStrategy$outboundSchema = exports.AgenticChunkerStrategy$inboundSchema = exports.AgenticChunker$outboundSchema = exports.AgenticChunker$inboundSchema = exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema = exports.ParseChunkingRequestChunkingRequestReturnType$inboundSchema = exports.TokenChunker = exports.ReturnTypeT = exports.SentenceChunker = exports.ChunkingRequestReturnType = exports.RecursiveChunker = exports.ParseChunkingRequestReturnType = exports.Mode = exports.Threshold2 = exports.SemanticChunker = exports.ParseChunkingRequestChunkingReturnType = exports.AgenticChunker = exports.ParseChunkingRequestChunkingRequestReturnType = void 0;
exports.ParseResponseBody$outboundSchema = exports.ParseResponseBody$inboundSchema = exports.Chunks$outboundSchema = exports.Chunks$inboundSchema = exports.ParseMetadata$outboundSchema = exports.ParseMetadata$inboundSchema = void 0;
exports.agenticChunkerStrategyToJSON = agenticChunkerStrategyToJSON;
exports.agenticChunkerStrategyFromJSON = agenticChunkerStrategyFromJSON;
exports.thresholdToJSON = thresholdToJSON;
exports.thresholdFromJSON = thresholdFromJSON;
exports.semanticChunkerStrategyToJSON = semanticChunkerStrategyToJSON;
exports.semanticChunkerStrategyFromJSON = semanticChunkerStrategyFromJSON;
exports.recursiveChunkerStrategyToJSON = recursiveChunkerStrategyToJSON;
exports.recursiveChunkerStrategyFromJSON = recursiveChunkerStrategyFromJSON;
exports.sentenceChunkerStrategyToJSON = sentenceChunkerStrategyToJSON;
exports.sentenceChunkerStrategyFromJSON = sentenceChunkerStrategyFromJSON;
exports.tokenChunkerStrategyToJSON = tokenChunkerStrategyToJSON;
exports.tokenChunkerStrategyFromJSON = tokenChunkerStrategyFromJSON;
exports.parseChunkingRequestToJSON = parseChunkingRequestToJSON;
exports.parseChunkingRequestFromJSON = parseChunkingRequestFromJSON;
exports.parseMetadataToJSON = parseMetadataToJSON;
exports.parseMetadataFromJSON = parseMetadataFromJSON;
exports.chunksToJSON = chunksToJSON;
exports.chunksFromJSON = chunksFromJSON;
exports.parseResponseBodyToJSON = parseResponseBodyToJSON;
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.ParseChunkingRequestChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.AgenticChunker = {
    Agentic: "agentic",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestChunkingReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.SemanticChunker = {
    Semantic: "semantic",
};
exports.Threshold2 = {
    Auto: "auto",
};
/**
 * Chunking mode: window-based or sentence-based similarity
 */
exports.Mode = {
    Window: "window",
    Sentence: "sentence",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ParseChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.RecursiveChunker = {
    Recursive: "recursive",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ChunkingRequestReturnType = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.SentenceChunker = {
    Sentence: "sentence",
};
/**
 * Return format: chunks (with metadata) or texts (plain strings)
 */
exports.ReturnTypeT = {
    Chunks: "chunks",
    Texts: "texts",
};
exports.TokenChunker = {
    Token: "token",
};
/** @internal */
exports.ParseChunkingRequestChunkingRequestReturnType$inboundSchema = z
    .nativeEnum(exports.ParseChunkingRequestChunkingRequestReturnType);
/** @internal */
exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema = exports.ParseChunkingRequestChunkingRequestReturnType$inboundSchema;
/** @internal */
exports.AgenticChunker$inboundSchema = z.nativeEnum(exports.AgenticChunker);
/** @internal */
exports.AgenticChunker$outboundSchema = exports.AgenticChunker$inboundSchema;
/** @internal */
exports.AgenticChunkerStrategy$inboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    return_type: exports.ParseChunkingRequestChunkingRequestReturnType$inboundSchema
        .default("chunks"),
    strategy: exports.AgenticChunker$inboundSchema,
    model: z.string(),
    chunk_size: z.number().int().default(1024),
    candidate_size: z.number().int().default(128),
    min_characters_per_chunk: z.number().int().default(24),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "return_type": "returnType",
        "chunk_size": "chunkSize",
        "candidate_size": "candidateSize",
        "min_characters_per_chunk": "minCharactersPerChunk",
    });
});
/** @internal */
exports.AgenticChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestChunkingRequestReturnType$outboundSchema
        .default("chunks"),
    strategy: exports.AgenticChunker$outboundSchema,
    model: z.string(),
    chunkSize: z.number().int().default(1024),
    candidateSize: z.number().int().default(128),
    minCharactersPerChunk: z.number().int().default(24),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        returnType: "return_type",
        chunkSize: "chunk_size",
        candidateSize: "candidate_size",
        minCharactersPerChunk: "min_characters_per_chunk",
    });
});
function agenticChunkerStrategyToJSON(agenticChunkerStrategy) {
    return JSON.stringify(exports.AgenticChunkerStrategy$outboundSchema.parse(agenticChunkerStrategy));
}
function agenticChunkerStrategyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AgenticChunkerStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AgenticChunkerStrategy' from JSON`);
}
/** @internal */
exports.ParseChunkingRequestChunkingReturnType$inboundSchema = z.nativeEnum(exports.ParseChunkingRequestChunkingReturnType);
/** @internal */
exports.ParseChunkingRequestChunkingReturnType$outboundSchema = exports.ParseChunkingRequestChunkingReturnType$inboundSchema;
/** @internal */
exports.SemanticChunker$inboundSchema = z.nativeEnum(exports.SemanticChunker);
/** @internal */
exports.SemanticChunker$outboundSchema = exports.SemanticChunker$inboundSchema;
/** @internal */
exports.Threshold2$inboundSchema = z
    .nativeEnum(exports.Threshold2);
/** @internal */
exports.Threshold2$outboundSchema = exports.Threshold2$inboundSchema;
/** @internal */
exports.Threshold$inboundSchema = z.union([z.number(), exports.Threshold2$inboundSchema]);
/** @internal */
exports.Threshold$outboundSchema = z.union([z.number(), exports.Threshold2$outboundSchema]);
function thresholdToJSON(threshold) {
    return JSON.stringify(exports.Threshold$outboundSchema.parse(threshold));
}
function thresholdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Threshold$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Threshold' from JSON`);
}
/** @internal */
exports.Mode$inboundSchema = z.nativeEnum(exports.Mode);
/** @internal */
exports.Mode$outboundSchema = exports.Mode$inboundSchema;
/** @internal */
exports.SemanticChunkerStrategy$inboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    return_type: exports.ParseChunkingRequestChunkingReturnType$inboundSchema.default("chunks"),
    strategy: exports.SemanticChunker$inboundSchema,
    chunk_size: z.number().int().default(512),
    threshold: z.union([z.number(), exports.Threshold2$inboundSchema]).optional(),
    embedding_model: z.string(),
    dimensions: z.number().int().optional(),
    max_tokens: z.number().int().optional(),
    mode: exports.Mode$inboundSchema.default("window"),
    similarity_window: z.number().int().default(1),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "return_type": "returnType",
        "chunk_size": "chunkSize",
        "embedding_model": "embeddingModel",
        "max_tokens": "maxTokens",
        "similarity_window": "similarityWindow",
    });
});
/** @internal */
exports.SemanticChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestChunkingReturnType$outboundSchema.default("chunks"),
    strategy: exports.SemanticChunker$outboundSchema,
    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.Mode$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));
}
function semanticChunkerStrategyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.SemanticChunkerStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SemanticChunkerStrategy' from JSON`);
}
/** @internal */
exports.ParseChunkingRequestReturnType$inboundSchema = z.nativeEnum(exports.ParseChunkingRequestReturnType);
/** @internal */
exports.ParseChunkingRequestReturnType$outboundSchema = exports.ParseChunkingRequestReturnType$inboundSchema;
/** @internal */
exports.RecursiveChunker$inboundSchema = z.nativeEnum(exports.RecursiveChunker);
/** @internal */
exports.RecursiveChunker$outboundSchema = exports.RecursiveChunker$inboundSchema;
/** @internal */
exports.RecursiveChunkerStrategy$inboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    return_type: exports.ParseChunkingRequestReturnType$inboundSchema.default("chunks"),
    strategy: exports.RecursiveChunker$inboundSchema,
    chunk_size: z.number().int().default(512),
    separators: z.array(z.string()).optional(),
    min_characters_per_chunk: z.number().int().default(24),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "return_type": "returnType",
        "chunk_size": "chunkSize",
        "min_characters_per_chunk": "minCharactersPerChunk",
    });
});
/** @internal */
exports.RecursiveChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ParseChunkingRequestReturnType$outboundSchema.default("chunks"),
    strategy: exports.RecursiveChunker$outboundSchema,
    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));
}
function recursiveChunkerStrategyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RecursiveChunkerStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RecursiveChunkerStrategy' from JSON`);
}
/** @internal */
exports.ChunkingRequestReturnType$inboundSchema = z.nativeEnum(exports.ChunkingRequestReturnType);
/** @internal */
exports.ChunkingRequestReturnType$outboundSchema = exports.ChunkingRequestReturnType$inboundSchema;
/** @internal */
exports.SentenceChunker$inboundSchema = z.nativeEnum(exports.SentenceChunker);
/** @internal */
exports.SentenceChunker$outboundSchema = exports.SentenceChunker$inboundSchema;
/** @internal */
exports.SentenceChunkerStrategy$inboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    return_type: exports.ChunkingRequestReturnType$inboundSchema.default("chunks"),
    strategy: exports.SentenceChunker$inboundSchema,
    chunk_size: z.number().int().default(512),
    chunk_overlap: z.number().int().default(0),
    min_sentences_per_chunk: z.number().int().default(1),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "return_type": "returnType",
        "chunk_size": "chunkSize",
        "chunk_overlap": "chunkOverlap",
        "min_sentences_per_chunk": "minSentencesPerChunk",
    });
});
/** @internal */
exports.SentenceChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ChunkingRequestReturnType$outboundSchema.default("chunks"),
    strategy: exports.SentenceChunker$outboundSchema,
    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));
}
function sentenceChunkerStrategyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.SentenceChunkerStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SentenceChunkerStrategy' from JSON`);
}
/** @internal */
exports.ReturnTypeT$inboundSchema = z
    .nativeEnum(exports.ReturnTypeT);
/** @internal */
exports.ReturnTypeT$outboundSchema = exports.ReturnTypeT$inboundSchema;
/** @internal */
exports.TokenChunker$inboundSchema = z.nativeEnum(exports.TokenChunker);
/** @internal */
exports.TokenChunker$outboundSchema = exports.TokenChunker$inboundSchema;
/** @internal */
exports.TokenChunkerStrategy$inboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    return_type: exports.ReturnTypeT$inboundSchema.default("chunks"),
    strategy: exports.TokenChunker$inboundSchema,
    chunk_size: z.number().int().default(512),
    chunk_overlap: z.number().int().default(0),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "return_type": "returnType",
        "chunk_size": "chunkSize",
        "chunk_overlap": "chunkOverlap",
    });
});
/** @internal */
exports.TokenChunkerStrategy$outboundSchema = z.object({
    text: z.string(),
    metadata: z.boolean().default(true),
    returnType: exports.ReturnTypeT$outboundSchema.default("chunks"),
    strategy: exports.TokenChunker$outboundSchema,
    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));
}
function tokenChunkerStrategyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TokenChunkerStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TokenChunkerStrategy' from JSON`);
}
/** @internal */
exports.ParseChunkingRequest$inboundSchema = z.union([
    z.lazy(() => exports.SemanticChunkerStrategy$inboundSchema),
    z.lazy(() => exports.AgenticChunkerStrategy$inboundSchema),
    z.lazy(() => exports.TokenChunkerStrategy$inboundSchema),
    z.lazy(() => exports.SentenceChunkerStrategy$inboundSchema),
    z.lazy(() => exports.RecursiveChunkerStrategy$inboundSchema),
]);
/** @internal */
exports.ParseChunkingRequest$outboundSchema = z.union([
    z.lazy(() => exports.SemanticChunkerStrategy$outboundSchema),
    z.lazy(() => exports.AgenticChunkerStrategy$outboundSchema),
    z.lazy(() => exports.TokenChunkerStrategy$outboundSchema),
    z.lazy(() => exports.SentenceChunkerStrategy$outboundSchema),
    z.lazy(() => exports.RecursiveChunkerStrategy$outboundSchema),
]);
function parseChunkingRequestToJSON(parseChunkingRequest) {
    return JSON.stringify(exports.ParseChunkingRequest$outboundSchema.parse(parseChunkingRequest));
}
function parseChunkingRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParseChunkingRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParseChunkingRequest' from JSON`);
}
/** @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",
    });
});
/** @internal */
exports.ParseMetadata$outboundSchema = z.object({
    startIndex: z.nullable(z.number()),
    endIndex: z.nullable(z.number()),
    tokenCount: z.nullable(z.number()),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        startIndex: "start_index",
        endIndex: "end_index",
        tokenCount: "token_count",
    });
});
function parseMetadataToJSON(parseMetadata) {
    return JSON.stringify(exports.ParseMetadata$outboundSchema.parse(parseMetadata));
}
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(),
});
/** @internal */
exports.Chunks$outboundSchema = z.object({
    text: z.string(),
    index: z.number(),
    metadata: z.lazy(() => exports.ParseMetadata$outboundSchema).optional(),
});
function chunksToJSON(chunks) {
    return JSON.stringify(exports.Chunks$outboundSchema.parse(chunks));
}
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)),
});
/** @internal */
exports.ParseResponseBody$outboundSchema = z.object({
    chunks: z.array(z.lazy(() => exports.Chunks$outboundSchema)),
});
function parseResponseBodyToJSON(parseResponseBody) {
    return JSON.stringify(exports.ParseResponseBody$outboundSchema.parse(parseResponseBody));
}
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