biblemate 0.2.56__py3-none-any.whl → 0.2.57__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.
biblemate/__init__.py CHANGED
@@ -252,9 +252,12 @@ AGENTMAKE_CONFIG = {
252
252
  }
253
253
  OLLAMA_NOT_FOUND = "`Ollama` is not found! BibleMate AI uses `Ollama` to generate embeddings for semantic searches. You may install it from https://ollama.com/ so that you can perform semantic searches of the Bible with BibleMate AI."
254
254
  BIBLEMATE_VERSION = readTextFile(os.path.join(os.path.dirname(os.path.realpath(__file__)), "version.txt"))
255
- BIBLEMATEDATA = os.path.join(AGENTMAKE_USER_DIR, "biblemate", "data")
256
- if not os.path.isdir(BIBLEMATEDATA):
257
- Path(BIBLEMATEDATA).mkdir(parents=True, exist_ok=True)
255
+ #BIBLEMATEDATA = os.path.join(AGENTMAKE_USER_DIR, "biblemate", "data")
256
+ #if not os.path.isdir(BIBLEMATEDATA):
257
+ # Path(BIBLEMATEDATA).mkdir(parents=True, exist_ok=True)
258
+ BIBLEMATEVECTORSTORE = os.path.join(os.path.expanduser("~"), "biblemate", "data", "vectors")
259
+ if not os.path.isdir(BIBLEMATEVECTORSTORE):
260
+ Path(BIBLEMATEVECTORSTORE).mkdir(parents=True, exist_ok=True)
258
261
  BIBLEMATETEMP = os.path.join(os.path.dirname(os.path.realpath(__file__)), "temp")
259
262
  if not os.path.isdir(BIBLEMATETEMP):
260
263
  Path(BIBLEMATETEMP).mkdir(parents=True, exist_ok=True)
@@ -1,11 +1,11 @@
1
1
  import apsw, re, os, json
2
2
  from agentmake.utils.rag import get_embeddings
3
3
  from prompt_toolkit.shortcuts import ProgressBar
4
- from biblemate import config, BIBLEMATEDATA
4
+ from biblemate import config, BIBLEMATEVECTORSTORE
5
5
 
6
6
 
7
7
  def add_vector_data(db_file="dictionary.db", table="Dictionary", h2=False):
8
- db_file = os.path.join(BIBLEMATEDATA, db_file)
8
+ db_file = os.path.join(BIBLEMATEVECTORSTORE, db_file)
9
9
  if os.path.isfile(db_file):
10
10
  with apsw.Connection(db_file) as connection:
11
11
  cursor = connection.cursor()
@@ -31,7 +31,7 @@ def add_vector_data(db_file="dictionary.db", table="Dictionary", h2=False):
31
31
 
32
32
  def add_vector_names(create_table=True):
33
33
  from uniquebible.util.HBN import HBN
34
- db_file = os.path.join(BIBLEMATEDATA, "exlb.db")
34
+ db_file = os.path.join(BIBLEMATEVECTORSTORE, "exlb.db")
35
35
  table = "exlbn"
36
36
  if os.path.isfile(db_file):
37
37
  with apsw.Connection(db_file) as connection:
