{"openapi":"3.1.0","info":{"title":"FactoGraph knowledge store","version":"1.0.0","description":"Store facts the person approves, answer only from them, with a link to every fact."},"servers":[{"url":"https://api.factograph.app"}],"paths":{"/api/k/{store_id}":{"get":{"operationId":"getManual","summary":"The store's manual and what it holds. Read it first.","parameters":[{"name":"store_id","in":"path","required":true,"description":"The knowledge store's id: the uuid at the end of the person's store link.","schema":{"type":"string"}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["json"],"default":"json"}}],"responses":{"200":{"description":"The page, as Markdown in `content`.","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"}}}}}}},"x-openai-isConsequential":false}},"/api/k/{store_id}/facts":{"get":{"operationId":"listFacts","summary":"Every fact in the store, numbered, each with its link.","parameters":[{"name":"store_id","in":"path","required":true,"description":"The knowledge store's id: the uuid at the end of the person's store link.","schema":{"type":"string"}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["json"],"default":"json"}}],"responses":{"200":{"description":"The page, as Markdown in `content`.","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"}}}}}}},"x-openai-isConsequential":false}},"/api/k/{store_id}/steps/{step}":{"post":{"operationId":"startStep","summary":"Start a step: propose, add, documents, ask or remove.","parameters":[{"name":"store_id","in":"path","required":true,"description":"The knowledge store's id: the uuid at the end of the person's store link.","schema":{"type":"string"}},{"name":"step","in":"path","required":true,"schema":{"type":"string","enum":["propose","add","documents","ask","remove"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","description":"propose: the person's message. documents: the document's text, or one part of it - at most the manual's per-call limit; longer text goes in parts."},"title":{"type":"string","description":"documents: the document's title."},"part_of":{"type":"string","description":"documents: the first part's document_id, for every later part. Send parts in order, one at a time, each after the previous part's result."},"question":{"type":"string","description":"ask: the question."},"facts":{"type":"array","items":{"type":"string"},"description":"add: the approved facts. remove: fact ids, F<n> numbers or exact words."},"proposal_id":{"type":"string","description":"add: from propose's result."},"confirmation":{"type":"string","description":"add: the person's approving reply, quoted."},"conversation_id":{"type":"string","description":"add: from propose's result."},"replace":{"type":"array","items":{"type":"string"},"description":"add: stored fact ids the person chose to replace."},"keep_both":{"type":"array","items":{"type":"array","items":{"type":"string"}},"description":"add: [new fact, stored fact] pairs the person says are both true."},"confirm":{"type":"boolean","description":"remove: true to delete, after the person confirmed."}}}}}},"responses":{"200":{"description":"The step's state: `waiting` (a prompt for you, with `call_id`), `running`, `done` (with `next` and `result`), `failed` or `error`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"waiting, running, done, failed or error."},"run_id":{"type":"string"},"call_id":{"type":"string","description":"waiting: the prompt to answer with replyToPrompt."},"task":{"type":"string","description":"waiting: what to do with the prompt."},"system":{"type":"string","description":"waiting: the prompt's instructions."},"messages":{"type":"array","description":"waiting: the prompt's messages.","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"reply_schema":{"description":"waiting: the JSON schema the reply fits, or null for plain text."},"prompts_after_this":{"type":"integer"},"next":{"type":"string","description":"What to tell the person and do next."},"result":{"description":"done: the step's result."},"error":{"type":"string","description":"failed: why."},"title":{"type":"string"},"note":{"type":"string"}}}}}}},"x-openai-isConsequential":false}},"/api/k/{store_id}/runs/{run_id}":{"get":{"operationId":"getStep","summary":"Where a running step is now.","parameters":[{"name":"store_id","in":"path","required":true,"description":"The knowledge store's id: the uuid at the end of the person's store link.","schema":{"type":"string"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"format","in":"query","required":true,"schema":{"type":"string","enum":["json"],"default":"json"}}],"responses":{"200":{"description":"The step's state: `waiting` (a prompt for you, with `call_id`), `running`, `done` (with `next` and `result`), `failed` or `error`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"waiting, running, done, failed or error."},"run_id":{"type":"string"},"call_id":{"type":"string","description":"waiting: the prompt to answer with replyToPrompt."},"task":{"type":"string","description":"waiting: what to do with the prompt."},"system":{"type":"string","description":"waiting: the prompt's instructions."},"messages":{"type":"array","description":"waiting: the prompt's messages.","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"reply_schema":{"description":"waiting: the JSON schema the reply fits, or null for plain text."},"prompts_after_this":{"type":"integer"},"next":{"type":"string","description":"What to tell the person and do next."},"result":{"description":"done: the step's result."},"error":{"type":"string","description":"failed: why."},"title":{"type":"string"},"note":{"type":"string"}}}}}}},"x-openai-isConsequential":false}},"/api/k/{store_id}/runs/{run_id}/reply/{call_id}":{"post":{"operationId":"replyToPrompt","summary":"Answer the prompt a step is waiting on.","parameters":[{"name":"store_id","in":"path","required":true,"description":"The knowledge store's id: the uuid at the end of the person's store link.","schema":{"type":"string"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"call_id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reply"],"properties":{"reply":{"type":"string","description":"Your answer: the JSON object the reply_schema asks for, written as JSON text - or plain text when there is no schema."}}}}}},"responses":{"200":{"description":"The step's state: `waiting` (a prompt for you, with `call_id`), `running`, `done` (with `next` and `result`), `failed` or `error`.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"waiting, running, done, failed or error."},"run_id":{"type":"string"},"call_id":{"type":"string","description":"waiting: the prompt to answer with replyToPrompt."},"task":{"type":"string","description":"waiting: what to do with the prompt."},"system":{"type":"string","description":"waiting: the prompt's instructions."},"messages":{"type":"array","description":"waiting: the prompt's messages.","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}}}},"reply_schema":{"description":"waiting: the JSON schema the reply fits, or null for plain text."},"prompts_after_this":{"type":"integer"},"next":{"type":"string","description":"What to tell the person and do next."},"result":{"description":"done: the step's result."},"error":{"type":"string","description":"failed: why."},"title":{"type":"string"},"note":{"type":"string"}}}}}}},"x-openai-isConsequential":false}}}}