v1

latestOpenAPI 3.0.3MIT OR Apache-2.02026-07-17203670.3 KB
search

Search with LLM-guided tree traversal

Performs an intelligent search across documents using an LLM to navigate the hierarchical tree structure. The LLM evaluates each node's summary to decide which branches to explore, mimicking human reasoning. Returns relevant content with extracted answers and confidence scores.

post/v1/search

Request body

querystring required

The natural language query to search for

document_idstring

Optional document ID to search within (searches all if not provided)

table_idstring

Optional table ID to restrict search to

tagsstring[]

Filter by document tags (any match)

metadataobject

Filter by document metadata (author, contract_type, etc.)

max_depthinteger

Maximum tree depth to traverse (default: 10)

beam_widthinteger

Beam width for parallel exploration (default: 3)

min_confidencenumber

Minimum confidence to continue traversal (default: 0.3)

limitinteger

Maximum results to return (default: 10)

Example request

{
  "query": "What are the key benefits of machine learning?",
  "document_id": "doc_abc123",
  "table_id": "tbl_legal",
  "tags": [
    "nda",
    "confidential"
  ],
  "metadata": {
    "author": "Legal Team",
    "contract_type": "nda"
  },
  "max_depth": 10,
  "beam_width": 3,
  "min_confidence": 0.3,
  "limit": 10
}

Response

Search completed successfully

Example response

{
  "results": [
    {
      "node_id": "node_xyz789",
      "document_id": "doc_abc123",
      "path": [
        {
          "node_id": "node_abc",
          "title": "Chapter 3: Machine Learning",
          "reasoning": "This chapter covers ML fundamentals relevant to the query"
        }
      ],
      "content": "Machine learning enables computers to learn from data...",
      "answer": "The key benefits include automation, pattern recognition, and predictive capabilities.",
      "confidence": 0.85
    }
  ],
  "stats": {
    "nodes_visited": 15,
    "nodes_pruned": 8,
    "llm_calls": 7,
    "total_time_ms": 1250
  }
}