diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-04-23 22:08:03 +0200 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2024-04-23 22:08:03 +0200 |
commit | 75be0914f6bd2cdeda1539f83b38fcbc854d5cfa (patch) | |
tree | 8d518f43926a98ee2cbae262d152662d0c07e9f6 /rag/cli.py | |
parent | 694a4ad0e5a9e4c7eb6d11fff5ae414292ef8169 (diff) |
Add reranking as a separate step
Diffstat (limited to 'rag/cli.py')
-rw-r--r-- | rag/cli.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -37,13 +37,13 @@ def rag(generator: str, query: str, limit): retriever = Retriever() generator = get_generator(generator) documents = retriever.retrieve(query, limit=limit) - prompt = Prompt(query, documents) + prompt = generator.rerank(Prompt(query, documents)) print("Answer: ") for chunk in generator.generate(prompt): print(chunk, end="", flush=True) print("\n\n") - for i, doc in enumerate(documents): + for i, doc in enumerate(prompt.documents): print(f"### Document {i}") print(f"**Title: {doc.title}**") print(doc.text) |