removed test retrieval feature. off you go

This commit is contained in:
2026-02-09 21:17:42 +03:00
parent f9c47c772f
commit 2cb9b39bf2
2 changed files with 30 additions and 94 deletions

View File

@@ -1,8 +1,8 @@
import os
from pathlib import Path
from dotenv import load_dotenv
import click
from dotenv import load_dotenv
from loguru import logger
# Load environment variables
@@ -85,36 +85,9 @@ def retrieve(query, collection_name, top_k):
"""Retrieve documents from vector database based on a query"""
logger.info(f"Starting retrieval process for query: {query}")
try:
# Import here to avoid circular dependencies
from retrieval import search_documents_with_metadata
# Perform retrieval
results = search_documents_with_metadata(
query=query,
collection_name=collection_name,
top_k=top_k
)
if not results:
click.echo("No relevant documents found for the query.")
return
click.echo(f"Found {len(results)} relevant documents:\n")
for i, result in enumerate(results, 1):
click.echo(f"{i}. Source: {result['source']}")
click.echo(f" Filename: {result['filename']}")
click.echo(f" Page: {result['page_number']}")
click.echo(f" File Extension: {result['file_extension']}")
click.echo(f" Content Preview: {result['content'][:200]}...")
click.echo(f" Metadata: {result['metadata']}\n")
logger.info("Retrieval process completed successfully!")
except Exception as e:
logger.error(f"Error during retrieval process: {str(e)}")
click.echo(f"Error: {str(e)}")
click.echo(
"WARNING: Retrieval disabled, since it is no longer relevant for the testing of the retrieving feature. Use chat with agent instead. xoxo"
)
@cli.command(
@@ -143,10 +116,7 @@ def chat(collection_name, model):
click.echo("Type 'quit' or 'exit' to end the conversation.\n")
# Run the interactive chat loop
run_chat_loop(
collection_name=collection_name,
llm_model=model
)
run_chat_loop(collection_name=collection_name, llm_model=model)
logger.info("Chat session ended")