biblemate 0.2.55__tar.gz → 0.2.57__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 (32) hide show
  1. {biblemate-0.2.55 → biblemate-0.2.57}/PKG-INFO +1 -1
  2. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/__init__.py +6 -3
  3. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/api/add_vector.py +6 -6
  4. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/api/bible.py +3 -3
  5. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/bible_study_mcp.py +25 -14
  6. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/main.py +3 -3
  7. biblemate-0.2.57/biblemate/version.txt +1 -0
  8. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/PKG-INFO +1 -1
  9. {biblemate-0.2.55 → biblemate-0.2.57}/setup.py +1 -1
  10. biblemate-0.2.55/biblemate/version.txt +0 -1
  11. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/README.md +0 -0
  12. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/api/api.py +0 -0
  13. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/api/dialogs.py +0 -0
  14. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/api/search.py +0 -0
  15. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/biblematemcp.py +0 -0
  16. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/config.py +0 -0
  17. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/core/systems.py +0 -0
  18. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/etextedit/README.md +0 -0
  19. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/etextedit/plugins/Extract Bible References.py +0 -0
  20. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/etextedit/plugins/Insert Bible Text.py +0 -0
  21. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/package_name.txt +0 -0
  22. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/requirements.txt +0 -0
  23. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/ui/info.py +0 -0
  24. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/ui/prompts.py +0 -0
  25. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/ui/selection_dialog.py +0 -0
  26. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate/ui/text_area.py +0 -0
  27. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/SOURCES.txt +0 -0
  28. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/dependency_links.txt +0 -0
  29. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/entry_points.txt +0 -0
  30. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/requires.txt +0 -0
  31. {biblemate-0.2.55 → biblemate-0.2.57}/biblemate.egg-info/top_level.txt +0 -0
  32. {biblemate-0.2.55 → biblemate-0.2.57}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biblemate
3
- Version: 0.2.55
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
@@ -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()
@@ -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
@@ -43,6 +43,9 @@ mcp = FastMCP(name="BibleMate AI", auth=verifier)
43
43
  def getResponse(messages:list) -> str:
44
44
  return messages[-1].get("content") if messages and "content" in messages[-1] else "Error!"
45
45
 
46
+ def chapter2verses(request:str) -> str:
47
+ return re.sub("[Cc][Hh][Aa][Pp][Tt][Ee][Rr] ([0-9]+?)([^0-9])", r"\1:1-180\2", request)
48
+
46
49
  # Note: Declare global variables used in MCP resources, tools or prompts, so that they work when MCP is run in http transport mode
47
50
 
48
51
  @mcp.resource("resource://info")
@@ -131,7 +134,7 @@ def dictionaries() -> dict:
131
134
  resources = json.loads(run_bm_api(".resources"))
132
135
  return dict(zip(resources["dictionaryListAbb"], resources["dictionaryList"]))
133
136
 
134
- dictionary_db = os.path.join(BIBLEMATEDATA, "dictionary.db")
137
+ dictionary_db = os.path.join(BIBLEMATEVECTORSTORE, "dictionary.db")
135
138
  if os.path.isfile(dictionary_db):
136
139
  @mcp.resource("dictionary://{query}")
137
140
  def dictionary(query:str) -> Union[str, list]:
@@ -152,7 +155,7 @@ def encyclopedias() -> dict:
152
155
  resources = json.loads(run_bm_api(".resources"))
153
156
  return dict(zip(resources["encyclopediaListAbb"], resources["encyclopediaList"]))
154
157
 
155
- encyclopedia_db = os.path.join(BIBLEMATEDATA, "encyclopedia.db")
158
+ encyclopedia_db = os.path.join(BIBLEMATEVECTORSTORE, "encyclopedia.db")
156
159
  if os.path.isfile(encyclopedia_db):
157
160
  @mcp.resource("encyclopedia://{module}/{query}")
158
161
  def encyclopedia(module: str, query:str) -> Union[str, list]:
@@ -200,7 +203,7 @@ def topics() -> dict:
200
203
  resources = json.loads(run_bm_api(".resources"))
201
204
  return dict(zip(resources["topicListAbb"], resources["topicList"]))
202
205
 
203
- collection_db = os.path.join(BIBLEMATEDATA, "collection.db")
206
+ collection_db = os.path.join(BIBLEMATEVECTORSTORE, "collection.db")
204
207
  if os.path.isfile(collection_db):
205
208
  @mcp.resource("parallel://{module}/{query}")
206
209
  def parallel(module:str, query:str) -> Union[str, list]:
@@ -225,7 +228,7 @@ if os.path.isfile(collection_db):
225
228
  bible=module,
226
229
  )
227
230
 
228
- topic_db = os.path.join(BIBLEMATEDATA, "exlb.db")
231
+ topic_db = os.path.join(BIBLEMATEVECTORSTORE, "exlb.db")
229
232
  if os.path.isfile(topic_db):
230
233
  @mcp.resource("topic://{query}")
231
234
  def topic(query:str) -> Union[str, list]:
@@ -1075,49 +1078,57 @@ def search_revelation_only(request:str) -> str:
1075
1078
  @mcp.tool
1076
1079
  def compare_bible_translations(request:str) -> str:
1077
1080
  """compare Bible translations; bible verse reference(s) must be given"""
