Skip to content

Commit 1aa5797

Browse files
committed
feat: don't print relevance score by default
1 parent 2265bbe commit 1aa5797

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

gptme_rag/cli.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,11 @@ def index(
358358
type=click.Choice(["cuda", "cpu"]),
359359
help="Device to run embeddings on (cuda or cpu)",
360360
)
361+
@click.option(
362+
"--print-relevance",
363+
is_flag=True,
364+
help="Print relevance scores",
365+
)
361366
def search(
362367
query: str,
363368
paths: list[Path],
@@ -371,6 +376,7 @@ def search(
371376
weights: str | None,
372377
embedding_function: str | None,
373378
device: str | None,
379+
print_relevance: bool,
374380
):
375381
"""Search the index and assemble context."""
376382
paths = [path.resolve() for path in paths]
@@ -477,7 +483,7 @@ def get_expanded_content(doc: Document, expand: str, indexer: Indexer) -> str:
477483
if format == "full":
478484
for i, doc in enumerate(documents):
479485
# Show relevance info first
480-
if distances:
486+
if distances and print_relevance:
481487
formatter.print_relevance(1 - distances[i])
482488

483489
# Get and format content
@@ -529,7 +535,8 @@ def get_expanded_content(doc: Document, expand: str, indexer: Indexer) -> str:
529535
console.print(f"\n {'Total':15} [bold blue]{total:>7.3f}[/bold blue]")
530536
else:
531537
# Just show the base relevance score
532-
formatter.print_relevance(1 - distances[i])
538+
if distances and print_relevance:
539+
formatter.print_relevance(1 - distances[i])
533540

534541
# Display preview
535542
formatter.print_preview(doc)

0 commit comments

Comments
 (0)