@@ -54,7 +54,7 @@ CREATE TABLE IF NOT EXISTS {table} (
54
54
  #cursor.execute(f"VACUUM;")
55
55
 
56
56
  def fix_vector_collections(db_file="collection.db", table="PARALLEL"):
57
- db_file = os.path.join(BIBLEMATEDATA, db_file)
57
+ db_file = os.path.join(BIBLEMATEVECTORSTORE, db_file)
58
58
  if os.path.isfile(db_file):
59
59
  with apsw.Connection(db_file) as connection:
60
60
  cursor = connection.cursor()
@@ -69,7 +69,7 @@ def fix_vector_collections(db_file="collection.db", table="PARALLEL"):
69
69
  #cursor.execute(f"VACUUM;")
70
70
 
71
71
  def add_vector_collections(db_file="collection.db", table="PROMISES", h2=False):
72
- db_file = os.path.join(BIBLEMATEDATA, db_file)
72
+ db_file = os.path.join(BIBLEMATEVECTORSTORE, db_file)
73
73
  if os.path.isfile(db_file):
74
74
  with apsw.Connection(db_file) as connection:
75
75
  cursor = connection.cursor()
@@ -97,7 +97,7 @@ def add_vector_collections(db_file="collection.db", table="PROMISES", h2=False):
97
97
  #cursor.execute(f"VACUUM;")
98
98
 
99
99
  def add_vector_encyclopedias():
100
- db_file = os.path.join(BIBLEMATEDATA, "encyclopedia.db")
100
+ db_file = os.path.join(BIBLEMATEVECTORSTORE, "encyclopedia.db")
101
101
  if os.path.isfile(db_file):
102
102
  with apsw.Connection(db_file) as connection:
103
103
  cursor = connection.cursor()
biblemate/api/bible.py CHANGED
@@ -4,7 +4,7 @@ import json, os, re
4
4
  from agentmake import OllamaAI, OLLAMA_FOUND, OLLAMA_NOT_FOUND_MESSAGE, AGENTMAKE_USER_DIR, agentmake, getDictionaryOutput
5
5
  from agentmake.utils.rag import get_embeddings, cosine_similarity_matrix
6
6
  from prompt_toolkit.shortcuts import ProgressBar
7
- from biblemate import config, BIBLEMATEDATA
7
+ from biblemate import config, BIBLEMATEVECTORSTORE
8
8
  from biblemate.api.api import run_bm_api
9
9
  from agentmake.plugins.uba.lib.BibleBooks import BibleBooks
10
10
  from agentmake.backends.ollama import OllamaAI
@@ -43,7 +43,7 @@ def search_bible(request:str, book:int=0, module=config.default_bible, search_re
43
43
  exact_matches_content = run_bm_api(f"literal:::{abbr[str(book)][0]},{module}:::{search_string}" if book else f"literal:::{module}:::{search_string}")
44
44
 
45
45
  # semantic matches
46
- bible_file = os.path.join(BIBLEMATEDATA, "bible.db")
46
+ bible_file = os.path.join(BIBLEMATEVECTORSTORE, "bible.db")
47
47
  if not OLLAMA_FOUND:
48
48
  semantic_matches = []
49
49
  semantic_matches_content = f"[{OLLAMA_NOT_FOUND_MESSAGE}]"
@@ -86,7 +86,7 @@ class BibleVectorDatabase:
86
86
 
87
87
  def __init__(self, uba_bible_path: str=None):
88
88
  if not uba_bible_path:
89
- uba_bible_path = os.path.join(BIBLEMATEDATA, "bible.db")
89
+ uba_bible_path = os.path.join(BIBLEMATEVECTORSTORE, "bible.db")
90
90
  # check if file exists
91
91
  if os.path.isfile(uba_bible_path):
92
92
  # Download embedding model
@@ -5,7 +5,7 @@ from fastmcp import FastMCP
5
5
  from fastmcp.prompts.prompt import PromptMessage, TextContent
6
6
  from agentmake import agentmake, DEVELOPER_MODE
7
7
  from agentmake.plugins.uba.lib.BibleParser import BibleVerseParser
8
- from biblemate import BIBLEMATE_VERSION, BIBLEMATEDATA, AGENTMAKE_CONFIG, config
8
+ from biblemate import BIBLEMATE_VERSION, BIBLEMATEVECTORSTORE, AGENTMAKE_CONFIG, config
9
9
  from biblemate.api.bible import search_bible
10
10
  from biblemate.api.api import run_bm_api
11
11
  from biblemate.api.search import UBASearches
@@ -134,7 +134,7 @@ def dictionaries() -> dict:
134
134
  resources = json.loads(run_bm_api(".resources"))
135
135
  return dict(zip(resources["dictionaryListAbb"], resources["dictionaryList"]))
136
136
 
137
- dictionary_db = os.path.join(BIBLEMATEDATA, "dictionary.db")
137
+ dictionary_db = os.path.join(BIBLEMATEVECTORSTORE, "dictionary.db")
138
138
  if os.path.isfile(dictionary_db):
139
139
  @mcp.resource("dictionary://{query}")
140
140
  def dictionary(query:str) -> Union[str, list]:
@@ -155,7 +155,7 @@ def encyclopedias() -> dict:
155
155
  resources = json.loads(run_bm_api(".resources"))
156
156
  return dict(zip(resources["encyclopediaListAbb"], resources["encyclopediaList"]))
157
157
 
158
- encyclopedia_db = os.path.join(BIBLEMATEDATA, "encyclopedia.db")
158
+ encyclopedia_db = os.path.join(BIBLEMATEVECTORSTORE, "encyclopedia.db")
159
159
  if os.path.isfile(encyclopedia_db):
160
160
  @mcp.resource("encyclopedia://{module}/{query}")
161
161
  def encyclopedia(module: str, query:str) -> Union[str, list]:
@@ -203,7 +203,7 @@ def topics() -> dict:
203
203
  resources = json.loads(run_bm_api(".resources"))
204
204
  return dict(zip(resources["topicListAbb"], resources["topicList"]))
205
205
 
206
- collection_db = os.path.join(BIBLEMATEDATA, "collection.db")
206
+ collection_db = os.path.join(BIBLEMATEVECTORSTORE, "collection.db")
207
207
  if os.path.isfile(collection_db):
208
208
  @mcp.resource("parallel://{module}/{query}")
209
209
  def parallel(module:str, query:str) -> Union[str, list]:
@@ -228,7 +228,7 @@ if os.path.isfile(collection_db):
228
228
  bible=module,
229
229
  )
230
230
 
231
- topic_db = os.path.join(BIBLEMATEDATA, "exlb.db")
231
+ topic_db = os.path.join(BIBLEMATEVECTORSTORE, "exlb.db")
232
232
  if os.path.isfile(topic_db):
233
233
  @mcp.resource("topic://{query}")
234
234
  def topic(query:str) -> Union[str, list]:
biblemate/main.py CHANGED
@@ -2,7 +2,7 @@ from biblemate.core.systems import *
2
2
  from biblemate.api.dialogs import *
3
3
  from biblemate.ui.text_area import getTextArea
4
4
  from biblemate.ui.info import get_banner
5
- from biblemate import config, CONFIG_FILE_BACKUP, DIALOGS, BIBLEMATE_VERSION, AGENTMAKE_CONFIG, BIBLEMATE_USER_DIR, BIBLEMATEDATA, fix_string, write_user_config, list_dir_content
5
+ from biblemate import config, CONFIG_FILE_BACKUP, DIALOGS, BIBLEMATE_VERSION, AGENTMAKE_CONFIG, BIBLEMATE_USER_DIR, BIBLEMATEVECTORSTORE, fix_string, write_user_config, list_dir_content
6
6
  from biblemate.api.api import DEFAULT_MODULES, run_bm_api
7
7
  from pathlib import Path
8
8
  import urllib.parse
@@ -270,14 +270,14 @@ async def download_data(console, default=""):
270
270
  default=default,
271
271
  )