1078
- global run_bm_api
1081
+ global run_bm_api, chapter2verses
1082
+ request = chapter2verses(request)
1079
1083
  return run_bm_api(f"verses:::KJV,LEB,NET,OHGB,OHGBi:::{request}")
1080
1084
 
1081
1085
  @mcp.tool
1082
1086
  def retrieve_bible_cross_references(request:str) -> str:
1083
1087
  """retrieve cross-references of Bible verses; bible verse reference(s) must be given"""
1084
- global run_bm_api
1088
+ global run_bm_api, chapter2verses
1089
+ request = chapter2verses(request)
1085
1090
  return run_bm_api(f"xrefs:::{request}")
1086
1091
 
1087
1092
  @mcp.tool
1088
1093
  def retrieve_hebrew_or_greek_bible_verses(request:str) -> str:
1089
1094
  """retrieve Hebrew or Greek Bible verses; bible verse reference(s) must be given, e.g. John 3:16-17; single or multiple references accepted, e.g. Deut 6:4; Gen 1:26-27"""
1090
- global run_bm_api
1095
+ global run_bm_api, chapter2verses
1096
+ request = chapter2verses(request)
1091
1097
  return run_bm_api(f"verses:::OHGB:::{request}")
1092
1098
 
1093
1099
  @mcp.tool
1094
1100
  def retrieve_interlinear_hebrew_or_greek_bible_verses(request:str) -> str:
1095
1101
  """retrieve interlinear Hebrew-English or Greek-English Bible verses; bible verse reference(s) must be given, e.g. John 3:16-17; single or multiple references accepted, e.g. Deut 6:4; Gen 1:26-27"""
1096
- global run_bm_api
1102
+ global run_bm_api, chapter2verses
1103
+ request = chapter2verses(request)
1097
1104
  return run_bm_api(f"verses:::OHGBi:::{request}")
1098
1105
 
1099
1106
  @mcp.tool
1100
1107
  def retrieve_bible_verses(request:str) -> str:
1101
1108
  """retrieve Bible verses; bible verse reference(s) must be given, e.g. John 3:16-17; single or multiple references accepted, e.g. Deut 6:4; Gen 1:26-27"""
1102
- global run_bm_api
1109
+ global run_bm_api, chapter2verses
1110
+ request = chapter2verses(request)
1103
1111
  return run_bm_api(f"verses:::{config.default_bible}:::{request}")
1104
1112
 
1105
1113
  @mcp.tool
1106
1114
  def retrieve_verse_morphology(request:str) -> str:
1107
1115
  """retrieve parsing and morphology of individual bible verses; bible verse reference(s) must be given, e.g. John 3:16-17; single or multiple references accepted, e.g. Deut 6:4; Gen 1:26-27"""
1108
- global run_bm_api
1116
+ global run_bm_api, chapter2verses
1117
+ request = chapter2verses(request)
1109
1118
  return run_bm_api(f"morphology:::{request}")
1110
1119
 
1111
1120
  @mcp.tool
1112
1121
  def retrieve_bible_chapter(request:str) -> str:
1113
1122
  """retrieve a whole Bible chapter; bible chapter reference must be given, e.g. John 3"""
1114
- global run_bm_api
1123
+ global run_bm_api, chapter2verses
1124
+ request = chapter2verses(request)
1115
1125
  return run_bm_api(f"chapter:::{request}")
1116
1126
 
1117
1127
  @mcp.tool
1118
1128
  def read_bible_commentary(request:str) -> str:
1119
1129
  """read bible commentary on individual bible verses; bible verse reference(s) must be given, like , like John 3:16 or John 3:16-18"""
1120
- global run_bm_api
1130
+ global run_bm_api, chapter2verses
1131
+ request = chapter2verses(request)
1121
1132
  return run_bm_api(f"commentary:::{request}")
1122
1133
 
1123
1134
  @mcp.tool
@@ -1398,7 +1409,7 @@ def simple_bible_study(request:str) -> PromptMessage:
1398
1409
  """Perform a simple bible study task"""
1399
1410
  global PromptMessage, TextContent
1400
1411
  prompt_text = f"""You are a bible study agent. You check the user request, under the `User Request` section, and resolve it with the following steps in order:
1401
- 1. Call tool 'retrieve_english_bible_verses' for Bible text,
1412
+ 1. Call tool 'retrieve_english_bible_verses' or `retrieve_bible_chapter` for Bible text,
1402
1413
  2. Call tool 'retrieve_bible_cross_references' for Bible cross-references,
1403
1414
  3. Call tool 'study_old_testament_themes' for studying old testament themes or 'study_new_testament_themes' for studying new testament themes, and
1404
1415
  4. Call tool 'write_bible_theology' to explain its theology.
@@ -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!"
@@ -0,0 +1 @@
1
+ 0.2.57
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biblemate
3
- Version: 0.2.55
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
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
  from setuptools.command.install import install
3
3
  import os, shutil, platform, sys
4
4
 
5
- version = "0.2.55"
5
+ version = "0.2.57"
6
6
  with open(os.path.join("biblemate", "version.txt"), "w", encoding="utf-8") as fileObj:
7
7
  fileObj.write(version)
8
8
 
@@ -1 +0,0 @@
1
- 0.2.55
File without changes