Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pephub/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.15.7"
__version__ = "0.15.8"
1 change: 0 additions & 1 deletion pephub/limiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from slowapi.util import get_remote_address
from slowapi.errors import RateLimitExceeded


limiter = Limiter(key_func=get_remote_address)


Expand Down
3 changes: 3 additions & 0 deletions pephub/routers/api/v1/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
13 changes: 6 additions & 7 deletions pephub/routers/api/v1/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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),
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion pephub/routers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 2 additions & 4 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading