pgvector-template 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/PKG-INFO +1 -1
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/search.py +3 -1
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/models/search.py +15 -6
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/PKG-INFO +1 -1
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pyproject.toml +1 -1
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/LICENSE +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/README.md +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/document.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/embedder.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/manager.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/connection.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/document_db.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/models/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/service/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/service/document_service.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/types.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/utils/__init__.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/utils/metadata_filter.py +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/SOURCES.txt +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/dependency_links.txt +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/requires.txt +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/top_level.txt +0 -0
- {pgvector_template-0.3.0 → pgvector_template-0.3.1}/setup.cfg +0 -0
|
@@ -138,7 +138,9 @@ class BaseSearchClient:
|
|
|
138
138
|
|
|
139
139
|
# strictly speaking, this validation step is optional. You may override this method to disable
|
|
140
140
|
try:
|
|
141
|
-
validate_metadata_filters(
|
|
141
|
+
validate_metadata_filters(
|
|
142
|
+
search_query.metadata_filters, self.config.document_metadata_cls
|
|
143
|
+
)
|
|
142
144
|
except ValueError as e:
|
|
143
145
|
logger.warning(f"Metadata filter validation failed: {e}. Query success not guaranteed!")
|
|
144
146
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
from dataclasses import dataclass, asdict
|
|
2
2
|
from datetime import datetime
|
|
3
|
-
from typing import Any, Literal
|
|
3
|
+
from typing import Any, Literal, Type
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
6
6
|
|
|
7
|
-
from pgvector_template.core import BaseDocument
|
|
7
|
+
from pgvector_template.core import BaseDocument, BaseDocumentMetadata
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class MetadataFilter(BaseModel):
|
|
11
11
|
"""
|
|
12
12
|
An object acting as a filter for an arbitrary `Metadata` dictionary/map/object.
|
|
13
13
|
"""
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
field_name: str
|
|
16
16
|
"""Field path in metadata. Use dot notation for nested fields (e.g., 'publication_info.journal')"""
|
|
17
17
|
condition: Literal["eq", "gt", "gte", "lt", "lte", "contains", "in", "exists"]
|
|
@@ -37,8 +37,14 @@ class SearchQuery(BaseModel):
|
|
|
37
37
|
"""String to match against using in a semantic search, i.e. using vector distance."""
|
|
38
38
|
keywords: list[str] = []
|
|
39
39
|
"""List of keywords to **exact-match** in a keyword search."""
|
|
40
|
-
metadata_filters: list[MetadataFilter] =
|
|
41
|
-
|
|
40
|
+
metadata_filters: list[MetadataFilter] = Field(
|
|
41
|
+
default=[],
|
|
42
|
+
json_schema_extra={"metadata_schema": BaseDocumentMetadata.model_json_schema()},
|
|
43
|
+
)
|
|
44
|
+
"""
|
|
45
|
+
List of metadata conditions that must be matched.
|
|
46
|
+
Refer to `metadata_schema` for the expected schema, as it exists in the database.
|
|
47
|
+
"""
|
|
42
48
|
date_range: tuple[datetime, datetime] | None = None
|
|
43
49
|
"""Retrieve/limit results based on created_at & updated_at timestamps (i.e. database operations)"""
|
|
44
50
|
limit: int = Field(
|
|
@@ -47,7 +53,10 @@ class SearchQuery(BaseModel):
|
|
|
47
53
|
)
|
|
48
54
|
"""Maximum number of results to return."""
|
|
49
55
|
|
|
50
|
-
model_config = ConfigDict(
|
|
56
|
+
model_config = ConfigDict(
|
|
57
|
+
use_attribute_docstrings=True,
|
|
58
|
+
arbitrary_types_allowed=True,
|
|
59
|
+
)
|
|
51
60
|
|
|
52
61
|
@model_validator(mode="after")
|
|
53
62
|
def ensure_criterion(self):
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pgvector-template"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.1"
|
|
8
8
|
description = "Template library for flexible PGVector RAG implementations"
|
|
9
9
|
authors = [{ name="DL", email="v49t9zpqd@mozmail.com" }]
|
|
10
10
|
license = { text = "MIT" }
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/service/document_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/utils/metadata_filter.py
RENAMED
|
File without changes
|
|
File without changes
|
{pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|