mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-09-03 16:25:55 +00:00
feat(API): Ingest plain text (#1417)
* Add ingest/text route to ingest plain text * Add new ingest text test and adapt ingest/file ones * Include new API in docs * Remove duplicated logic
This commit is contained in:
@@ -3,6 +3,7 @@ from pathlib import Path
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from private_gpt.server.ingest.ingest_router import IngestResponse
|
||||
from tests.fixtures.ingest_helper import IngestHelper
|
||||
|
||||
|
||||
@@ -34,3 +35,12 @@ def test_ingest_list_returns_something_after_ingestion(
|
||||
assert (
|
||||
count_ingest_after == count_ingest_before + 1
|
||||
), "The temp doc should be returned"
|
||||
|
||||
|
||||
def test_ingest_plain_text(test_client: TestClient) -> None:
|
||||
response = test_client.post(
|
||||
"/v1/ingest/text", json={"file_name": "file_name", "text": "text"}
|
||||
)
|
||||
assert response.status_code == 200
|
||||
ingest_result = IngestResponse.model_validate(response.json())
|
||||
assert len(ingest_result.data) == 1
|
||||
|
Reference in New Issue
Block a user