Spaces:
Sleeping
Sleeping
Update main3.py
Browse files
main3.py
CHANGED
|
@@ -34,7 +34,7 @@ class RunResponse(BaseModel):
|
|
| 34 |
answers: List[str]
|
| 35 |
|
| 36 |
class TestRequest(BaseModel):
|
| 37 |
-
|
| 38 |
|
| 39 |
# --- NEW: Test Endpoint for Parent-Child Chunking ---
|
| 40 |
@app.post("/test/chunk", response_model=Dict[str, Any], tags=["Testing"])
|
|
@@ -48,7 +48,7 @@ async def test_chunking_endpoint(request: TestRequest):
|
|
| 48 |
|
| 49 |
try:
|
| 50 |
# Step 1: Parse the document to get raw text
|
| 51 |
-
markdown_content = await ingest_and_parse_document(request.
|
| 52 |
|
| 53 |
# Step 2: Create parent and child chunks
|
| 54 |
child_documents, docstore, _ = create_parent_child_chunks(markdown_content)
|
|
@@ -90,7 +90,7 @@ async def run_rag_pipeline(request: RunRequest):
|
|
| 90 |
|
| 91 |
# --- STAGE 1: DOCUMENT INGESTION (Parsing) ---
|
| 92 |
parse_start = time.perf_counter()
|
| 93 |
-
markdown_content = await ingest_and_parse_document(request.
|
| 94 |
timings["1_parsing"] = time.perf_counter() - parse_start
|
| 95 |
print(f"Time taken for Parsing: {timings['1_parsing']:.4f} seconds.")
|
| 96 |
|
|
|
|
| 34 |
answers: List[str]
|
| 35 |
|
| 36 |
class TestRequest(BaseModel):
|
| 37 |
+
documents: HttpUrl
|
| 38 |
|
| 39 |
# --- NEW: Test Endpoint for Parent-Child Chunking ---
|
| 40 |
@app.post("/test/chunk", response_model=Dict[str, Any], tags=["Testing"])
|
|
|
|
| 48 |
|
| 49 |
try:
|
| 50 |
# Step 1: Parse the document to get raw text
|
| 51 |
+
markdown_content = await ingest_and_parse_document(request.documents)
|
| 52 |
|
| 53 |
# Step 2: Create parent and child chunks
|
| 54 |
child_documents, docstore, _ = create_parent_child_chunks(markdown_content)
|
|
|
|
| 90 |
|
| 91 |
# --- STAGE 1: DOCUMENT INGESTION (Parsing) ---
|
| 92 |
parse_start = time.perf_counter()
|
| 93 |
+
markdown_content = await ingest_and_parse_document(request.documents)
|
| 94 |
timings["1_parsing"] = time.perf_counter() - parse_start
|
| 95 |
print(f"Time taken for Parsing: {timings['1_parsing']:.4f} seconds.")
|
| 96 |
|