compair-core 0.3.2__tar.gz → 0.4.5__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 (51) hide show
  1. {compair_core-0.3.2 → compair_core-0.4.5}/PKG-INFO +17 -3
  2. {compair_core-0.3.2 → compair_core-0.4.5}/README.md +12 -2
  3. compair_core-0.4.5/compair_core/__init__.py +8 -0
  4. compair_core-0.4.5/compair_core/api.py +3563 -0
  5. compair_core-0.4.5/compair_core/compair/__init__.py +106 -0
  6. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/embeddings.py +11 -1
  7. compair_core-0.4.5/compair_core/compair/feedback.py +368 -0
  8. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/main.py +53 -17
  9. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/models.py +137 -39
  10. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/tasks.py +11 -7
  11. compair_core-0.4.5/compair_core/compair/utils.py +42 -0
  12. compair_core-0.4.5/compair_core/compair_email/templates_core.py +32 -0
  13. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/app.py +8 -2
  14. compair_core-0.4.5/compair_core/server/local_model/app.py +87 -0
  15. compair_core-0.4.5/compair_core/server/local_model/ocr.py +44 -0
  16. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/routers/capabilities.py +9 -1
  17. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/settings.py +5 -1
  18. {compair_core-0.3.2 → compair_core-0.4.5}/compair_core.egg-info/PKG-INFO +17 -3
  19. compair_core-0.4.5/compair_core.egg-info/SOURCES.txt +42 -0
  20. {compair_core-0.3.2 → compair_core-0.4.5}/compair_core.egg-info/requires.txt +5 -0
  21. compair_core-0.4.5/compair_core.egg-info/top_level.txt +1 -0
  22. {compair_core-0.3.2 → compair_core-0.4.5}/pyproject.toml +7 -8
  23. compair_core-0.3.2/compair/__init__.py +0 -87
  24. compair_core-0.3.2/compair/feedback.py +0 -79
  25. compair_core-0.3.2/compair/utils.py +0 -61
  26. compair_core-0.3.2/compair_core.egg-info/SOURCES.txt +0 -39
  27. compair_core-0.3.2/compair_core.egg-info/top_level.txt +0 -3
  28. compair_core-0.3.2/compair_email/templates_core.py +0 -13
  29. compair_core-0.3.2/server/local_model/app.py +0 -62
  30. {compair_core-0.3.2 → compair_core-0.4.5}/LICENSE +0 -0
  31. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/celery_app.py +0 -0
  32. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/default_groups.py +0 -0
  33. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/logger.py +0 -0
  34. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair/schema.py +0 -0
  35. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair_email/__init__.py +0 -0
  36. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair_email/email.py +0 -0
  37. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair_email/email_core.py +0 -0
  38. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/compair_email/templates.py +0 -0
  39. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/__init__.py +0 -0
  40. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/deps.py +0 -0
  41. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/local_model/__init__.py +0 -0
  42. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/__init__.py +0 -0
  43. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/console_mailer.py +0 -0
  44. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/contracts.py +0 -0
  45. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/local_storage.py +0 -0
  46. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/noop_analytics.py +0 -0
  47. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/noop_billing.py +0 -0
  48. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/providers/noop_ocr.py +0 -0
  49. {compair_core-0.3.2 → compair_core-0.4.5/compair_core}/server/routers/__init__.py +0 -0
  50. {compair_core-0.3.2 → compair_core-0.4.5}/compair_core.egg-info/dependency_links.txt +0 -0
  51. {compair_core-0.3.2 → compair_core-0.4.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compair-core
3
- Version: 0.3.2
3
+ Version: 0.4.5
4
4
  Summary: Open-source foundation of the Compair collaboration platform.
5
5
  Author: RocketResearch, Inc.
6
6
  License: MIT
@@ -23,11 +23,15 @@ Requires-Dist: redis>=5.0
23
23
  Requires-Dist: psutil>=5.9
24
24
  Requires-Dist: python-Levenshtein>=0.23
25
25
  Requires-Dist: redmail>=0.6
26
+ Requires-Dist: python-multipart>=0.0.20
26
27
  Provides-Extra: dev
27
28
  Requires-Dist: build>=1.0; extra == "dev"
28
29
  Requires-Dist: twine>=5.0; extra == "dev"
29
30
  Requires-Dist: pytest>=8.0; extra == "dev"
30
31
  Requires-Dist: ruff>=0.3; extra == "dev"
32
+ Provides-Extra: ocr
33
+ Requires-Dist: pillow>=10.0; extra == "ocr"
34
+ Requires-Dist: pytesseract>=0.3.10; extra == "ocr"
31
35
  Provides-Extra: postgres
32
36
  Requires-Dist: psycopg2-binary>=2.9; extra == "postgres"
33
37
  Dynamic: license-file
@@ -85,9 +89,19 @@ Container definitions and build pipelines live outside this public package:
85
89
  Key environment variables for the core edition:
86
90
 
87
91
  - `COMPAIR_EDITION` (`core`) – corresponds to this core local implementation.
88
- - `COMPAIR_SQLITE_DIR` / `COMPAIR_SQLITE_NAME` override the default local SQLite path.
92
+ - `COMPAIR_DATABASE_URL` optional explicit SQLAlchemy URL (e.g. `postgresql+psycopg2://user:pass@host/db`). When omitted, Compair falls back to a local SQLite file.
93
+ - `COMPAIR_DB_DIR` / `COMPAIR_DB_NAME` – directory and filename for the bundled SQLite database (default: `~/.compair-core/data/compair.db`). Legacy `COMPAIR_SQLITE_*` variables remain supported.
89
94
  - `COMPAIR_LOCAL_MODEL_URL` – endpoint for your local embeddings/feedback service (defaults to `http://local-model:9000`).
90
95
  - `COMPAIR_EMAIL_BACKEND` – the core mailer logs emails to stdout; cloud overrides this with transactional delivery.
96
+ - `COMPAIR_REQUIRE_AUTHENTICATION` (`true`) – set to `false` to run the API in single-user mode without login or account management. When disabled, Compair auto-provisions a local user, group, and long-lived session token so you can upload documents immediately.
97
+ - `COMPAIR_SINGLE_USER_USERNAME` / `COMPAIR_SINGLE_USER_NAME` – override the email-style username and display name that are used for the auto-provisioned local user in single-user mode.
98
+ - `COMPAIR_INCLUDE_LEGACY_ROUTES` (`false`) – opt-in to the full legacy API surface (used by the hosted product) when running the core edition. Leave unset to expose only the streamlined single-user endpoints in Swagger.
99
+ - `COMPAIR_EMBEDDING_DIM` – force the embedding vector size stored in the database (defaults to 384 for core, 1536 for cloud). Keep this in sync with whichever embedding model you configure.
100
+ - `COMPAIR_VECTOR_BACKEND` (`auto`) – set to `pgvector` when running against PostgreSQL with the pgvector extension, or `json` to store embeddings as JSON (the default for SQLite deployments).
101
+ - `COMPAIR_GENERATION_PROVIDER` (`local`) – choose how feedback is produced. Options: `local` (call the bundled FastAPI service), `openai` (use ChatGPT-compatible APIs with an API key), `http` (POST the request to a custom endpoint), or `fallback` (skip generation and surface similar references only).
102
+ - `COMPAIR_OPENAI_API_KEY` / `COMPAIR_OPENAI_MODEL` – when using the OpenAI provider, supply your API key and optional model name (defaults to `gpt-5-nano`). The fallback kicks in automatically if the key or SDK is unavailable.
103
+ - `COMPAIR_GENERATION_ENDPOINT` – HTTP endpoint invoked when `COMPAIR_GENERATION_PROVIDER=http`; the service receives a JSON payload (`document`, `references`, `length_instruction`) and should return `{"feedback": ...}`.
104
+ - `COMPAIR_OCR_ENDPOINT` – endpoint the backend calls for OCR uploads (defaults to the bundled Tesseract wrapper at `http://local-ocr:9001/ocr-file`). Provide your own service by overriding this URL.
91
105
 
92
106
  See `compair_core/server/settings.py` for the full settings surface.
93
107
 
@@ -97,7 +111,7 @@ See `compair_core/server/settings.py` for the full settings surface.
97
111
  python -m venv .venv
98
112
  source .venv/bin/activate
99
113
  pip install -e ".[dev]"
100
- uvicorn compair.server.app:create_app --factory --reload
114
+ uvicorn compair_core.server.app:create_app --factory --reload
101
115
  ```
102
116
 
103
117
  The API will be available at http://127.0.0.1:8000 and supports the Swagger UI at `/docs`.
@@ -51,9 +51,19 @@ Container definitions and build pipelines live outside this public package:
51
51
  Key environment variables for the core edition:
52
52
 
53
53
  - `COMPAIR_EDITION` (`core`) – corresponds to this core local implementation.
54
- - `COMPAIR_SQLITE_DIR` / `COMPAIR_SQLITE_NAME` override the default local SQLite path.
54
+ - `COMPAIR_DATABASE_URL` optional explicit SQLAlchemy URL (e.g. `postgresql+psycopg2://user:pass@host/db`). When omitted, Compair falls back to a local SQLite file.
55
+ - `COMPAIR_DB_DIR` / `COMPAIR_DB_NAME` – directory and filename for the bundled SQLite database (default: `~/.compair-core/data/compair.db`). Legacy `COMPAIR_SQLITE_*` variables remain supported.
55
56
  - `COMPAIR_LOCAL_MODEL_URL` – endpoint for your local embeddings/feedback service (defaults to `http://local-model:9000`).
56
57
  - `COMPAIR_EMAIL_BACKEND` – the core mailer logs emails to stdout; cloud overrides this with transactional delivery.
58
+ - `COMPAIR_REQUIRE_AUTHENTICATION` (`true`) – set to `false` to run the API in single-user mode without login or account management. When disabled, Compair auto-provisions a local user, group, and long-lived session token so you can upload documents immediately.
59
+ - `COMPAIR_SINGLE_USER_USERNAME` / `COMPAIR_SINGLE_USER_NAME` – override the email-style username and display name that are used for the auto-provisioned local user in single-user mode.
60
+ - `COMPAIR_INCLUDE_LEGACY_ROUTES` (`false`) – opt-in to the full legacy API surface (used by the hosted product) when running the core edition. Leave unset to expose only the streamlined single-user endpoints in Swagger.
61
+ - `COMPAIR_EMBEDDING_DIM` – force the embedding vector size stored in the database (defaults to 384 for core, 1536 for cloud). Keep this in sync with whichever embedding model you configure.
62
+ - `COMPAIR_VECTOR_BACKEND` (`auto`) – set to `pgvector` when running against PostgreSQL with the pgvector extension, or `json` to store embeddings as JSON (the default for SQLite deployments).
63
+ - `COMPAIR_GENERATION_PROVIDER` (`local`) – choose how feedback is produced. Options: `local` (call the bundled FastAPI service), `openai` (use ChatGPT-compatible APIs with an API key), `http` (POST the request to a custom endpoint), or `fallback` (skip generation and surface similar references only).
64
+ - `COMPAIR_OPENAI_API_KEY` / `COMPAIR_OPENAI_MODEL` – when using the OpenAI provider, supply your API key and optional model name (defaults to `gpt-5-nano`). The fallback kicks in automatically if the key or SDK is unavailable.
65
+ - `COMPAIR_GENERATION_ENDPOINT` – HTTP endpoint invoked when `COMPAIR_GENERATION_PROVIDER=http`; the service receives a JSON payload (`document`, `references`, `length_instruction`) and should return `{"feedback": ...}`.
66
+ - `COMPAIR_OCR_ENDPOINT` – endpoint the backend calls for OCR uploads (defaults to the bundled Tesseract wrapper at `http://local-ocr:9001/ocr-file`). Provide your own service by overriding this URL.
57
67
 
58
68
  See `compair_core/server/settings.py` for the full settings surface.
59
69
 
@@ -63,7 +73,7 @@ See `compair_core/server/settings.py` for the full settings surface.
63
73
  python -m venv .venv
64
74
  source .venv/bin/activate
65
75
  pip install -e ".[dev]"
66
- uvicorn compair.server.app:create_app --factory --reload
76
+ uvicorn compair_core.server.app:create_app --factory --reload
67
77
  ```
68
78
 
69
79
  The API will be available at http://127.0.0.1:8000 and supports the Swagger UI at `/docs`.
@@ -0,0 +1,8 @@
1
+ """
2
+ Top-level package for compair-core.
3
+ Exposes the core FastAPI stack so users can import `.server.*`.
4
+ """
5
+
6
+ import sys
7
+
8
+