Skip to content

Nihai Ingest Json Search Endpoint

Ingest a list of NihAI entries in JSON format with dedupe/reference logic.

Behavior:
- For each entry, use `search_nihai` to check for an existing matching question.
- If a high-confidence match is found and its content aligns, append the incoming references to the existing entry.
- Otherwise, insert as a new Q&A entry.

Full JSON format for each entry aligns with the ingestion schema documented here:
- Docs: [/docs/search/nihai-ingestion](../docs/search/nihai-ingestion.md)

Entry object fields (summarized):
- `question: str` (required)
- `answer: str` (required)
- `references: list[str]` OR list of objects `{title, url, source, content_snippet?}` (optional)
- `is_verified: bool` (default false)
- `approvers: str` (optional)
- `source: str` (e.g., "import", "md_ingest", "perplexity")
- `accuracy_confidence: float` (0.0–1.0)
- `is_active: bool` (default true)
- `condition_area: str` (optional)
- `topic: str` (optional)

Request body wrapper:
```json
{
  "entries": [ { "question": "...", "answer": "...", "references": [
    {"title": "ACOG", "url": "https://www.acog.org/...", "source": "acog.org", "content_snippet": "..."}
  ], "source": "import", "accuracy_confidence": 0.7, "condition_area": "ANC", "topic": "..." } ],
  "collection": "NihAI"
}
```

API Reference

Endpoint: POST /search/nihai/ingest-json

Example Usage

curl -X POST http://localhost:8000/search/nihai/ingest-json \
  -H 'Content-Type: application/json' \
  -d '{'query': 'What are symptoms of high blood pressure?', 'max_results': 3}'