{"openapi":"3.1.0","info":{"title":"Cogni API","description":"A minimal FastAPI that directly passes user queries to OpenAI, augmented with Cogni memory.","version":"0.1.0"},"paths":{"/healthz":{"get":{"summary":"Health Check","description":"Health check endpoint for monitoring.","operationId":"health_check_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/chat/":{"post":{"tags":["Chat"],"summary":"Stream Chat","operationId":"stream_chat_chat__post","parameters":[{"name":"authorization","in":"header","required":true,"schema":{"type":"string","title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompleteQueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/blocks":{"get":{"tags":["Blocks"],"summary":"Get all memory blocks","description":"Retrieves all memory blocks currently stored in the system from the main branch.","operationId":"get_all_blocks_api_blocks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MemoryBlock"},"type":"array","title":"Response Get All Blocks Api Blocks Get"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/schemas/{block_type}/{version}":{"get":{"summary":"Get JSON schema for a block type and version","description":"Returns the JSON schema for the given block type and version.\nIf version is 'latest', resolves to the latest version for the type.","operationId":"get_schema_schemas__block_type___version__get","parameters":[{"name":"block_type","in":"path","required":true,"schema":{"type":"string","title":"Block Type"}},{"name":"version","in":"path","required":true,"schema":{"type":"string","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/schemas/index.json":{"get":{"summary":"Get index of all available block schemas","description":"Returns a list of all available block schemas with their type, version, and URL.","operationId":"get_schema_index_schemas_index_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"BlockLink":{"properties":{"to_id":{"type":"string","title":"To Id","description":"ID of the target block in the link"},"relation":{"type":"string","enum":["related_to","subtask_of","depends_on","child_of","mentions"],"title":"Relation","description":"The type of relationship between the blocks"},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Priority","description":"Priority of the link (higher numbers = higher priority)","default":0},"link_metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Link Metadata","description":"Additional metadata about the link"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"ID of the agent/user who created the link"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"When the link was created"}},"type":"object","required":["to_id","relation"],"title":"BlockLink","description":"Defines a directed link between two MemoryBlocks."},"CompleteQueryRequest":{"properties":{"message":{"type":"string","title":"Message","description":"The message content to send to the AI","examples":["What is CogniDAO?"]},"model":{"type":"string","title":"Model","description":"The AI model to use for generation","default":"gpt-3.5-turbo"},"temperature":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Temperature","description":"Controls randomness in the response. Lower is more deterministic.","default":0.7},"system_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Message","description":"Instructions for the AI assistant's behavior","default":"You are a helpful AI assistant."},"message_history":{"anyOf":[{"items":{"$ref":"#/components/schemas/HistoryMessage"},"type":"array"},{"type":"null"}],"title":"Message History","description":"Optional list of previous messages in the conversation"}},"type":"object","required":["message"],"title":"CompleteQueryRequest","description":"Extended schema for a chat request with additional parameters.\nThis can be used for more advanced chat endpoints."},"ConfidenceScore":{"properties":{"human":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Human","description":"Optional human confidence score (0.0 to 1.0)"},"ai":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Ai","description":"Optional AI-generated confidence score (0.0 to 1.0)"}},"type":"object","title":"ConfidenceScore","description":"Represents confidence scores, potentially from human or AI sources."},"ErrorResponse":{"properties":{"detail":{"type":"string","title":"Detail","description":"A human-readable error message"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code","description":"An optional error code for programmatic handling"}},"type":"object","required":["detail"],"title":"ErrorResponse","description":"Schema for error responses."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HistoryMessage":{"properties":{"role":{"type":"string","enum":["user","assistant","system"],"title":"Role","description":"The role of the message sender."},"content":{"type":"string","title":"Content","description":"The content of the message."}},"type":"object","required":["role","content"],"title":"HistoryMessage","description":"Schema for a single message in the chat history."},"MemoryBlock":{"properties":{"id":{"type":"string","title":"Id","description":"Globally unique ID for this memory block"},"type":{"type":"string","enum":["knowledge","task","project","doc","interaction","log"],"title":"Type","description":"Block type used to determine structure and relationships"},"schema_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Schema Version","description":"Version of the schema this block adheres to (links to node_schemas table)"},"text":{"type":"string","title":"Text","description":"Primary content or description of the block"},"state":{"anyOf":[{"type":"string","enum":["draft","published","archived"]},{"type":"null"}],"title":"State","description":"Current state of the block"},"visibility":{"anyOf":[{"type":"string","enum":["internal","public","restricted"]},{"type":"null"}],"title":"Visibility","description":"Visibility level of the block"},"block_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Block Version","description":"Version number of this block"},"tags":{"items":{"type":"string"},"type":"array","maxItems":20,"title":"Tags","description":"Optional tags for filtering, theming, or metadata"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","description":"Custom metadata based on block type"},"links":{"items":{"$ref":"#/components/schemas/BlockLink"},"type":"array","title":"Links","description":"Directed outgoing edges connecting this block to others"},"source_file":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source File","description":"Optional source markdown or file name"},"source_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Uri","description":"Optional source link or Logseq block URI"},"confidence":{"anyOf":[{"$ref":"#/components/schemas/ConfidenceScore"},{"type":"null"}],"description":"Confidence scores for this memory block"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"Optional identifier for creator (agent name or user ID)"},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"ISO timestamp of block creation"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"ISO timestamp of last update"},"embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Embedding","description":"Optional vector embedding of the block's content"}},"type":"object","required":["type","text"],"title":"MemoryBlock","description":"The primary data structure for representing a unit of memory in the Cogni system experiment.\nAligns with the design specified in project-CogniMemorySystem-POC.json.\nIncludes schema versioning support (Task 2.0)."},"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"}}}}