{"slug":"denk-halowerk-com-v1-context-pack-a4ccc7","title":"Pack the best passages into a token budget with Maximal Marginal Relevance","host":"denk.halowerk.com","method":"POST","resource":"https://denk.halowerk.com/v1/context-pack","category":"market","description":"Pack the best passages into a token budget with Maximal Marginal Relevance: relevance from your scores or BM25, redundancy from TF-IDF cosine, exact token count, citation labels. Selects passages greedily by Maximal Marginal Relevance (Carbonell and Goldstein 1998): lambda * relevance - (1 - lambda)","price_listed":0.003,"price_asked":0.003,"state":"answering","state_label":"Answering","checks_7d":7,"answered_7d":7,"latency_ms_median":900,"reported_calls_30d":1,"reported_payers_30d":1,"networks":["eip155:8453"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"budget_tokens":200,"passages":[{"id":"a","score":0.9,"text":"Die Kündigungsfrist beträgt drei Monate."},{"id":"b","score":0.4,"text":"Die Kaution beträgt drei Monatsmieten."}],"query":"Kündigungsfrist Mietvertrag"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"additionalProperties":false,"properties":{"budget_tokens":{"maximum":2000000,"minimum":1,"type":"integer"},"encoding":{"default":"cl100k_base","enum":["cl100k_base","o200k_base"],"type":"string"},"lambda":{"default":0.7,"maximum":1,"minimum":0,"type":"number"},"order":{"default":"selection","enum":["selection","source","edges"],"type":"string"},"passages":{"items":{"anyOf":[{"maxLength":20000,"minLength":1,"type":"string"},{"additionalProperties":false,"properties":{"id":{"maxLength":128,"type":"string"},"score":{"type":"number"},"text":{"maxLength":20000,"minLength":1,"type":"string"}},"required":["text"],"type":"object"}]},"maxItems":300,"minItems":1,"type":"array"},"query":{"maxLength":2000,"type":"string"},"separator":{"default":"\n\n","maxLength":20,"type":"string"},"template":{"default":"[{id}] {text}","maxLength":200,"type":"string"}},"required":["passages","budget_tokens"],"type":"object"},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST","PUT","PATCH"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-11-27","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":901,"error":null},{"day":"2026-11-26","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":888,"error":null},{"day":"2026-11-25","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":900,"error":null},{"day":"2026-11-24","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":911,"error":null},{"day":"2026-11-23","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":865,"error":null},{"day":"2026-11-22","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":906,"error":null},{"day":"2026-11-21","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":889,"error":null},{"day":"2026-11-20","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.003,"price_match":true,"latency_ms":881,"error":null}],"description_full":"Pack the best passages into a token budget with Maximal Marginal Relevance: relevance from your scores or BM25, redundancy from TF-IDF cosine, exact token count, citation labels. Selects passages greedily by Maximal Marginal Relevance (Carbonell and Goldstein 1998): lambda * relevance - (1 - lambda) * maximum TF-IDF cosine similarity to the passages already chosen; passages that no longer fit the budget are skipped.","last_updated":"2026-11-20T14:27:27.425Z","schemes":["exact"]}