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.
Files changed (26) hide show
  1. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/PKG-INFO +1 -1
  2. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/search.py +3 -1
  3. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/models/search.py +15 -6
  4. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/PKG-INFO +1 -1
  5. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pyproject.toml +1 -1
  6. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/LICENSE +0 -0
  7. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/README.md +0 -0
  8. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/__init__.py +0 -0
  9. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/__init__.py +0 -0
  10. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/document.py +0 -0
  11. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/embedder.py +0 -0
  12. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/core/manager.py +0 -0
  13. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/__init__.py +0 -0
  14. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/connection.py +0 -0
  15. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/db/document_db.py +0 -0
  16. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/models/__init__.py +0 -0
  17. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/service/__init__.py +0 -0
  18. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/service/document_service.py +0 -0
  19. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/types.py +0 -0
  20. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/utils/__init__.py +0 -0
  21. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template/utils/metadata_filter.py +0 -0
  22. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/SOURCES.txt +0 -0
  23. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/dependency_links.txt +0 -0
  24. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/requires.txt +0 -0
  25. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/pgvector_template.egg-info/top_level.txt +0 -0
  26. {pgvector_template-0.3.0 → pgvector_template-0.3.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pgvector-template
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Template library for flexible PGVector RAG implementations
5
5
  Author-email: DL <v49t9zpqd@mozmail.com>
6
6
  License: MIT
@@ -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(search_query.metadata_filters, self.config.document_metadata_cls)
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
- """List of metadata filter conditions that must be matched."""
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(use_attribute_docstrings=True)
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pgvector-template
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Template library for flexible PGVector RAG implementations
5
5
  Author-email: DL <v49t9zpqd@mozmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pgvector-template"
7
- version = "0.3.0"
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" }