{"uid":"cap_depRs-PtXUSBz1sEM_Mb6","slug":"maha-strategies-document-compress-evaluate-5d25f2b9","name":"Maha Strategies Document Compress & Evaluate","description":"Compile 1-8 documents into a token-budgeted context pack, then measure exact retention of 1-32 caller-labelled evidence spans. Returns the pack, source-linked passages, input and output hashes, original and compiled token estimates, tokensSaved, source coverage, and requiredEvidenceRetentionPercent. Retention is exact span matching only: not accuracy, answer quality, verification, or hallucination prevention. Extractive and budget-bound. Request content is not stored.","url":"https://www.mahastrategies.com/api/v1/compress/evaluate","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["clientRequestId","task","tokenBudget","documents","requiredEvidence"],"properties":{"task":{"type":"string","maxLength":1200,"minLength":8},"scoring":{"enum":["bm25","keyword"],"type":"string"},"documents":{"type":"array","maxItems":8,"minItems":1},"budgetMode":{"enum":["guaranteed","estimated"],"type":"string"},"provenance":{"enum":["full","compact","none"],"type":"string"},"tokenBudget":{"type":"integer","maximum":16000,"minimum":64},"clientRequestId":{"type":"string","maxLength":120,"minLength":8},"requiredEvidence":{"type":"array","maxItems":32,"minItems":1}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","required":["version","offerId","evaluationId","clientRequestId","contextPack","evidence","metrics","inputHash","outputHash","warnings","warningCodes","retentionBoundaries","sourceTextStored","compiledContextStored","requiredEvidenceTextStored"],"properties":{"metrics":{"type":"object"},"offerId":{"type":"string","const":"deep-context-evaluation"},"version":{"type":"string","const":"0.1.0"},"evidence":{"type":"array","maxItems":32,"minItems":1},"warnings":{"type":"array"},"inputHash":{"type":"string"},"outputHash":{"type":"string"},"contextPack":{"type":"object"},"evaluationId":{"type":"string"},"warningCodes":{"type":"array"},"clientRequestId":{"type":"string","maxLength":120,"minLength":8},"sourceTextStored":{"type":"boolean","const":false},"retentionBoundaries":{"type":"object"},"compiledContextStored":{"type":"boolean","const":false},"requiredEvidenceTextStored":{"type":"boolean","const":false}},"additionalProperties":false}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_gU2eXML49WZRl-NGo7RfF","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Compiles 1-8 documents into a token-budgeted context pack and measures exact retention of 1-32 caller-labelled evidence spans, returning the pack, source-linked passages, token savings, and retention metrics.","exampleAgentPrompt":"Compress these 3 research documents into a context pack with a 4000-token budget, and check that my 5 labelled evidence spans — like 'quarterly revenue increased 12%' and 'CEO resigned in March' — are retained in the output.","exampleUseCases":[{"title":"RAG pipeline token reduction","prompt":"I have 6 retrieved documents for my RAG pipeline and need to fit them into a 3000-token context window — compress them and verify that my 8 critical evidence spans like 'product launch date: Q3 2024' and 'compliance requirement section 4.2' all survive the compression."},{"title":"Legal evidence preservation check","prompt":"Compress these 4 contract documents into a 5000-token context pack and measure exactly how many of my 12 labelled evidence spans — like 'indemnification clause paragraph 3' and 'termination notice 90 days' — are present in the compressed output."},{"title":"Research synthesis token budgeting","prompt":"Take these 5 academic papers and compile them into a 6000-token context pack, then check retention of my 10 evidence spans including 'sample size n=342' and 'p-value less than 0.05' so I know how much key detail survived."}],"resultDescription":"Returns a compiled context pack with source-linked passages, SHA hashes of input and output, original and compressed token count estimates, tokensSaved count, source coverage metrics, and a requiredEvidenceRetentionPercent score reflecting exact span matching against the caller-labelled evidence spans provided.","failureModes":["More than 8 documents submitted — request rejected","More than 32 evidence spans provided — request rejected","Token budget too small to fit any content — empty or minimal pack returned","Evidence spans not found in source documents — 0% retention reported","Malformed document input — parse error returned","Token budget exceeded by minimum extractable content — compression fails"],"whenToPreferThis":"Choose this endpoint when you need to both compress multiple documents to fit a token budget AND verify that specific, caller-labelled evidence spans survive the compression — giving you a measurable retention score. It is uniquely suited for RAG pipelines, LLM context preparation, and any workflow where you must prove key facts are preserved after compression, not just assume they are. Prefer it over generic summarization APIs when exact span retention measurement matters, when you have 1-8 source documents, and when you need source-linked output with token savings metrics.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T06:38:09.927Z","isFirstParty":false}