diff --git a/pephub/_version.py b/pephub/_version.py index 66a62a27..1748769b 100644 --- a/pephub/_version.py +++ b/pephub/_version.py @@ -1 +1 @@ -__version__ = "0.15.7" +__version__ = "0.15.8" diff --git a/pephub/limiter.py b/pephub/limiter.py index d92814ec..3180e3cd 100644 --- a/pephub/limiter.py +++ b/pephub/limiter.py @@ -3,7 +3,6 @@ from slowapi.util import get_remote_address from slowapi.errors import RateLimitExceeded - limiter = Limiter(key_func=get_remote_address) diff --git a/pephub/routers/api/v1/namespace.py b/pephub/routers/api/v1/namespace.py index 4f831af7..ac357566 100644 --- a/pephub/routers/api/v1/namespace.py +++ b/pephub/routers/api/v1/namespace.py @@ -85,6 +85,7 @@ async def get_namespace_projects( limit: int = 10, offset: int = 0, query: str = None, + tag: str = None, admin_list: List[str] = Depends(get_namespace_access_list), order_by: Optional[ Literal["update_date", "name", "submission_date", "stars"] @@ -113,6 +114,7 @@ async def get_namespace_projects( search_result = agent.annotation.get( query=query, namespace=namespace, + tag=tag, limit=limit, offset=offset, admin=admin_list, @@ -126,6 +128,7 @@ async def get_namespace_projects( else: search_result = agent.annotation.get( namespace=namespace, + tag=tag, limit=limit, offset=offset, admin=admin_list, diff --git a/pephub/routers/api/v1/search.py b/pephub/routers/api/v1/search.py index d5c3618d..339737d3 100644 --- a/pephub/routers/api/v1/search.py +++ b/pephub/routers/api/v1/search.py @@ -64,7 +64,6 @@ async def search_for_pep( """ limit = query.limit offset = query.offset - score_threshold = query.score_threshold # get namespaces: namespaces: list[Namespace] = agent.namespace.get( @@ -83,7 +82,7 @@ async def search_for_pep( else: sparse_embeddings = None - should_statement = [ + must_statement = [ FieldCondition( key="name", match=MatchValue(value=query.query), @@ -93,18 +92,18 @@ async def search_for_pep( if sparse_embeddings: hybrid_query = [ # Dense retrieval: semantic understanding - Prefetch(query=dense_query, using="dense", limit=100), + Prefetch(query=dense_query, using="dense", limit=limit + offset), # Sparse retrieval: exact technical term matching - Prefetch(query=sparse_embeddings, using="sparse", limit=100), + Prefetch(query=sparse_embeddings, using="sparse", limit=limit + offset), # Exact match retrieval: precise filtering - Prefetch(filter=Filter(must=should_statement), limit=10), + Prefetch(filter=Filter(must=must_statement), limit=10), ] else: hybrid_query = [ # Dense retrieval: semantic understanding - Prefetch(query=dense_query, using="dense", limit=100), + Prefetch(query=dense_query, using="dense", limit=limit + offset), # Exact match retrieval: precise filtering - Prefetch(filter=Filter(must=should_statement), limit=10), + Prefetch(filter=Filter(must=must_statement), limit=10), ] vector_results = qdrant.query_points( diff --git a/pephub/routers/models.py b/pephub/routers/models.py index 69ad2435..8e52579b 100644 --- a/pephub/routers/models.py +++ b/pephub/routers/models.py @@ -22,7 +22,7 @@ class SearchQuery(BaseModel): query: str limit: Optional[int] = 100 offset: Optional[int] = 0 - score_threshold: Optional[float] = DEFAULT_QDRANT_SCORE_THRESHOLD + # score_threshold: Optional[float] = DEFAULT_QDRANT_SCORE_THRESHOLD class SearchReturnModel(BaseModel): diff --git a/requirements/requirements-all.txt b/requirements/requirements-all.txt index fb9e0b7b..b1b12340 100644 --- a/requirements/requirements-all.txt +++ b/requirements/requirements-all.txt @@ -1,6 +1,6 @@ fastapi>=0.108.0 psycopg>=3.1.15 -pepdbagent>=0.12.3 +pepdbagent>=0.12.4 # pepdbagent @ git+https://github.com/pepkit/pepdbagent.git@dev#egg=pepdbagent peppy>=0.40.7 eido>=0.2.4 diff --git a/scripts/utils.py b/scripts/utils.py index a003a175..124109ae 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -83,8 +83,6 @@ def extract_project_file_name(path_to_proj: str) -> str: # catch no .pep.yaml exists except FileNotFoundError: if not os.path.exists(f"{path_to_proj}/project_config.yaml"): - print( - f"No project config file found for {path_to_proj}.\ - This project will not be accessible by pephub. " - ) + print(f"No project config file found for {path_to_proj}.\ + This project will not be accessible by pephub. ") return "project_config.yaml"