272
272
  if file_id:
273
- output = os.path.join(BIBLEMATEDATA, file_id+".zip")
273
+ output = os.path.join(BIBLEMATEVECTORSTORE, file_id+".zip")
274
274
  if os.path.isfile(output):
275
275
  os.remove(output)
276
276
  if os.path.isfile(output[:-4]):
277
277
  os.remove(output[:-4])
278
278
  gdown.download(id=file_ids[file_id], output=output)
279
279
  with zipfile.ZipFile(output, 'r') as zip_ref:
280
- zip_ref.extractall(BIBLEMATEDATA)
280
+ zip_ref.extractall(BIBLEMATEVECTORSTORE)
281
281
  if os.path.isfile(output):
282
282
  os.remove(output)
283
283
  info = "Restart to make the changes effective!"
biblemate/version.txt CHANGED
@@ -1 +1 @@
1
- 0.2.56
1
+ 0.2.57
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biblemate
3
- Version: 0.2.56
3
+ Version: 0.2.57
4
4
  Summary: BibleMate AI - Automate Your Bible Study
5
5
  Home-page: https://biblemate.ai
6
6
  Author: Eliran Wong
@@ -1,15 +1,15 @@
1
1
  biblemate/README.md,sha256=ngPTXscxJgA2Q6dArGQEi_q4C74QxugitH3ryM_r70o,1247
2
- biblemate/__init__.py,sha256=kceUofhQVUX0Ax7VFKWbM8gb-Bvzzx76vx1F6kMynHw,10115
3
- biblemate/bible_study_mcp.py,sha256=-TsFKysiJi9CRBrPdCmbyRcxobO_urB2smEfZa8xX4A,62157
2
+ biblemate/__init__.py,sha256=f36wWxawWA6ViT10JKrxv7BRkJK5u7p-5Y7TRoWNers,10321
3
+ biblemate/bible_study_mcp.py,sha256=_pa6Txn4nifSL6NbP1pVD6GSegqqwiPZjXHV5PM1Y5s,62192
4
4
  biblemate/biblematemcp.py,sha256=8GSAbzZw54L2jwj4wwCXlChBkHROUQETM2TJ2j8Ffeg,1506
