Retrieve Service
Bases: Service
Manages semantic prompt retrieval and indexing by coordinating between vector/document databases, tracking metrics, and responding to system events.
This service is responsible for receiving prompt submissions, retrieving relevant information using vector similarity, and handling the indexing and metadata enrichment process. It interfaces with plugin-managed databases and provides observability through metrics tracking.
Attributes:
Name | Type | Description |
---|---|---|
plugin_manager |
PluginManager
|
Access point for system plugins, including vector and document DBs. |
vector_db_plugin |
dict
|
Plugin used for vector database operations (e.g., semantic search). |
db_plugin |
dict
|
Plugin for interacting with the document database. |
metrics_tracker |
MetricsTracker
|
Collects and resets retrieval-related metrics for monitoring. |
meta_repository |
MetaRepository
|
Handles Meta object persistence and transformation. |
repo_folders |
dict[str, Any]
|
Dictionary containing repository folder information. |
Methods:
Name | Description |
---|---|
init_async |
Initializes database connections and plugin setup asynchronously. |
start |
Subscribes to system topics for prompt processing and indexing lifecycle. |
stop |
Cleans up the service and halts processing. |
submit |
Prompt): Begins the retrieval process and logs submission metrics. |
on_submit_prompt |
dict[Any, Any]): Processes a prompt message and submits for processing. |
_on_repo_folders |
dict[str, Any]): Updates repository folder information. |
on_indices_complete |
dict): Converts index payload into Index objects and queues for insertion. |
_insert_engram_vector |
list[Index], engram_id: str, repo_ids: str, tracking_id: str): Asynchronously inserts semantic indices into vector DB with repository filters. |
on_meta_complete |
dict): Loads and inserts metadata summary into the vector DB. |
insert_meta_vector |
Meta): Runs metadata vector insertion in a background thread. |
on_acknowledge |
str): Emits service metrics to the status channel and resets the tracker. |
Source code in src/engramic/application/retrieve/retrieve_service.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|