pgvector-template 0.2.2__tar.gz → 0.2.3__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.2.2 → pgvector_template-0.2.3}/PKG-INFO +1 -1
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/core/document.py +1 -1
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/core/search.py +5 -4
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/db/document_db.py +2 -1
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/service/document_service.py +2 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/PKG-INFO +1 -1
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pyproject.toml +1 -1
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/LICENSE +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/README.md +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/__init__.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/core/__init__.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/core/embedder.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/core/manager.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/db/__init__.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/db/connection.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/service/__init__.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/types.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/utils/__init__.py +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/SOURCES.txt +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/dependency_links.txt +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/requires.txt +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/top_level.txt +0 -0
- {pgvector_template-0.2.2 → pgvector_template-0.2.3}/setup.cfg +0 -0
|
@@ -86,7 +86,7 @@ class BaseDocument(Base):
|
|
|
86
86
|
"""Flexible metadata as JSON"""
|
|
87
87
|
origin_url = Column(String(2048), nullable=True)
|
|
88
88
|
"""Optional source URL"""
|
|
89
|
-
language = Column(String(
|
|
89
|
+
language = Column(String(2), default="en")
|
|
90
90
|
"""Language of the content (ISO 639-1 code), e.g., 'en', 'es', 'zh'."""
|
|
91
91
|
score = Column(Float, nullable=True)
|
|
92
92
|
"""Optional score assigned during ingestion (e.g., relevance, confidence)."""
|
|
@@ -3,10 +3,9 @@ from datetime import datetime
|
|
|
3
3
|
from logging import getLogger
|
|
4
4
|
from typing import Any, Type, Sequence
|
|
5
5
|
|
|
6
|
-
from pydantic import BaseModel, Field, model_validator
|
|
7
|
-
from sqlalchemy import
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
7
|
+
from sqlalchemy import select, or_
|
|
8
8
|
from sqlalchemy.sql import Select
|
|
9
|
-
from pgvector.sqlalchemy import Vector
|
|
10
9
|
|
|
11
10
|
from pgvector_template.core import (
|
|
12
11
|
BaseEmbeddingProvider,
|
|
@@ -23,7 +22,7 @@ class SearchQuery(BaseModel):
|
|
|
23
22
|
"""Standardized search query structure. At least 1 search criterion is required."""
|
|
24
23
|
|
|
25
24
|
text: str | None = None
|
|
26
|
-
"""String to
|
|
25
|
+
"""String to match against using in a semantic search, i.e. using vector distance."""
|
|
27
26
|
keywords: list[str] | None = None
|
|
28
27
|
"""List of keywords to exact-match in a keyword search."""
|
|
29
28
|
metadata_filters: dict[str, Any] | None = None
|
|
@@ -36,6 +35,8 @@ class SearchQuery(BaseModel):
|
|
|
36
35
|
)
|
|
37
36
|
"""Maximum number of results to return."""
|
|
38
37
|
|
|
38
|
+
model_config = ConfigDict(use_attribute_docstrings=True)
|
|
39
|
+
|
|
39
40
|
@model_validator(mode="after")
|
|
40
41
|
def ensure_criterion(self):
|
|
41
42
|
if not any([self.text, self.keywords, self.metadata_filters, self.date_range]):
|
|
@@ -37,7 +37,7 @@ class DocumentDatabaseManager(DatabaseManager):
|
|
|
37
37
|
self.schema_name = f"{self.SCHEMA_PREFIX}{schema_suffix}"
|
|
38
38
|
self.document_classes = document_classes
|
|
39
39
|
|
|
40
|
-
def setup(self) ->
|
|
40
|
+
def setup(self) -> str:
|
|
41
41
|
"""One-step setup: initialize connection, create schema and tables for all document classes"""
|
|
42
42
|
self.initialize()
|
|
43
43
|
self.create_schema(self.schema_name)
|
|
@@ -50,6 +50,7 @@ class DocumentDatabaseManager(DatabaseManager):
|
|
|
50
50
|
self.logger.info(
|
|
51
51
|
f"Document database setup complete for {self.schema_name} with {len(self.document_classes)} tables"
|
|
52
52
|
)
|
|
53
|
+
return self.schema_name
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
class TempDocumentDatabaseManager(DocumentDatabaseManager):
|
{pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template/service/document_service.py
RENAMED
|
@@ -50,8 +50,10 @@ class DocumentServiceConfig(BaseModel):
|
|
|
50
50
|
# iff either config is an instance of their respective base config classes (and not a subclass)
|
|
51
51
|
if type(self.corpus_manager_cfg) is BaseCorpusManagerConfig:
|
|
52
52
|
self.corpus_manager_cfg.document_cls = self.document_cls
|
|
53
|
+
self.corpus_manager_cfg.document_metadata_cls = self.document_metadata_cls
|
|
53
54
|
if type(self.search_client_cfg) is BaseSearchClientConfig:
|
|
54
55
|
self.search_client_cfg.document_cls = self.document_cls
|
|
56
|
+
self.search_client_cfg.document_metadata_cls = self.document_metadata_cls
|
|
55
57
|
|
|
56
58
|
# assign embedding_provider to CorpusManager & SearchClient configs
|
|
57
59
|
if not self.corpus_manager_cfg.embedding_provider:
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pgvector-template"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
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.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{pgvector_template-0.2.2 → pgvector_template-0.2.3}/pgvector_template.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|