5
5
  biblemate/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- biblemate/main.py,sha256=V1a6CDoMY4rlcDBFBRySploCoxIa4I4iqazOFq4Jkmc,92800
6
+ biblemate/main.py,sha256=rpmGGaYUNv_HVJfUz0QIdS-S_8lnmehjeW7df1B-YW4,92821
7
7
  biblemate/package_name.txt,sha256=WkkuEEkgw7EKpXV8GshpzhZlwRor1wpotTS7vP24b_g,9
8
8
  biblemate/requirements.txt,sha256=yMNiISM_lIW1c8Q-ReitShZzTzlvelLVz8rhX5y2H4k,82
9
- biblemate/version.txt,sha256=eKO9TNWSCvArJWdj_PMFe4MzvVfc0T3balrgTAiH0q4,6
10
- biblemate/api/add_vector.py,sha256=yb6gRP8focZvAJzhR8gtQToxgVAS3BKeMJZH8HTPCZk,6815
9
+ biblemate/version.txt,sha256=eVb1HRbF4qJhqgxgWtH9X10eq7JvX8-iMCXJcxprnRI,6
10
+ biblemate/api/add_vector.py,sha256=YbwTaM5i-8MCqu8aYiwI5kZmJ1bRnm-5RicwkonaDv8,6857
11
11
  biblemate/api/api.py,sha256=gBlmMzcGXWKviEve0IBTRNJbE2l8dqUD-RGdwaev4Bw,4291
12
- biblemate/api/bible.py,sha256=ErKWAH28NByuXSd1_ekVyuPvuQwpEye6TU8AsR3azP0,7678
12
+ biblemate/api/bible.py,sha256=6FnNrpWPHPzW9WovSAm75DzOouBplCmEOYhaQsq9Wfg,7699
13
13
  biblemate/api/dialogs.py,sha256=2QKyj39yn3VQ1NtKPZiidKP4KwI8UKsrQD2T4x4JupI,12373
14
14
  biblemate/api/search.py,sha256=NFnxo_75S2NGvducC5FBHMAtjCdlLGpXUa2FLRr7VT4,3390
15
15
  biblemate/core/systems.py,sha256=izdjdDESpQRlembE6N37pXc-yFTKUG5G-vUVKa6Ki1w,4231
@@ -20,8 +20,8 @@ biblemate/ui/info.py,sha256=rg2UvsyQTR7DbOWtO246JT2Yn92A_3RM85go4XXPhI8,2545
20
20
  biblemate/ui/prompts.py,sha256=IDoKM-JFXM7Vm3VYVRFR5Ybo9xaSbcwCFiEkj3l6-gY,3633
21
21
  biblemate/ui/selection_dialog.py,sha256=aIUhFWm56uYnd8-fyebADv7qwwtEeuMBkfjqlcPYRWc,4659
22
22
  biblemate/ui/text_area.py,sha256=7Qx1wHbJ792MEq2N29uMSjDf_eTgh_G6hqypGus957w,18507
23
- biblemate-0.2.56.dist-info/METADATA,sha256=Cbg4wJPEWAAKNS3pSqgnrXMYlscBHr67hy2EEyej7EY,2690
24
- biblemate-0.2.56.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
- biblemate-0.2.56.dist-info/entry_points.txt,sha256=8Y88G_Vy1PgsSXRhq_SUzP8PUl5Qv54hFlpMkmvwrOA,117
26
- biblemate-0.2.56.dist-info/top_level.txt,sha256=pq9uX0tAS0bizZcZ5GW5zIoDLQBa-b5QDlDGsdHNgiU,10
27
- biblemate-0.2.56.dist-info/RECORD,,
23
+ biblemate-0.2.57.dist-info/METADATA,sha256=96QibzFewDX4czkIApPByRZzztDp5mR8uUBGpfWf7Zc,2690
24
+ biblemate-0.2.57.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
25
+ biblemate-0.2.57.dist-info/entry_points.txt,sha256=8Y88G_Vy1PgsSXRhq_SUzP8PUl5Qv54hFlpMkmvwrOA,117
26
+ biblemate-0.2.57.dist-info/top_level.txt,sha256=pq9uX0tAS0bizZcZ5GW5zIoDLQBa-b5QDlDGsdHNgiU,10
27
+ biblemate-0.2.57.dist-info/RECORD,,