Skip to content

Commit 59ec61d

Browse files
authored
Fix tutorial rag extractor agent (#73)
Fix things that do not work after testing
1 parent c0aa8d6 commit 59ec61d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/tutorials/rag_extractor_tutorial.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ from nerxiv.prompts.prompts import (
376376
StructuredPrompt,
377377
PROMPT_REGISTRY
378378
)
379-
from .datamodel import DFT
379+
from datamodel import DFT
380380

381381

382382
new_entry = PromptRegistryEntry(
@@ -394,7 +394,7 @@ new_entry = PromptRegistryEntry(
394394
"If you do NOT find the value of a field in the text, do NOT make up a value. Leave it as null in the JSON output.",
395395
"Do NOT infer values of fields that are not explicitly mentioned in the text.",
396396
"Return the JSON as specified in the prompt. Do NOT make up a new JSON with different field names or structure.",
397-
"Ensure that all parsed values are of the correct data type as defined in the DFT schema.",
397+
"Ensure that all parsed values are of the correct data type as defined in the targeted section.",
398398
],
399399
examples=[],
400400
),
@@ -428,12 +428,12 @@ import h5py
428428
from nerxiv.chunker import Chunker
429429
from nerxiv.rag import CustomRetriever, LLMGenerator, RAGExtractorAgent
430430

431-
from .datamodel import DFT
432-
from .prompt_registry import MOD_PROMPT_REGISTRY
431+
from datamodel import DFT
432+
from prompt_registry import PROMPT_REGISTRY
433433

434434

435435
query = "dft"
436-
entry = MOD_PROMPT_REGISTRY[query]
436+
entry = PROMPT_REGISTRY[query]
437437
prompt = entry.prompt
438438

439439

@@ -443,7 +443,7 @@ chunker_params = {
443443
"chunk_overlap": 500,
444444
}
445445
retriever_params = {
446-
"retriever_query": entry.retriever_query,
446+
"query": entry.retriever_query,
447447
"model": "all-MiniLM-L6-v2",
448448
"n_top_chunks": 5,
449449
"query_name": query,
@@ -470,7 +470,7 @@ with h5py.File(Path("path_to_hdf5.hdf5"), "a") as f:
470470
agent.run(file=f, text=text, prompt=prompt)
471471
```
472472

473-
This workflow will run the `RAGExtractorAgent`, extract the specific target fields for the specific output schema in the `MOD_PROMPT_REGISTRY` dictionary, and store the results in the HDF5 file containing the queried arXiv PDF information.
473+
This workflow will run the `RAGExtractorAgent`, extract the specific target fields for the specific output schema in the `PROMPT_REGISTRY` dictionary, and store the results in the HDF5 file containing the queried arXiv PDF information.
474474

475475
**Notes**:
476476
- We used the normal `Chunker` in this example. Depending on the chunker you use, you will need to modify the `chunker_params` dictionary accordingly.

0 commit comments

Comments
 (0)