minix 0.3.2__tar.gz → 0.3.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.
- {minix-0.3.2 → minix-0.3.3}/PKG-INFO +53 -2
- {minix-0.3.2 → minix-0.3.3}/README.md +49 -1
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/init.py +1 -1
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/init_scaffold.py +5 -2
- {minix-0.3.2 → minix-0.3.3}/minix/core/entity/__init__.py +5 -0
- minix-0.3.3/minix/core/entity/pgvector_entity.py +22 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/__init__.py +2 -0
- minix-0.3.3/minix/core/repository/pgvector/__init__.py +1 -0
- minix-0.3.3/minix/core/repository/pgvector/pgvector_repository.py +64 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/__init__.py +2 -0
- minix-0.3.3/minix/core/service/pgvector/__init__.py +1 -0
- minix-0.3.3/minix/core/service/pgvector/pgvector_service.py +37 -0
- {minix-0.3.2 → minix-0.3.3}/pyproject.toml +5 -1
- {minix-0.3.2 → minix-0.3.3}/minix/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/bootstrap/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/bootstrap/bootstrap.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/cli.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/add_component.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/add_component_scaffold.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/add_module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/add_module_scaffold.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/add_rag.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/commands/init_prompts.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/cli/options.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/builders.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/env.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/global_settings.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/minix_settings.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/.dockerignore +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/.env.example +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/.gitignore +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/AGENTS.md +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/Dockerfile +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/config.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/docker-compose.yml +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/entries/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/entries/api.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/entries/beat.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/conf/project_template/entries/worker.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/object_storage_connector/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/object_storage_connector/config.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/object_storage_connector/connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/qdrant_connector/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/qdrant_connector/connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/redis_connector/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/redis_connector/redis_connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/sql_connector/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/sql_connector/sql_connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/connectors/sql_connector/transaction.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/consumer/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/consumer/async_consumer.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/controller/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/controller/controller.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/entity/entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/entity/qdrant_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/entity/redis_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/entity/sql_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/install/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/install/installable.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/model/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/model/embedding_model.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/model/mlflow_model.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/model/model.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/model/model_registry.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/module/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/module/business_module/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/module/business_module/business_module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/module/module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/dependencies.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/entities/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/entities/api_key_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/repositories/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/repositories/api_key_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/services/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/auth/services/api_key_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/config.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/controllers/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/controllers/oidc_controller.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/dependencies.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/entities/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/entities/oidc_user_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/repositories/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/repositories/oidc_user_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/services/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/services/oidc_discovery_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/services/oidc_user_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/oidc/session.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/chunking/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/chunking/preprocessor.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/chunking/smart_chunker.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/config.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/controllers/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/controllers/rag_controller.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/controllers/schemas.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/base.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/factory.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/gpt_processor.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/landingai_processor.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/embeddings.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/chunk_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/collection_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/document_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/job_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/query_request_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/entities/search_request_entity.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/hybrid_retriever.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/llm_factory.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/metadata_extractor.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/module.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/prompts.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/qdrant_ops.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/rag_chain.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/refusal.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/chunk_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/collection_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/document_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/job_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/query_request_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/search_request_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/retrieval/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/retrieval/llm_reranker.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/retrieval/multi_query_blender.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/access_policy.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/chunk_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/collection_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/document_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/job_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/match_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/query_request_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/services/search_request_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/object_storage/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/object_storage/config.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/object_storage/connector.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/registry/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/registry/registry.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/qdrant/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/qdrant/qdrant_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/redis/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/redis/redis_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/sql/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/repository/sql/sql_repository.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/scheduler.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/task/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/task/task.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/task/workflow_tasks.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/scheduler/workflow.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/base_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/helper_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/qdrant/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/qdrant/qdrant_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/redis/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/redis/redis_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/sql/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/service/sql/sql_service.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/mlflow/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/mlflow/log_metric.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/singleton/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/singleton/singleton.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/string/__init__.py +0 -0
- {minix-0.3.2 → minix-0.3.3}/minix/core/utils/string/to_snake_case.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: minix
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: A modular Python framework for backend, AI, and data projects
|
|
5
5
|
Author: AmirHossein Advari
|
|
6
6
|
Author-email: amiradvari@gmail.com
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
13
13
|
Provides-Extra: ai
|
|
14
14
|
Provides-Extra: clickhouse
|
|
15
15
|
Provides-Extra: mysql
|
|
16
|
+
Provides-Extra: pgvector
|
|
16
17
|
Provides-Extra: postgresql
|
|
17
18
|
Provides-Extra: rag
|
|
18
19
|
Provides-Extra: vdb
|
|
@@ -37,6 +38,8 @@ Requires-Dist: mlflow (>=2.0) ; extra == "ai"
|
|
|
37
38
|
Requires-Dist: numpy (>=1.24) ; extra == "ai"
|
|
38
39
|
Requires-Dist: numpy (>=1.24) ; extra == "vdb"
|
|
39
40
|
Requires-Dist: pdf2image (>=1.17.0) ; extra == "rag"
|
|
41
|
+
Requires-Dist: pgvector (>=0.4) ; extra == "pgvector"
|
|
42
|
+
Requires-Dist: psycopg[binary] (>=3.1) ; extra == "pgvector"
|
|
40
43
|
Requires-Dist: psycopg[binary] (>=3.1) ; extra == "postgresql"
|
|
41
44
|
Requires-Dist: psycopg[binary] (>=3.1) ; extra == "rag"
|
|
42
45
|
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
|
@@ -78,10 +81,12 @@ Description-Content-Type: text/markdown
|
|
|
78
81
|
- [Entities](#entities)
|
|
79
82
|
- [SQL Entity](#sql-entity)
|
|
80
83
|
- [Qdrant Entity (Vector DB)](#qdrant-entity-vector-db)
|
|
84
|
+
- [PGVector Entity (PostgreSQL vectors)](#pgvector-entity-postgresql-vectors)
|
|
81
85
|
- [Redis Entity](#redis-entity)
|
|
82
86
|
- [Repositories](#repositories)
|
|
83
87
|
- [SQL Repository](#sql-repository)
|
|
84
88
|
- [Qdrant Repository](#qdrant-repository)
|
|
89
|
+
- [PGVector Repository](#pgvector-repository)
|
|
85
90
|
- [Services](#services)
|
|
86
91
|
- [Controllers](#controllers)
|
|
87
92
|
- [Connectors](#connectors)
|
|
@@ -112,6 +117,7 @@ Description-Content-Type: text/markdown
|
|
|
112
117
|
- [SQL drivers](#sql-drivers)
|
|
113
118
|
- [AI Capabilities](#ai-capabilities)
|
|
114
119
|
- [Vector DB (Qdrant)](#vector-db-qdrant)
|
|
120
|
+
- [Vector DB (pgvector)](#vector-db-pgvector)
|
|
115
121
|
- [ClickHouse Support](#clickhouse-support)
|
|
116
122
|
- [Install All Extras](#install-all-extras)
|
|
117
123
|
- [Registry Usage](#registry-usage)
|
|
@@ -290,6 +296,24 @@ class DocumentEntity(QdrantEntity):
|
|
|
290
296
|
return "documents"
|
|
291
297
|
```
|
|
292
298
|
|
|
299
|
+
#### PGVector Entity (PostgreSQL vectors)
|
|
300
|
+
|
|
301
|
+
Requires the `pgvector` extra and a PostgreSQL server with the `vector` extension.
|
|
302
|
+
|
|
303
|
+
```python
|
|
304
|
+
from sqlalchemy import Text
|
|
305
|
+
from sqlalchemy.orm import Mapped, mapped_column
|
|
306
|
+
from minix.core.entity import PGVectorEntity
|
|
307
|
+
|
|
308
|
+
class DocumentEmbeddingEntity(PGVectorEntity):
|
|
309
|
+
vector_size = 1536
|
|
310
|
+
|
|
311
|
+
content: Mapped[str] = mapped_column(Text, nullable=False)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
PGVector entities are SQL entities: they include `id`, `created_at` and
|
|
315
|
+
`updated_at`, plus a `vector` column of type `VECTOR(vector_size)`.
|
|
316
|
+
|
|
293
317
|
#### Redis Entity
|
|
294
318
|
|
|
295
319
|
```python
|
|
@@ -360,6 +384,27 @@ class DocumentRepository(QdrantRepository[DocumentEntity]):
|
|
|
360
384
|
- `query(entity, top_k)` - Similarity search
|
|
361
385
|
- `delete(entity_ids)` - Delete vectors
|
|
362
386
|
|
|
387
|
+
#### PGVector Repository
|
|
388
|
+
|
|
389
|
+
```python
|
|
390
|
+
from minix.core.repository import PGVectorRepository
|
|
391
|
+
|
|
392
|
+
class DocumentEmbeddingRepository(PGVectorRepository[DocumentEmbeddingEntity]):
|
|
393
|
+
def get_distance(self) -> str:
|
|
394
|
+
return 'Cosine' # or 'Euclid', 'Dot', 'Manhattan'
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
It extends `SqlRepository` (all SQL methods above, `sql_transaction()`
|
|
398
|
+
included) and uses the registered `SqlConnector`, which must point at PostgreSQL.
|
|
399
|
+
|
|
400
|
+
**Additional methods:**
|
|
401
|
+
- `create_extension()` - Run `CREATE EXTENSION IF NOT EXISTS vector`
|
|
402
|
+
- `search(vector, top_k, max_distance=None, **kwargs)` - Nearest neighbours, closest first; `kwargs` filter like `get_by`
|
|
403
|
+
- `search_with_distance(vector, top_k, max_distance=None, **kwargs)` - Same, as `(entity, distance)` pairs
|
|
404
|
+
|
|
405
|
+
`PGVectorService` exposes the same `search` / `search_with_distance` methods,
|
|
406
|
+
plus `get_knn(entity, top_k)`, on top of `SqlService`.
|
|
407
|
+
|
|
363
408
|
### Services
|
|
364
409
|
|
|
365
410
|
Services contain business logic:
|
|
@@ -940,6 +985,12 @@ pip install "minix[ai]"
|
|
|
940
985
|
pip install "minix[vdb]"
|
|
941
986
|
```
|
|
942
987
|
|
|
988
|
+
### Vector DB (pgvector)
|
|
989
|
+
|
|
990
|
+
```bash
|
|
991
|
+
pip install "minix[pgvector]"
|
|
992
|
+
```
|
|
993
|
+
|
|
943
994
|
### ClickHouse Support
|
|
944
995
|
|
|
945
996
|
```bash
|
|
@@ -958,7 +1009,7 @@ pip install "minix[rag]"
|
|
|
958
1009
|
### Install All Extras
|
|
959
1010
|
|
|
960
1011
|
```bash
|
|
961
|
-
pip install "minix[postgresql,mysql,ai,vdb,clickhouse,rag]"
|
|
1012
|
+
pip install "minix[postgresql,pgvector,mysql,ai,vdb,clickhouse,rag]"
|
|
962
1013
|
```
|
|
963
1014
|
|
|
964
1015
|
---
|
|
@@ -25,10 +25,12 @@
|
|
|
25
25
|
- [Entities](#entities)
|
|
26
26
|
- [SQL Entity](#sql-entity)
|
|
27
27
|
- [Qdrant Entity (Vector DB)](#qdrant-entity-vector-db)
|
|
28
|
+
- [PGVector Entity (PostgreSQL vectors)](#pgvector-entity-postgresql-vectors)
|
|
28
29
|
- [Redis Entity](#redis-entity)
|
|
29
30
|
- [Repositories](#repositories)
|
|
30
31
|
- [SQL Repository](#sql-repository)
|
|
31
32
|
- [Qdrant Repository](#qdrant-repository)
|
|
33
|
+
- [PGVector Repository](#pgvector-repository)
|
|
32
34
|
- [Services](#services)
|
|
33
35
|
- [Controllers](#controllers)
|
|
34
36
|
- [Connectors](#connectors)
|
|
@@ -59,6 +61,7 @@
|
|
|
59
61
|
- [SQL drivers](#sql-drivers)
|
|
60
62
|
- [AI Capabilities](#ai-capabilities)
|
|
61
63
|
- [Vector DB (Qdrant)](#vector-db-qdrant)
|
|
64
|
+
- [Vector DB (pgvector)](#vector-db-pgvector)
|
|
62
65
|
- [ClickHouse Support](#clickhouse-support)
|
|
63
66
|
- [Install All Extras](#install-all-extras)
|
|
64
67
|
- [Registry Usage](#registry-usage)
|
|
@@ -237,6 +240,24 @@ class DocumentEntity(QdrantEntity):
|
|
|
237
240
|
return "documents"
|
|
238
241
|
```
|
|
239
242
|
|
|
243
|
+
#### PGVector Entity (PostgreSQL vectors)
|
|
244
|
+
|
|
245
|
+
Requires the `pgvector` extra and a PostgreSQL server with the `vector` extension.
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from sqlalchemy import Text
|
|
249
|
+
from sqlalchemy.orm import Mapped, mapped_column
|
|
250
|
+
from minix.core.entity import PGVectorEntity
|
|
251
|
+
|
|
252
|
+
class DocumentEmbeddingEntity(PGVectorEntity):
|
|
253
|
+
vector_size = 1536
|
|
254
|
+
|
|
255
|
+
content: Mapped[str] = mapped_column(Text, nullable=False)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
PGVector entities are SQL entities: they include `id`, `created_at` and
|
|
259
|
+
`updated_at`, plus a `vector` column of type `VECTOR(vector_size)`.
|
|
260
|
+
|
|
240
261
|
#### Redis Entity
|
|
241
262
|
|
|
242
263
|
```python
|
|
@@ -307,6 +328,27 @@ class DocumentRepository(QdrantRepository[DocumentEntity]):
|
|
|
307
328
|
- `query(entity, top_k)` - Similarity search
|
|
308
329
|
- `delete(entity_ids)` - Delete vectors
|
|
309
330
|
|
|
331
|
+
#### PGVector Repository
|
|
332
|
+
|
|
333
|
+
```python
|
|
334
|
+
from minix.core.repository import PGVectorRepository
|
|
335
|
+
|
|
336
|
+
class DocumentEmbeddingRepository(PGVectorRepository[DocumentEmbeddingEntity]):
|
|
337
|
+
def get_distance(self) -> str:
|
|
338
|
+
return 'Cosine' # or 'Euclid', 'Dot', 'Manhattan'
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
It extends `SqlRepository` (all SQL methods above, `sql_transaction()`
|
|
342
|
+
included) and uses the registered `SqlConnector`, which must point at PostgreSQL.
|
|
343
|
+
|
|
344
|
+
**Additional methods:**
|
|
345
|
+
- `create_extension()` - Run `CREATE EXTENSION IF NOT EXISTS vector`
|
|
346
|
+
- `search(vector, top_k, max_distance=None, **kwargs)` - Nearest neighbours, closest first; `kwargs` filter like `get_by`
|
|
347
|
+
- `search_with_distance(vector, top_k, max_distance=None, **kwargs)` - Same, as `(entity, distance)` pairs
|
|
348
|
+
|
|
349
|
+
`PGVectorService` exposes the same `search` / `search_with_distance` methods,
|
|
350
|
+
plus `get_knn(entity, top_k)`, on top of `SqlService`.
|
|
351
|
+
|
|
310
352
|
### Services
|
|
311
353
|
|
|
312
354
|
Services contain business logic:
|
|
@@ -887,6 +929,12 @@ pip install "minix[ai]"
|
|
|
887
929
|
pip install "minix[vdb]"
|
|
888
930
|
```
|
|
889
931
|
|
|
932
|
+
### Vector DB (pgvector)
|
|
933
|
+
|
|
934
|
+
```bash
|
|
935
|
+
pip install "minix[pgvector]"
|
|
936
|
+
```
|
|
937
|
+
|
|
890
938
|
### ClickHouse Support
|
|
891
939
|
|
|
892
940
|
```bash
|
|
@@ -905,7 +953,7 @@ pip install "minix[rag]"
|
|
|
905
953
|
### Install All Extras
|
|
906
954
|
|
|
907
955
|
```bash
|
|
908
|
-
pip install "minix[postgresql,mysql,ai,vdb,clickhouse,rag]"
|
|
956
|
+
pip install "minix[postgresql,pgvector,mysql,ai,vdb,clickhouse,rag]"
|
|
909
957
|
```
|
|
910
958
|
|
|
911
959
|
---
|
|
@@ -179,7 +179,7 @@ def init(
|
|
|
179
179
|
"--extras",
|
|
180
180
|
help=(
|
|
181
181
|
"Comma-separated Minix PyPI extras for Docker and compose "
|
|
182
|
-
"(postgresql, mysql, vdb, clickhouse, ai, rag). "
|
|
182
|
+
"(postgresql, pgvector, mysql, vdb, clickhouse, ai, rag). "
|
|
183
183
|
"SQL extras are also set from --db-driver / the SQL prompt. "
|
|
184
184
|
"Default for non-SQL extras: infer from this environment."
|
|
185
185
|
),
|
|
@@ -6,12 +6,13 @@ import importlib.util
|
|
|
6
6
|
import re
|
|
7
7
|
from typing import Iterable
|
|
8
8
|
|
|
9
|
-
VALID_MINIX_EXTRAS = frozenset({"postgresql", "mysql", "vdb", "clickhouse", "ai", "rag"})
|
|
10
|
-
_EXTRA_ORDER = ("postgresql", "mysql", "vdb", "clickhouse", "ai", "rag")
|
|
9
|
+
VALID_MINIX_EXTRAS = frozenset({"postgresql", "pgvector", "mysql", "vdb", "clickhouse", "ai", "rag"})
|
|
10
|
+
_EXTRA_ORDER = ("postgresql", "pgvector", "mysql", "vdb", "clickhouse", "ai", "rag")
|
|
11
11
|
# Template feature blocks may use shorter aliases (e.g. BEGIN_POSTGRES).
|
|
12
12
|
_FEATURE_TO_PIP_EXTRA = {
|
|
13
13
|
"postgresql": "postgresql",
|
|
14
14
|
"postgres": "postgresql",
|
|
15
|
+
"pgvector": "pgvector",
|
|
15
16
|
"mysql": "mysql",
|
|
16
17
|
"vdb": "vdb",
|
|
17
18
|
"clickhouse": "clickhouse",
|
|
@@ -30,6 +31,8 @@ def detect_installed_minix_extras() -> set[str]:
|
|
|
30
31
|
extras: set[str] = set()
|
|
31
32
|
if importlib.util.find_spec("psycopg") is not None:
|
|
32
33
|
extras.add("postgresql")
|
|
34
|
+
if importlib.util.find_spec("pgvector") is not None:
|
|
35
|
+
extras.add("pgvector")
|
|
33
36
|
if importlib.util.find_spec("pymysql") is not None:
|
|
34
37
|
extras.add("mysql")
|
|
35
38
|
if importlib.util.find_spec("qdrant_client") is not None:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typing import ClassVar, List
|
|
2
|
+
|
|
3
|
+
from pgvector.sqlalchemy import VECTOR
|
|
4
|
+
from sqlalchemy.orm import Mapped, mapped_column, declared_attr
|
|
5
|
+
|
|
6
|
+
from minix.core.entity import SqlEntity
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PGVectorEntity(SqlEntity):
|
|
10
|
+
"""SQL entity stored in PostgreSQL with a pgvector ``vector`` column.
|
|
11
|
+
|
|
12
|
+
Subclasses set ``vector_size`` to the embedding dimension; it becomes the
|
|
13
|
+
column type ``VECTOR(<vector_size>)``. ``None`` leaves the dimension
|
|
14
|
+
unbounded, which pgvector accepts but cannot index.
|
|
15
|
+
"""
|
|
16
|
+
__abstract__ = True
|
|
17
|
+
|
|
18
|
+
vector_size: ClassVar[int | None] = None
|
|
19
|
+
|
|
20
|
+
@declared_attr
|
|
21
|
+
def vector(cls) -> Mapped[List[float]]:
|
|
22
|
+
return mapped_column(VECTOR(cls.vector_size), nullable=False)
|
|
@@ -4,4 +4,6 @@ from .redis import RedisRepository
|
|
|
4
4
|
import importlib.util
|
|
5
5
|
if importlib.util.find_spec('qdrant_client'):
|
|
6
6
|
from minix.core.repository.qdrant import QdrantRepository
|
|
7
|
+
if importlib.util.find_spec('pgvector'):
|
|
8
|
+
from minix.core.repository.pgvector import PGVectorRepository
|
|
7
9
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .pgvector_repository import PGVectorRepository
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from typing import TypeVar, Type, List, Tuple
|
|
2
|
+
|
|
3
|
+
from sqlalchemy import text
|
|
4
|
+
from sqlalchemy.sql.elements import ColumnElement
|
|
5
|
+
|
|
6
|
+
from minix.core.entity import PGVectorEntity
|
|
7
|
+
from minix.core.connectors.sql_connector import SqlConnector
|
|
8
|
+
from minix.core.repository import SqlRepository
|
|
9
|
+
|
|
10
|
+
T = TypeVar('T', bound=PGVectorEntity)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PGVectorRepository(SqlRepository[T]):
|
|
14
|
+
# Distance names follow Qdrant's, mapped to pgvector's comparator methods.
|
|
15
|
+
DISTANCES = {
|
|
16
|
+
'Cosine': 'cosine_distance',
|
|
17
|
+
'Euclid': 'l2_distance',
|
|
18
|
+
'Dot': 'max_inner_product',
|
|
19
|
+
'Manhattan': 'l1_distance',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def __init__(self, entity: Type[T], sql_connector: SqlConnector):
|
|
23
|
+
super().__init__(entity, sql_connector)
|
|
24
|
+
self.entity = entity
|
|
25
|
+
|
|
26
|
+
def create_extension(self) -> None:
|
|
27
|
+
with self.get_session() as session:
|
|
28
|
+
session.execute(text('CREATE EXTENSION IF NOT EXISTS vector'))
|
|
29
|
+
session.commit()
|
|
30
|
+
|
|
31
|
+
def get_distance(self) -> str:
|
|
32
|
+
return 'Cosine'
|
|
33
|
+
|
|
34
|
+
def distance_to(self, vector: List[float]) -> ColumnElement[float]:
|
|
35
|
+
distance = self.get_distance()
|
|
36
|
+
if distance not in self.DISTANCES:
|
|
37
|
+
raise ValueError(f'Distance not supported: {distance!r}')
|
|
38
|
+
return getattr(self.entity.vector, self.DISTANCES[distance])(vector)
|
|
39
|
+
|
|
40
|
+
def search_with_distance(
|
|
41
|
+
self,
|
|
42
|
+
vector: List[float],
|
|
43
|
+
top_k: int = 10,
|
|
44
|
+
max_distance: float | None = None,
|
|
45
|
+
**kwargs
|
|
46
|
+
) -> List[Tuple[T, float]]:
|
|
47
|
+
# `max_distance` bounds the pgvector distance; for 'Dot' that is the
|
|
48
|
+
# negative inner product.
|
|
49
|
+
distance = self.distance_to(vector)
|
|
50
|
+
with self.get_session() as session:
|
|
51
|
+
query = session.query(self.entity, distance.label('distance')).filter_by(**kwargs)
|
|
52
|
+
if max_distance is not None:
|
|
53
|
+
query = query.filter(distance <= max_distance)
|
|
54
|
+
rows = query.order_by(distance).limit(top_k).all()
|
|
55
|
+
return [(entity, value) for entity, value in rows]
|
|
56
|
+
|
|
57
|
+
def search(
|
|
58
|
+
self,
|
|
59
|
+
vector: List[float],
|
|
60
|
+
top_k: int = 10,
|
|
61
|
+
max_distance: float | None = None,
|
|
62
|
+
**kwargs
|
|
63
|
+
) -> List[T]:
|
|
64
|
+
return [entity for entity, _ in self.search_with_distance(vector, top_k, max_distance, **kwargs)]
|
|
@@ -8,4 +8,6 @@ from minix.core.service.redis.redis_service import RedisService
|
|
|
8
8
|
|
|
9
9
|
if importlib.util.find_spec('qdrant_client'):
|
|
10
10
|
from minix.core.service.qdrant.qdrant_service import QdrantService
|
|
11
|
+
if importlib.util.find_spec('pgvector'):
|
|
12
|
+
from minix.core.service.pgvector.pgvector_service import PGVectorService
|
|
11
13
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .pgvector_service import PGVectorService
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from typing import TypeVar, List, Tuple
|
|
2
|
+
|
|
3
|
+
from minix.core.entity import PGVectorEntity
|
|
4
|
+
from minix.core.repository.pgvector.pgvector_repository import PGVectorRepository
|
|
5
|
+
from minix.core.service import SqlService
|
|
6
|
+
|
|
7
|
+
T = TypeVar('T', bound=PGVectorEntity)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PGVectorService(SqlService[T]):
|
|
11
|
+
def __init__(self, repository: PGVectorRepository[T]):
|
|
12
|
+
super().__init__(repository)
|
|
13
|
+
self.repository = repository
|
|
14
|
+
|
|
15
|
+
def get_repository(self) -> PGVectorRepository[T]:
|
|
16
|
+
return self.repository
|
|
17
|
+
|
|
18
|
+
def get_knn(self, entity: T, top_k: int = 10) -> List[T]:
|
|
19
|
+
return self.get_repository().search(entity.vector, top_k)
|
|
20
|
+
|
|
21
|
+
def search(
|
|
22
|
+
self,
|
|
23
|
+
vector: List[float],
|
|
24
|
+
top_k: int = 10,
|
|
25
|
+
max_distance: float | None = None,
|
|
26
|
+
**kwargs
|
|
27
|
+
) -> List[T]:
|
|
28
|
+
return self.get_repository().search(vector, top_k, max_distance, **kwargs)
|
|
29
|
+
|
|
30
|
+
def search_with_distance(
|
|
31
|
+
self,
|
|
32
|
+
vector: List[float],
|
|
33
|
+
top_k: int = 10,
|
|
34
|
+
max_distance: float | None = None,
|
|
35
|
+
**kwargs
|
|
36
|
+
) -> List[Tuple[T, float]]:
|
|
37
|
+
return self.get_repository().search_with_distance(vector, top_k, max_distance, **kwargs)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "minix"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.3"
|
|
4
4
|
description = "A modular Python framework for backend, AI, and data projects"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "AmirHossein Advari", email = "amiradvari@gmail.com" }
|
|
@@ -27,6 +27,10 @@ dependencies = [
|
|
|
27
27
|
postgresql = [
|
|
28
28
|
"psycopg[binary]>=3.1",
|
|
29
29
|
]
|
|
30
|
+
pgvector = [
|
|
31
|
+
"psycopg[binary]>=3.1",
|
|
32
|
+
"pgvector>=0.4",
|
|
33
|
+
]
|
|
30
34
|
mysql = [
|
|
31
35
|
"pymysql>=1.1.1",
|
|
32
36
|
]
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
{minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/document_processor/landingai_processor.py
RENAMED
|
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
|
|
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
|
{minix-0.3.2 → minix-0.3.3}/minix/core/modules/rag/repositories/search_request_repository.py
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|