{"openapi":"3.1.0","info":{"title":"AI Scientist Storyteller API","description":"Mac backend orchestrating PDF parsing and story generation on a remote GPU VM.\n\n### Flow\n- **/api/explain**: PDF → docparse → markdown → split + story → JSON\n- **/api/generate_from_text**: text/markdown → split + story → JSON\n- **/api/regen**: regenerate one or more sections (local inference)\n- **/api/para**: paraphrase a paragraph (local inference)\n- **/api/regen_vm**: regenerate from a precomputed outline on the GPU VM\n\nUse `/docs` (Swagger UI) or `/redoc` for interactive documentation.","version":"0.5.0"},"paths":{"/health":{"get":{"tags":["Health"],"summary":"Healthcheck","description":"Returns ok=True if the backend is alive.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/explain":{"post":{"tags":["Explain"],"summary":"Upload PDF → Story","description":"Upload a PDF, extract markdown via docparse, then call the GPU VM (2 stages: splitter + storyteller).","operationId":"explain_endpoint_api_explain_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_explain_endpoint_api_explain_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate_from_text":{"post":{"tags":["Generate"],"summary":"Text/Markdown → Story","description":"Provide text/markdown directly; applies split + story on the GPU VM.","operationId":"generate_from_text_api_generate_from_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateFromTextRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/regen":{"post":{"tags":["Edit"],"summary":"Regenerate story sections (local)","description":"Regenerate one or more sections using local inference (set up `story_ops`).","operationId":"regen_sections_api_regen_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/para":{"post":{"tags":["Edit"],"summary":"Paraphrase a paragraph (local)","description":"Paraphrase a paragraph tailored to a persona using local inference.","operationId":"paraphrase_api_para_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParaRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response Paraphrase Api Para Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/regen_vm":{"post":{"tags":["VM Orchestrator"],"summary":"Regenerate from outline (GPU VM)","description":"Regenerate a story given a precomputed outline on the GPU VM.","operationId":"regen_vm_api_regen_vm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegenVmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplainWithOutlineResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_explain_endpoint_api_explain_post":{"properties":{"persona":{"type":"string","title":"Persona","description":"Target persona/audience (e.g., Journalist, General Public, Student, Expert)."},"file":{"type":"string","format":"binary","title":"File","description":"Paper PDF file."},"length":{"type":"string","title":"Length","description":"Length preset: short | medium | long.","default":"medium"},"limit_sections":{"type":"integer","title":"Limit Sections","description":"Maximum number of sections.","default":5},"temp":{"type":"number","title":"Temp","description":"Creativity (0–1) for the storyteller.","default":0.0},"top_p":{"type":"number","title":"Top P","description":"Top-p sampling.","default":0.9},"title_style":{"type":"string","title":"Title Style","description":"Title style.","default":"canonical"},"title_max_words":{"type":"integer","title":"Title Max Words","description":"Title word limit (0 = auto).","default":0}},"type":"object","required":["persona","file"],"title":"Body_explain_endpoint_api_explain_post"},"ExplainResponse":{"properties":{"persona":{"type":"string","title":"Persona"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"docTitle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctitle"},"sections":{"items":{"$ref":"#/components/schemas/SectionOut"},"type":"array","title":"Sections"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"}},"type":"object","required":["persona","sections"],"title":"ExplainResponse"},"ExplainWithOutlineResponse":{"properties":{"persona":{"type":"string","title":"Persona"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"docTitle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doctitle"},"sections":{"items":{"$ref":"#/components/schemas/SectionOut"},"type":"array","title":"Sections"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"},"outline":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Outline"}},"type":"object","required":["persona","sections"],"title":"ExplainWithOutlineResponse"},"GenerateFromTextRequest":{"properties":{"text":{"type":"string","title":"Text"},"persona":{"type":"string","title":"Persona"},"length":{"type":"string","title":"Length","default":"medium"},"words":{"type":"integer","title":"Words","default":0},"limit_sections":{"type":"integer","title":"Limit Sections","default":5},"temp":{"type":"number","title":"Temp","default":0.0},"top_p":{"type":"number","title":"Top P","default":0.9},"title_style":{"type":"string","title":"Title Style","default":"canonical"},"title_max_words":{"type":"integer","title":"Title Max Words","default":0},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","default":"Paper"},"length_preset":{"type":"string","title":"Length Preset","default":"medium"},"retriever":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retriever"},"retriever_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retriever Model"},"k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"},"max_ctx_chars":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Ctx Chars"},"seg_words":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seg Words"},"overlap_words":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Overlap Words"}},"type":"object","required":["text","persona"],"title":"GenerateFromTextRequest","description":"Generate a multi-section story from already-extracted text/markdown."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ParaRequest":{"properties":{"persona":{"type":"string","title":"Persona"},"text":{"type":"string","title":"Text"},"words":{"type":"integer","title":"Words","default":150},"alts":{"type":"integer","title":"Alts","default":1},"temp":{"type":"number","title":"Temp","default":0.7},"top_p":{"type":"number","title":"Top P","default":0.9}},"type":"object","required":["persona","text"],"title":"ParaRequest","description":"Targeted paraphrase of a single paragraph tailored to a persona."},"RegenRequest":{"properties":{"text":{"type":"string","title":"Text"},"persona":{"type":"string","title":"Persona"},"story":{"$ref":"#/components/schemas/StoryIn"},"sections":{"items":{"type":"string"},"type":"array","title":"Sections"},"length":{"type":"string","title":"Length","default":"long"},"words":{"type":"integer","title":"Words","default":0},"alts":{"type":"integer","title":"Alts","default":1},"temp":{"type":"number","title":"Temp","default":0.7},"top_p":{"type":"number","title":"Top P","default":0.9}},"type":"object","required":["text","persona","story","sections"],"title":"RegenRequest","description":"Regenerate one or more sections given the current story JSON."},"RegenResponse":{"properties":{"sections":{"items":{"$ref":"#/components/schemas/SectionOut"},"type":"array","title":"Sections"}},"type":"object","required":["sections"],"title":"RegenResponse"},"RegenVmRequest":{"properties":{"persona":{"type":"string","title":"Persona"},"text":{"type":"string","title":"Text"},"outline":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Outline"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title","default":"Paper"},"length":{"type":"string","title":"Length","default":"medium"},"temp":{"type":"number","title":"Temp","default":0.0},"top_p":{"type":"number","title":"Top P","default":1.0},"retriever":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retriever"},"retriever_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retriever Model"},"k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"},"max_ctx_chars":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Ctx Chars"},"seg_words":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seg Words"},"overlap_words":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Overlap Words"}},"type":"object","required":["persona","text","outline"],"title":"RegenVmRequest"},"SectionOut":{"properties":{"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"narrative":{"type":"string","title":"Narrative"}},"type":"object","required":["narrative"],"title":"SectionOut"},"StoryIn":{"properties":{"persona":{"type":"string","title":"Persona"},"sections":{"items":{"$ref":"#/components/schemas/StorySectionIn"},"type":"array","title":"Sections"}},"type":"object","required":["persona","sections"],"title":"StoryIn"},"StorySectionIn":{"properties":{"title":{"type":"string","title":"Title"},"narrative":{"type":"string","title":"Narrative"}},"type":"object","required":["title","narrative"],"title":"StorySectionIn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"Health","description":"Liveness and readiness of the service."},{"name":"Explain","description":"Upload a PDF → parse it → run 2-stage generation on the GPU VM → story JSON."},{"name":"Generate","description":"Provide text/markdown → run 2-stage generation on the GPU VM → story JSON."},{"name":"Edit","description":"Local-only utilities to regenerate sections or paraphrase a paragraph."},{"name":"VM Orchestrator","description":"Regenerate a story from a precomputed outline on the GPU VM."}]}