lean-explore 0.1.1__py3-none-any.whl
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.
- lean_explore/__init__.py +1 -0
- lean_explore/api/__init__.py +1 -0
- lean_explore/api/client.py +124 -0
- lean_explore/cli/__init__.py +1 -0
- lean_explore/cli/agent.py +781 -0
- lean_explore/cli/config_utils.py +408 -0
- lean_explore/cli/data_commands.py +506 -0
- lean_explore/cli/main.py +659 -0
- lean_explore/defaults.py +117 -0
- lean_explore/local/__init__.py +1 -0
- lean_explore/local/search.py +921 -0
- lean_explore/local/service.py +394 -0
- lean_explore/mcp/__init__.py +1 -0
- lean_explore/mcp/app.py +107 -0
- lean_explore/mcp/server.py +247 -0
- lean_explore/mcp/tools.py +242 -0
- lean_explore/shared/__init__.py +1 -0
- lean_explore/shared/models/__init__.py +1 -0
- lean_explore/shared/models/api.py +117 -0
- lean_explore/shared/models/db.py +411 -0
- lean_explore-0.1.1.dist-info/METADATA +277 -0
- lean_explore-0.1.1.dist-info/RECORD +26 -0
- lean_explore-0.1.1.dist-info/WHEEL +5 -0
- lean_explore-0.1.1.dist-info/entry_points.txt +2 -0
- lean_explore-0.1.1.dist-info/licenses/LICENSE +201 -0
- lean_explore-0.1.1.dist-info/top_level.txt +1 -0
lean_explore/defaults.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# src/lean_explore/defaults.py
|
|
2
|
+
|
|
3
|
+
"""Provides default paths and configuration parameters for the lean_explore package.
|
|
4
|
+
|
|
5
|
+
This module centralizes default values. The defined paths point to
|
|
6
|
+
a user-specific data directory where downloaded assets (database,
|
|
7
|
+
FAISS index, etc.) for a specific toolchain version are expected to reside.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
import pathlib
|
|
12
|
+
from typing import Final
|
|
13
|
+
|
|
14
|
+
# --- User-Specific Data Directory ---
|
|
15
|
+
# Define a base directory within the user's home folder to store
|
|
16
|
+
# downloaded data assets for lean_explore.
|
|
17
|
+
# Example: ~/.lean_explore/data/
|
|
18
|
+
USER_HOME_DIR: Final[pathlib.Path] = pathlib.Path(os.path.expanduser("~"))
|
|
19
|
+
LEAN_EXPLORE_USER_DATA_DIR: Final[pathlib.Path] = (
|
|
20
|
+
USER_HOME_DIR / ".lean_explore" / "data"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# --- Toolchain Specific Paths ---
|
|
24
|
+
# Directory within the user data directory to store versioned toolchain data.
|
|
25
|
+
# Example: ~/.lean_explore/data/toolchains/
|
|
26
|
+
LEAN_EXPLORE_TOOLCHAINS_BASE_DIR: Final[pathlib.Path] = (
|
|
27
|
+
LEAN_EXPLORE_USER_DATA_DIR / "toolchains"
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Default active toolchain version.
|
|
31
|
+
# In future enhancements, this could be determined dynamically
|
|
32
|
+
# or from user configuration.
|
|
33
|
+
# For now, it's set to the initial version of data provided ("0.1.0").
|
|
34
|
+
DEFAULT_ACTIVE_TOOLCHAIN_VERSION: Final[str] = "0.1.0"
|
|
35
|
+
|
|
36
|
+
# Path to the data directory for the currently active toolchain version.
|
|
37
|
+
# Example: ~/.lean_explore/data/toolchains/0.1.0/
|
|
38
|
+
_ACTIVE_TOOLCHAIN_VERSION_DATA_PATH: Final[pathlib.Path] = (
|
|
39
|
+
LEAN_EXPLORE_TOOLCHAINS_BASE_DIR / DEFAULT_ACTIVE_TOOLCHAIN_VERSION
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
# --- Default Filenames (names of the asset files themselves) ---
|
|
43
|
+
DEFAULT_DB_FILENAME: Final[str] = "lean_explore_data.db"
|
|
44
|
+
DEFAULT_FAISS_INDEX_FILENAME: Final[str] = "main_faiss.index"
|
|
45
|
+
DEFAULT_FAISS_MAP_FILENAME: Final[str] = "faiss_ids_map.json"
|
|
46
|
+
|
|
47
|
+
# --- Default Full Paths (to be used by the application for the active toolchain) ---
|
|
48
|
+
# These paths indicate where the package will look for its data files
|
|
49
|
+
# for the currently active toolchain version. The data management component
|
|
50
|
+
# will be responsible for downloading files to these versioned locations.
|
|
51
|
+
|
|
52
|
+
DEFAULT_DB_PATH: Final[pathlib.Path] = (
|
|
53
|
+
_ACTIVE_TOOLCHAIN_VERSION_DATA_PATH / DEFAULT_DB_FILENAME
|
|
54
|
+
)
|
|
55
|
+
DEFAULT_FAISS_INDEX_PATH: Final[pathlib.Path] = (
|
|
56
|
+
_ACTIVE_TOOLCHAIN_VERSION_DATA_PATH / DEFAULT_FAISS_INDEX_FILENAME
|
|
57
|
+
)
|
|
58
|
+
DEFAULT_FAISS_MAP_PATH: Final[pathlib.Path] = (
|
|
59
|
+
_ACTIVE_TOOLCHAIN_VERSION_DATA_PATH / DEFAULT_FAISS_MAP_FILENAME
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# For SQLAlchemy, the database URL needs to be a string.
|
|
63
|
+
# We construct the SQLite URL string from the Path object.
|
|
64
|
+
DEFAULT_DB_URL: Final[str] = f"sqlite:///{DEFAULT_DB_PATH.resolve()}"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# --- Remote Data Asset Defaults ---
|
|
68
|
+
# These constants are used by the data management commands to locate and
|
|
69
|
+
# manage remote toolchain data assets.
|
|
70
|
+
|
|
71
|
+
# Default URL for the master manifest file on R2.
|
|
72
|
+
R2_MANIFEST_DEFAULT_URL: Final[str] = (
|
|
73
|
+
"https://pub-48b75babc4664808b15520033423c765.r2.dev/manifest.json"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Base URL for accessing assets on R2. Specific file paths from the manifest
|
|
77
|
+
# will be appended to this base.
|
|
78
|
+
R2_ASSETS_BASE_URL: Final[str] = "https://pub-48b75babc4664808b15520033423c765.r2.dev/"
|
|
79
|
+
|
|
80
|
+
# Filename for storing the currently selected active toolchain version.
|
|
81
|
+
# This file will reside in LEAN_EXPLORE_USER_DATA_DIR.
|
|
82
|
+
# Example: ~/.lean_explore/data/active_toolchain.txt
|
|
83
|
+
ACTIVE_TOOLCHAIN_CONFIG_FILENAME: Final[str] = "active_toolchain.txt"
|
|
84
|
+
|
|
85
|
+
# Full path to the active toolchain configuration file.
|
|
86
|
+
ACTIVE_TOOLCHAIN_CONFIG_FILE_PATH: Final[pathlib.Path] = (
|
|
87
|
+
LEAN_EXPLORE_USER_DATA_DIR / ACTIVE_TOOLCHAIN_CONFIG_FILENAME
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# --- Default Embedding Model ---
|
|
92
|
+
DEFAULT_EMBEDDING_MODEL_NAME: Final[str] = "BAAI/bge-base-en-v1.5"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# --- Default Search Parameters ---
|
|
96
|
+
# These values are based on the previously discussed config.yml and search.py fallbacks.
|
|
97
|
+
|
|
98
|
+
# FAISS Search Parameters
|
|
99
|
+
DEFAULT_FAISS_K: Final[int] = 100 # Number of nearest neighbors from FAISS
|
|
100
|
+
DEFAULT_FAISS_NPROBE: Final[int] = 200 # For IVF-type FAISS indexes
|
|
101
|
+
|
|
102
|
+
# Scoring and Ranking Parameters
|
|
103
|
+
DEFAULT_SEM_SIM_THRESHOLD: Final[float] = 0.525
|
|
104
|
+
DEFAULT_PAGERANK_WEIGHT: Final[float] = 1.0
|
|
105
|
+
DEFAULT_TEXT_RELEVANCE_WEIGHT: Final[float] = 0.2
|
|
106
|
+
DEFAULT_NAME_MATCH_WEIGHT: Final[float] = 0.5
|
|
107
|
+
|
|
108
|
+
# Output Parameters
|
|
109
|
+
DEFAULT_RESULTS_LIMIT: Final[int] = (
|
|
110
|
+
50 # Default number of final results to display/return
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# --- Other Constants (if any emerge) ---
|
|
115
|
+
# Example: If your application needs other hardcoded default values,
|
|
116
|
+
# they can be added here.
|
|
117
|
+
# DEFAULT_SOME_OTHER_PARAMETER: Final[Any] = "some_value"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Local package for lean explore."""
|