Auto prev next
Node PostProcessor module.
AutoPrevNextNodePostprocessor #
Bases: BaseNodePostprocessor
Previous/Next Node post-processor.
Allows users to fetch additional nodes from the document store, based on the prev/next relationships of the nodes.
NOTE: difference with PrevNextPostprocessor is that this infers forward/backwards direction.
NOTE: this is a beta feature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
docstore
|
BaseDocumentStore
|
The document store. |
required |
num_nodes
|
int
|
The number of nodes to return (default: 1) |
required |
infer_prev_next_tmpl
|
str
|
The template to use for inference. Required fields are {context_str} and {query_str}. |
required |
llm
|
Annotated[LLM, SerializeAsAny] | None
|
|
None
|
refine_prev_next_tmpl
|
str
|
|
'The current context information is provided. \nA question is also provided. \nAn existing answer is also provided.\nYou are a retrieval agent deciding whether to search the document store for additional prior context or future context. \nGiven the context, question, and previous answer, return PREVIOUS or NEXT or NONE.\nExamples: \n\nContext: {context_msg}\nQuestion: {query_str}\nExisting Answer: {existing_answer}\nAnswer: '
|
verbose
|
bool
|
|
False
|
response_mode
|
ResponseMode
|
|
<ResponseMode.COMPACT: 'compact'>
|
Source code in llama-index-core/llama_index/core/postprocessor/node.py
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|