{"openapi":"3.1.0","info":{"title":"Sage","version":"0.5.0"},"paths":{"/ready":{"get":{"summary":"Ready","operationId":"ready_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/decide":{"post":{"summary":"Decide","operationId":"decide_decide_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecideRequestPublic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/YesNoDecideResponsePublic"},{"$ref":"#/components/schemas/ChoiceDecideResponsePublic"},{"$ref":"#/components/schemas/ScaleDecideResponsePublic"},{"$ref":"#/components/schemas/SortDecideResponsePublic"},{"$ref":"#/components/schemas/TagsDecideResponsePublic"}],"title":"Response Decide Decide Post","discriminator":{"propertyName":"kind","mapping":{"yesno":"#/components/schemas/YesNoDecideResponsePublic","choice":"#/components/schemas/ChoiceDecideResponsePublic","scale":"#/components/schemas/ScaleDecideResponsePublic","sort":"#/components/schemas/SortDecideResponsePublic","tags":"#/components/schemas/TagsDecideResponsePublic"}}}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/decide/batch":{"post":{"summary":"Decide Batch","operationId":"decide_batch_decide_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDecideRequestPublic"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchDecideResponsePublic"}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SageErrorResponse"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"BatchDecideResponsePublic":{"properties":{"results":{"items":{"$ref":"#/components/schemas/BatchGroupResultPublic"},"type":"array","title":"Results"},"meta":{"$ref":"#/components/schemas/BatchMetaPublic"}},"type":"object","required":["results","meta"],"title":"BatchDecideResponsePublic"},"BatchGroupResultPublic":{"properties":{"answers":{"items":{"$ref":"#/components/schemas/BatchQuestionAnswerPublic"},"type":"array","title":"Answers"}},"type":"object","required":["answers"],"title":"BatchGroupResultPublic"},"BatchMetaPublic":{"properties":{"model":{"type":"string","title":"Model","default":"levanto-sage-v0.5"},"request_count":{"type":"integer","title":"Request Count"},"question_count":{"type":"integer","title":"Question Count"}},"type":"object","required":["request_count","question_count"],"title":"BatchMetaPublic"},"BatchQuestionAnswerPublic":{"properties":{"ok":{"type":"boolean","title":"Ok"},"result":{"anyOf":[{"oneOf":[{"$ref":"#/components/schemas/YesNoDecideResponsePublic"},{"$ref":"#/components/schemas/ChoiceDecideResponsePublic"},{"$ref":"#/components/schemas/ScaleDecideResponsePublic"},{"$ref":"#/components/schemas/SortDecideResponsePublic"},{"$ref":"#/components/schemas/TagsDecideResponsePublic"}],"discriminator":{"propertyName":"kind","mapping":{"choice":"#/components/schemas/ChoiceDecideResponsePublic","scale":"#/components/schemas/ScaleDecideResponsePublic","sort":"#/components/schemas/SortDecideResponsePublic","tags":"#/components/schemas/TagsDecideResponsePublic","yesno":"#/components/schemas/YesNoDecideResponsePublic"}}},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["ok"],"title":"BatchQuestionAnswerPublic"},"ChoiceDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"choice","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultChoice"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"ChoiceDecideResponsePublic"},"GroundingMetaPublic":{"properties":{"triggered":{"type":"boolean","title":"Triggered"},"trigger_reason":{"anyOf":[{"type":"string","enum":["never","confidence_above_floor","low_confidence","always","low_confidence_no_query","low_confidence_search_failed","low_confidence_no_context","always_no_query","always_search_failed","always_no_context"]},{"type":"null"}],"title":"Trigger Reason"},"queries":{"items":{"type":"string"},"type":"array","title":"Queries"},"sources":{"items":{"$ref":"#/components/schemas/Source"},"type":"array","title":"Sources"},"added_context_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Added Context Tokens"},"search_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Search Ms"}},"type":"object","required":["triggered"],"title":"GroundingMetaPublic"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"MetaPublic":{"properties":{"model":{"type":"string","title":"Model","default":"levanto-sage-v0.5"},"latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Ms"}},"type":"object","title":"MetaPublic"},"ResultChoice":{"properties":{"chosen":{"type":"string","title":"Chosen"},"probabilities":{"items":{"$ref":"#/components/schemas/ResultChoiceOption"},"type":"array","title":"Probabilities"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["chosen","probabilities","confidence"],"title":"ResultChoice"},"ResultChoiceOption":{"properties":{"option":{"type":"string","title":"Option"},"probability":{"type":"number","title":"Probability"}},"type":"object","required":["option","probability"],"title":"ResultChoiceOption"},"ResultScale":{"properties":{"expectation":{"type":"number","title":"Expectation"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["expectation","confidence"],"title":"ResultScale"},"ResultSort":{"properties":{"sorted":{"items":{"type":"string"},"type":"array","title":"Sorted"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"}},"type":"object","required":["sorted"],"title":"ResultSort"},"ResultTagEntry":{"properties":{"id":{"type":"string","title":"Id"},"probability":{"type":"number","title":"Probability"},"confidence":{"type":"number","title":"Confidence"},"applies":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Applies"}},"type":"object","required":["id","probability","confidence"],"title":"ResultTagEntry"},"ResultTags":{"properties":{"tags":{"items":{"$ref":"#/components/schemas/ResultTagEntry"},"type":"array","title":"Tags"}},"type":"object","required":["tags"],"title":"ResultTags"},"ResultYesNo":{"properties":{"probability":{"type":"number","title":"Probability"},"confidence":{"type":"number","title":"Confidence"},"answer":{"type":"string","enum":["yes","no"],"title":"Answer"}},"type":"object","required":["probability","confidence","answer"],"title":"ResultYesNo"},"ScaleDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"scale","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultScale"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"ScaleDecideResponsePublic"},"SortDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"sort","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultSort"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"SortDecideResponsePublic"},"Source":{"properties":{"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snippet"}},"type":"object","title":"Source"},"TagsDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"tags","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultTags"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"TagsDecideResponsePublic"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"YesNoDecideResponsePublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","const":"yesno","title":"Kind"},"result":{"$ref":"#/components/schemas/ResultYesNo"},"meta":{"$ref":"#/components/schemas/MetaPublic"},"grounding_meta":{"anyOf":[{"$ref":"#/components/schemas/GroundingMetaPublic"},{"type":"null"}]}},"type":"object","required":["id","kind","result","meta"],"title":"YesNoDecideResponsePublic"},"ChoiceOptionModel":{"additionalProperties":false,"properties":{"option":{"title":"Option","type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["option"],"title":"ChoiceOptionModel","type":"object"},"ChoiceQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"choice","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"options":{"items":{"$ref":"#/components/schemas/ChoiceOptionModel"},"maxItems":120,"minItems":2,"title":"Options","type":"array"}},"required":["kind","id","instructions","options"],"title":"ChoiceQuestion","type":"object"},"GroundingConfig":{"additionalProperties":false,"properties":{"trigger":{"default":"low_confidence","enum":["always","low_confidence","never"],"title":"Trigger","type":"string"},"confidence_floor":{"default":0.8,"maximum":1.0,"minimum":0.0,"title":"Confidence Floor","type":"number"},"max_results":{"default":10,"maximum":20,"minimum":1,"title":"Max Results","type":"integer"},"max_context_tokens":{"default":2000,"maximum":8000,"minimum":1,"title":"Max Context Tokens","type":"integer"},"return_sources":{"default":true,"title":"Return Sources","type":"boolean"}},"title":"GroundingConfig","type":"object"},"ListContentPublic":{"additionalProperties":false,"description":"An ordered set of items to be sorted (used by ``kind: sort``).","properties":{"kind":{"const":"list","default":"list","title":"Kind","type":"string"},"value":{"items":{"$ref":"#/components/schemas/ListItemPublic"},"maxItems":120,"minItems":2,"title":"Value","type":"array"}},"required":["value"],"title":"ListContentPublic","type":"object"},"ListItemPublic":{"additionalProperties":false,"properties":{"id":{"title":"Id","type":"string"},"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"title":"Content"}},"required":["id","content"],"title":"ListItemPublic","type":"object"},"ScaleLevelModel":{"additionalProperties":false,"properties":{"level":{"maximum":4,"minimum":0,"title":"Level","type":"integer"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Description"}},"required":["level"],"title":"ScaleLevelModel","type":"object"},"ScaleQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"scale","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"levels":{"items":{"$ref":"#/components/schemas/ScaleLevelModel"},"maxItems":5,"minItems":5,"title":"Levels","type":"array"}},"required":["kind","id","instructions","levels"],"title":"ScaleQuestion","type":"object"},"SortQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"sort","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"}},"required":["kind","id","instructions"],"title":"SortQuestion","type":"object"},"TagSpec":{"additionalProperties":false,"properties":{"id":{"title":"Id","type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Name"},"threshold":{"anyOf":[{"maximum":1.0,"minimum":0.0,"type":"number"},{"type":"null"}],"default":null,"title":"Threshold"}},"required":["id"],"title":"TagSpec","type":"object"},"TagsQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"tags","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Instructions"},"tags":{"items":{"$ref":"#/components/schemas/TagSpec"},"maxItems":120,"minItems":1,"title":"Tags","type":"array"}},"required":["kind","id","tags"],"title":"TagsQuestion","type":"object"},"TextContent":{"additionalProperties":false,"properties":{"kind":{"const":"text","default":"text","title":"Kind","type":"string"},"value":{"title":"Value","type":"string"}},"required":["value"],"title":"TextContent","type":"object"},"YesNoQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"yesno","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"}},"required":["kind","id","instructions"],"title":"YesNoQuestion","type":"object"},"DecideRequestPublic":{"additionalProperties":false,"properties":{"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"description":"Document or item list to judge. Together with ``question`` (and any grounding-added context), the full rendered request must fit within 32768 tokens.","maxTokens":32768,"title":"Content"},"question":{"discriminator":{"mapping":{"choice":"#/components/schemas/ChoiceQuestion","scale":"#/components/schemas/ScaleQuestion","sort":"#/components/schemas/SortQuestion","tags":"#/components/schemas/TagsQuestion","yesno":"#/components/schemas/YesNoQuestion"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/YesNoQuestion"},{"$ref":"#/components/schemas/ChoiceQuestion"},{"$ref":"#/components/schemas/ScaleQuestion"},{"$ref":"#/components/schemas/SortQuestion"},{"$ref":"#/components/schemas/TagsQuestion"}],"title":"Question"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["content","question"],"title":"DecideRequestPublic","type":"object"},"BatchChoiceQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"choice","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"options":{"items":{"$ref":"#/components/schemas/ChoiceOptionModel"},"maxItems":120,"minItems":2,"title":"Options","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions","options"],"title":"BatchChoiceQuestion","type":"object"},"BatchDecideItemPublic":{"additionalProperties":false,"properties":{"content":{"anyOf":[{"type":"string"},{"discriminator":{"mapping":{"list":"#/components/schemas/ListContentPublic","text":"#/components/schemas/TextContent"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/TextContent"},{"$ref":"#/components/schemas/ListContentPublic"}]}],"description":"Document or item list shared by every question in this group. Together with all of ``questions`` (and any grounding-added context), the full rendered request must fit within 32768 tokens.","maxTokens":32768,"title":"Content"},"questions":{"items":{"discriminator":{"mapping":{"choice":"#/components/schemas/BatchChoiceQuestion","scale":"#/components/schemas/BatchScaleQuestion","sort":"#/components/schemas/BatchSortQuestion","tags":"#/components/schemas/BatchTagsQuestion","yesno":"#/components/schemas/BatchYesNoQuestion"},"propertyName":"kind"},"oneOf":[{"$ref":"#/components/schemas/BatchYesNoQuestion"},{"$ref":"#/components/schemas/BatchChoiceQuestion"},{"$ref":"#/components/schemas/BatchScaleQuestion"},{"$ref":"#/components/schemas/BatchSortQuestion"},{"$ref":"#/components/schemas/BatchTagsQuestion"}]},"minItems":1,"title":"Questions","type":"array"}},"required":["content","questions"],"title":"BatchDecideItemPublic","type":"object"},"BatchScaleQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"scale","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"levels":{"items":{"$ref":"#/components/schemas/ScaleLevelModel"},"maxItems":5,"minItems":5,"title":"Levels","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions","levels"],"title":"BatchScaleQuestion","type":"object"},"BatchSortQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"sort","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions"],"title":"BatchSortQuestion","type":"object"},"BatchTagsQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"tags","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Instructions"},"tags":{"items":{"$ref":"#/components/schemas/TagSpec"},"maxItems":120,"minItems":1,"title":"Tags","type":"array"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","tags"],"title":"BatchTagsQuestion","type":"object"},"BatchYesNoQuestion":{"additionalProperties":false,"properties":{"kind":{"const":"yesno","title":"Kind","type":"string"},"id":{"title":"Id","type":"string"},"instructions":{"title":"Instructions","type":"string"},"grounding":{"anyOf":[{"$ref":"#/components/schemas/GroundingConfig"},{"type":"null"}],"default":null}},"required":["kind","id","instructions"],"title":"BatchYesNoQuestion","type":"object"},"BatchDecideRequestPublic":{"additionalProperties":false,"properties":{"requests":{"items":{"$ref":"#/components/schemas/BatchDecideItemPublic"},"minItems":1,"title":"Requests","type":"array"}},"required":["requests"],"title":"BatchDecideRequestPublic","type":"object"},"SageErrorResponse":{"description":"Documents the ``400`` shape ``/decide``/``/decide/batch`` actually return\non invalid input (one human-readable string), in place of FastAPI's default\n``422`` + structured error list -- these routes validate the body manually,\nso FastAPI's own body validation (and its 422) never fires.","properties":{"detail":{"title":"Detail","type":"string"}},"required":["detail"],"title":"SageErrorResponse","type":"object"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"Levanto API key. Send `Authorization: Bearer lv_live_...`.","scheme":"bearer"}}}}