diff --git a/gptme_rag/cli.py b/gptme_rag/cli.py index 7397fe8..1959621 100644 --- a/gptme_rag/cli.py +++ b/gptme_rag/cli.py @@ -358,6 +358,11 @@ def index( type=click.Choice(["cuda", "cpu"]), help="Device to run embeddings on (cuda or cpu)", ) +@click.option( + "--print-relevance", + is_flag=True, + help="Print relevance scores", +) def search( query: str, paths: list[Path], @@ -371,6 +376,7 @@ def search( weights: str | None, embedding_function: str | None, device: str | None, + print_relevance: bool, ): """Search the index and assemble context.""" paths = [path.resolve() for path in paths] @@ -477,7 +483,7 @@ def get_expanded_content(doc: Document, expand: str, indexer: Indexer) -> str: if format == "full": for i, doc in enumerate(documents): # Show relevance info first - if distances: + if distances and print_relevance: formatter.print_relevance(1 - distances[i]) # Get and format content @@ -529,7 +535,8 @@ def get_expanded_content(doc: Document, expand: str, indexer: Indexer) -> str: console.print(f"\n {'Total':15} [bold blue]{total:>7.3f}[/bold blue]") else: # Just show the base relevance score - formatter.print_relevance(1 - distances[i]) + if distances and print_relevance: + formatter.print_relevance(1 - distances[i]) # Display preview formatter.print_preview(doc)