{
  "openapi": "3.1.0",
  "info": {
    "title": "FileFerret Tools",
    "version": "1.0.0",
    "description": "Search and analyze Qdrant-indexed audio, documents, images and video using Ollama embeddings and the best available LLM."
  },
  "servers": [{"url": "http://index-search-razor:8080"}],
  "paths": {
    "/api/search": {
      "post": {
        "operationId": "searchCollections",
        "summary": "Search indexed collections using semantic similarity",
        "description": "Embeds the query with Ollama and searches Qdrant by cosine similarity. Returns ranked text snippets with source file paths.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["query"],
                "properties": {
                  "query":          { "type": "string",  "description": "Search query text" },
                  "collections":    { "type": "array",   "items": { "type": "string" }, "description": "Collections to search. Omit for all available." },
                  "limit":          { "type": "integer", "default": 10, "description": "Max results per collection (1-500)" },
                  "keyword_filter": { "type": "string",  "description": "Optional keyword that must appear in result text" }
                }
              }
            }
          }
        },
        "responses": { "200": { "description": "Ranked search results grouped by collection" } }
      }
    },
    "/api/analyze": {
      "post": {
        "operationId": "analyzeCollections",
        "summary": "Answer a question from indexed content using the best available LLM",
        "description": "Retrieves relevant content from all or selected Qdrant collections (scroll=all points, search=top-k by similarity), then uses the highest-quality installed Ollama model to answer the question with source citations.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["question"],
                "properties": {
                  "question":       { "type": "string", "description": "The question to answer from indexed data" },
                  "collections":    { "type": "array",  "items": { "type": "string" }, "description": "Collections to include. Omit for all." },
                  "mode":           { "type": "string", "enum": ["scroll", "search"], "default": "scroll", "description": "scroll = load all content; search = semantic similarity only" },
                  "keyword_filter": { "type": "string", "description": "Optional keyword to filter retrieved content" }
                }
              }
            }
          }
        },
        "responses": { "200": { "description": "LLM answer with parameters used and source citations" } }
      }
    }
  }
}