Skip to content

Commit 7d534a8

Browse files
committed
remove unused legacy endpoint
1 parent 5a48161 commit 7d534a8

File tree

4 files changed

+8
-78
lines changed

4 files changed

+8
-78
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Agent Query Engine
1+
# Document Query Engine
22

3-
[![API Tests](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/api-tests.yml/badge.svg)](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/api-tests.yml)
4-
[![API Build](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/api-build.yml/badge.svg)](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/api-build.yml)
5-
[![UI Build](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/ui-build.yml/badge.svg)](https://github.com/Yukigeshiki/agent-query-engine-python/actions/workflows/ui-build.yml)
3+
[![API Tests](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/api-tests.yml/badge.svg)](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/api-tests.yml)
4+
[![API Build](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/api-build.yml/badge.svg)](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/api-build.yml)
5+
[![UI Build](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/ui-build.yml/badge.svg)](https://github.com/Yukigeshiki/document-query-engine-python/actions/workflows/ui-build.yml)
66

77
A document ingestion and query engine built with Python/FastAPI, LlamaIndex, Neo4j, and pgvector. Upload documents (PDF, DOCX, TXT — max 5MB), extract knowledge graph triplets and vector embeddings, then query across both using natural language. LlamaIndex orchestrates the full pipeline — chunking documents, extracting entity-relationship triplets via OpenAI into Neo4j, embedding chunks into pgvector, and synthesizing answers from dual retrieval (graph traversal + vector similarity). Documents are stored in GCS and processed asynchronously via Celery. The UI provides testing for document upload with interactive graph visualization, a query interface with retrieval mode selection, and document deletion.
88

@@ -18,7 +18,7 @@ A document ingestion and query engine built with Python/FastAPI, LlamaIndex, Neo
1818

1919
## Prerequisites
2020

21-
- Python 3.13+ and [Poetry](https://python-poetry.org/)
21+
- Python 3.12+ and [Poetry](https://python-poetry.org/)
2222
- Docker
2323
- Node.js + pnpm
2424
- `OPENAI_API_KEY` environment variable
@@ -124,12 +124,14 @@ curl -X POST http://localhost:8000/api/v1/kg/ingest/upload \
124124
|--------|------|-------------|
125125
| POST | `/kg/query` | Query documents with natural language |
126126
| POST | `/kg/ingest/upload` | Upload a file for async ingestion (max 5MB) |
127+
| POST | `/kg/ingest/source` | Ingest from a source connector (async) |
127128
| GET | `/kg/documents` | List ingested documents (paginated, newest first) |
128129
| DELETE | `/kg/documents/{docId}` | Delete a document from all storage layers |
129130
| GET | `/kg/documents/graph` | Get knowledge graph for a document |
130131
| GET | `/kg/subgraph` | Get subgraph around an entity |
131132
| GET | `/tasks/{taskId}` | Poll background task status |
132-
| GET | `/api/v1/health` | Health check |
133+
| DELETE | `/tasks/{taskId}` | Cancel a background task |
134+
| GET | `/health` | Health check |
133135
| GET | `/metrics` | Prometheus metrics |
134136

135137
## Build Commands

services/query-engine/app/api/v1/knowledge_graph.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from app.models.knowledge_graph import (
1111
DocumentInfo,
1212
DocumentListResponse,
13-
IngestRequest,
14-
IngestResponse,
1513
QueryRequest,
1614
QueryResponse,
1715
SourceIngestRequest,
@@ -70,21 +68,6 @@ async def delete_document(
7068
return TaskAcceptedResponse(task_id=result.id)
7169

7270

73-
@router.post("/ingest", response_model=IngestResponse)
74-
@limiter.limit(settings.rate_limit_ingest)
75-
async def ingest_document(
76-
request: Request,
77-
body: IngestRequest,
78-
service: KnowledgeGraphService = Depends(get_kg_service),
79-
) -> IngestResponse:
80-
"""Ingest a text document into the knowledge graph."""
81-
doc_id, triplet_count = await service.ingest(
82-
text=body.text,
83-
metadata=body.metadata,
84-
)
85-
return IngestResponse(document_id=doc_id, triplet_count=triplet_count)
86-
87-
8871
@router.post(
8972
"/ingest/source",
9073
response_model=TaskAcceptedResponse,

services/query-engine/app/models/knowledge_graph.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,6 @@ class QueryRequest(CamelModel):
4242
retrieval_mode: RetrievalMode = Field(default=RetrievalMode.DUAL)
4343

4444

45-
class IngestRequest(CamelModel):
46-
"""Request body for document ingestion."""
47-
48-
text: str = Field(..., min_length=1, description="Document text to ingest")
49-
metadata: dict[str, Any] | None = Field(
50-
default=None, description="Optional metadata key-value pairs"
51-
)
52-
53-
54-
class IngestResponse(CamelModel):
55-
"""Response after successful document ingestion."""
56-
57-
document_id: str
58-
triplet_count: int
59-
60-
6145
class SourceIngestRequest(CamelModel):
6246
"""Request body for bulk document ingestion from a source."""
6347

services/query-engine/tests/test_knowledge_graph.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
def mock_kg_service() -> AsyncMock:
2424
"""Create a mock KnowledgeGraphService."""
2525
service = AsyncMock()
26-
service.ingest.return_value = ("test-doc-id", 5)
2726
service.query.return_value = (
2827
"Test response about the topic.",
2928
[SourceNodeInfo(source_type=SourceRetrievalType.VECTOR, score=0.9, metadata=SourceNodeMetadata(file_name="test.txt"))],
@@ -71,34 +70,6 @@ async def kg_client(mock_kg_service: AsyncMock) -> AsyncIterator[AsyncClient]:
7170
yield ac
7271

7372

74-
@pytest.mark.asyncio
75-
async def test_ingest_document(kg_client: AsyncClient, mock_kg_service: AsyncMock) -> None:
76-
"""Verify ingest endpoint returns document ID and triplet count."""
77-
response = await kg_client.post(
78-
"/api/v1/kg/ingest",
79-
json={"text": "Alice works at Acme Corp in New York."},
80-
)
81-
assert response.status_code == 200
82-
data = response.json()
83-
assert data["documentId"] == "test-doc-id"
84-
assert data["tripletCount"] == 5
85-
mock_kg_service.ingest.assert_called_once()
86-
87-
88-
@pytest.mark.asyncio
89-
async def test_ingest_with_metadata(kg_client: AsyncClient, mock_kg_service: AsyncMock) -> None:
90-
"""Verify ingest accepts optional metadata."""
91-
response = await kg_client.post(
92-
"/api/v1/kg/ingest",
93-
json={"text": "Some document.", "metadata": {"source": "test"}},
94-
)
95-
assert response.status_code == 200
96-
mock_kg_service.ingest.assert_called_once_with(
97-
text="Some document.",
98-
metadata={"source": "test"},
99-
)
100-
101-
10273
@pytest.mark.asyncio
10374
async def test_query_knowledge_graph(
10475
kg_client: AsyncClient, mock_kg_service: AsyncMock
@@ -198,16 +169,6 @@ async def test_document_graph_missing_doc_ids(kg_client: AsyncClient) -> None:
198169
assert response.status_code == 422
199170

200171

201-
@pytest.mark.asyncio
202-
async def test_ingest_empty_text(kg_client: AsyncClient) -> None:
203-
"""Verify validation rejects empty text."""
204-
response = await kg_client.post(
205-
"/api/v1/kg/ingest",
206-
json={"text": ""},
207-
)
208-
assert response.status_code == 422
209-
210-
211172
@pytest.mark.asyncio
212173
async def test_query_empty_query(kg_client: AsyncClient) -> None:
213174
"""Verify validation rejects empty query."""

0 commit comments

Comments
 (0)