File tree Expand file tree Collapse file tree
packages/fetchcraft-ingestion-admin/src/fetchcraft/ingestion/admin Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from fetchcraft .embeddings import OpenAIEmbeddings
1111from fetchcraft .index .vector_index import VectorIndex
1212from fetchcraft .ingestion .base import ConnectorSource , IngestionPipeline , Record , Sink
13- from fetchcraft .ingestion .pipeline .transformation import ChunkingTransformation
13+ from fetchcraft .ingestion .pipeline .transformation import ChunkingTransformation , DocumentSummarization
1414from fetchcraft .ingestion .sqlite_backend import AsyncSQLiteQueue
1515from fetchcraft .node import DocumentNode , Node
1616from fetchcraft .node_parser import HierarchicalNodeParser
@@ -149,7 +149,7 @@ def filter_fn(file: LocalFile) -> bool:
149149 "application/pdf" : RemoteDoclingParser (docling_url = DOCLING_SERVER )
150150 }
151151 ))
152- # .add_transformation(DocumentSummarization(max_sentences=2, simulate_latency=0.2 ), deferred=True)
152+ # .add_transformation(DocumentSummarization(max_sentences=2), deferred=True)
153153 # .add_transformation(ExtractKeywords())
154154 .add_transformation (ChunkingTransformation (chunker = chunker ))
155155 .add_sink (DocumentStoreSink (doc_store = doc_store ))
Original file line number Diff line number Diff line change @@ -583,6 +583,29 @@ async def list_queues() -> dict:
583583 raise RuntimeError (f"Error listing queues: { str (e )} " )
584584
585585
586+ @mcp .tool ()
587+ async def execute_ingestion () -> str :
588+ """
589+ Run the ingestion pipeline.
590+
591+ This tool will run the ingestion pipeline to refresh the knowledgebase.
592+
593+ Returns:
594+ Dictionary confirming the retry operation
595+ """
596+ from multiprocessing import Process
597+
598+ def _run_ingestion_wrapper ():
599+ """Wrapper to run the async ingestion function in a separate process."""
600+ asyncio .run (run_ingestion ())
601+
602+ print ("Starting ingestion in a separate process..." )
603+ p = Process (target = _run_ingestion_wrapper , name = "ingestion-process" )
604+ p .start ()
605+
606+ return f"Ingestion started in process { p .pid } . The process will run independently."
607+
608+
586609# ============================================================================
587610# Main Entry Point
588611# ============================================================================
You can’t perform that action at this time.
0 commit comments