lumis-ai 0.1.0a1__py3-none-any.whl → 0.1.1a1__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.
@@ -1,5 +1,8 @@
1
1
  from __future__ import annotations
2
2
 
3
- from .models.chat_memory import ChatMemory
3
+ try:
4
+ from .models.chat_memory import ChatMemory
4
5
 
5
- __all__ = ["ChatMemory"]
6
+ __all__ = ["ChatMemory"]
7
+ except ImportError:
8
+ __all__ = []
@@ -1,9 +1,6 @@
1
- from typing import Optional, Set, Tuple
1
+ from __future__ import annotations
2
2
 
3
- import spacy
4
- from spacy.language import Language
5
- from spacy.matcher import Matcher
6
- from spacy.tokens import Doc, Span, Token
3
+ from typing import Optional, Set, Tuple
7
4
 
8
5
 
9
6
  # TODO: Convert this to a spacy factory
@@ -13,9 +10,19 @@ class FactExtractor:
13
10
  Initialize the FactExtractor with a spaCy NLP pipeline.
14
11
  :param model: The name of the spaCy model to load.
15
12
  """
13
+ try:
14
+ import spacy
15
+ from spacy.matcher import Matcher
16
+ from spacy.tokens import Doc
17
+ except ImportError:
18
+ raise ImportError(
19
+ "spacy is required for FactExtractor. "
20
+ "Install it with: pip install lumis-ai[spacy]"
21
+ )
22
+
16
23
  # spaCy handles caching and singleton behavior automatically
17
- self.nlp: Language = spacy.load(model)
18
- self.matcher: Matcher = Matcher(self.nlp.vocab)
24
+ self.nlp = spacy.load(model)
25
+ self.matcher = Matcher(self.nlp.vocab)
19
26
  self._init_patterns()
20
27
 
21
28
  # Register custom extension if not already registered
lumis/nlp/ner/ner.py CHANGED
@@ -1,13 +1,23 @@
1
+ from __future__ import annotations
2
+
1
3
  from pathlib import Path
4
+ from typing import TYPE_CHECKING
2
5
 
3
- from spacy.tokens import Doc
4
- from spacy_llm.util import assemble
6
+ if TYPE_CHECKING:
7
+ from spacy.tokens import Doc
5
8
 
6
9
  relative_path = Path(__file__).parent / "config" / "entity_rel_extraction.cfg"
7
10
 
8
11
 
9
12
  class Ner:
10
13
  def __init__(self, config: str = str(relative_path)):
14
+ try:
15
+ from spacy_llm.util import assemble
16
+ except ImportError:
17
+ raise ImportError(
18
+ "spacy and spacy-llm are required for Ner. "
19
+ "Install them with: pip install lumis-ai[spacy]"
20
+ )
11
21
  self.nlp = assemble(config)
12
22
 
13
23
  def get_entities(self, text: str) -> list[tuple[str, str]]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lumis-ai
3
- Version: 0.1.0a1
3
+ Version: 0.1.1a1
4
4
  Summary: An AI agent framework for building LLM-powered applications
5
5
  Project-URL: Homepage, https://github.com/tareksanger/lumis
6
6
  Project-URL: Repository, https://github.com/tareksanger/lumis
@@ -23,12 +23,7 @@ Requires-Python: >=3.11
23
23
  Requires-Dist: arxiv>=0.5.0
24
24
  Requires-Dist: asgiref>=3.8.1
25
25
  Requires-Dist: beautifulsoup4>=4.12.0
26
- Requires-Dist: coreferee-model-en>=1.0.0
27
- Requires-Dist: coreferee>=1.3.0
28
26
  Requires-Dist: deepmerge>=2.0.0
29
- Requires-Dist: django>=4.2
30
- Requires-Dist: en-core-web-lg<3.8.0,>=3.7.0
31
- Requires-Dist: en-core-web-trf<3.8.0,>=3.7.0
32
27
  Requires-Dist: faiss-cpu>=1.7.0
33
28
  Requires-Dist: googlesearch-python>=1.2.0
34
29
  Requires-Dist: httpx>=0.27.0
@@ -54,8 +49,6 @@ Requires-Dist: redis>=5.0.0
54
49
  Requires-Dist: requests>=2.28.0
55
50
  Requires-Dist: scikit-learn>=1.0.0
56
51
  Requires-Dist: sentence-transformers>=2.2.2
57
- Requires-Dist: spacy-llm>=0.7.2
58
- Requires-Dist: spacy<3.8.0,>=3.7.0
59
52
  Requires-Dist: tavily-python>=0.3.0
60
53
  Requires-Dist: tenacity>=9.0.0
61
54
  Requires-Dist: textstat>=0.7.0
@@ -65,6 +58,15 @@ Requires-Dist: transformers>=4.0.0
65
58
  Requires-Dist: typing-extensions>=4.0.0
66
59
  Requires-Dist: wikipedia>=1.4.0
67
60
  Requires-Dist: yfinance>=0.2.0
61
+ Provides-Extra: django
62
+ Requires-Dist: django>=4.2; extra == 'django'
63
+ Provides-Extra: spacy
64
+ Requires-Dist: coreferee-model-en>=1.0.0; extra == 'spacy'
65
+ Requires-Dist: coreferee>=1.3.0; extra == 'spacy'
66
+ Requires-Dist: en-core-web-lg<3.8.0,>=3.7.0; extra == 'spacy'
67
+ Requires-Dist: en-core-web-trf<3.8.0,>=3.7.0; extra == 'spacy'
68
+ Requires-Dist: spacy-llm>=0.7.2; extra == 'spacy'
69
+ Requires-Dist: spacy<3.8.0,>=3.7.0; extra == 'spacy'
68
70
  Description-Content-Type: text/markdown
69
71
 
70
72
  # lumis
@@ -88,7 +90,16 @@ An AI agent framework for building LLM-powered applications with multi-provider
88
90
  pip install lumis-ai
89
91
  ```
90
92
 
91
- After installing, download the required spaCy language models:
93
+ ### Optional extras
94
+
95
+ Some integrations are opt-in to keep the base install lighter:
96
+
97
+ | Extra | What it adds | Install |
98
+ |------------|-----------------------------------------------|-----------------------------------|
99
+ | `spacy` | NER, fact extraction, coreference resolution | `pip install lumis-ai[spacy]` |
100
+ | `django` | Django ORM memory backend | `pip install lumis-ai[django]` |
101
+
102
+ The `spacy` extra requires language models. After installing, download them:
92
103
 
93
104
  ```bash
94
105
  python -m spacy download en_core_web_lg
@@ -24,7 +24,7 @@ lumis/core/document.py,sha256=bat9TjbHigFf5TLVy9r0Ft67zjIMPJMwmQrsE4gP-IA,1080
24
24
  lumis/core/event_emitter.py,sha256=2LwAo0gLIIKMqKocjrZ3g86BRjrtnplTQth0S8iDw_U,2094
25
25
  lumis/core/common/coloured_logger.py,sha256=Pc_WcpPXfMIGHagrnJQ2MjY6x8MI1U5ZbTt5xtb8mgg,943
26
26
  lumis/core/common/logger_mixin.py,sha256=TmswwCfgEi8BeatoWsa3gMk3qhCEMEmZyLK4rkZWLUU,1013
27
- lumis/core/django/__init__.py,sha256=1eLq5GHCa7iCrlb3eg85Ifx9TtnnsYgMeZ6rakyzkWY,105
27
+ lumis/core/django/__init__.py,sha256=yOr6iSaA7VSlIpSwryrwtL5zIHuv5HcY-9Fa9czoyRI,155
28
28
  lumis/core/django/models/chat_memory.py,sha256=j5E36hza2nbIKjVlv0j0WjttmRvOLjvTnoMFgNyUVVQ,6612
29
29
  lumis/core/utils/__init__.py,sha256=2hfqwepX9pCGlsPHZ3P1Zv_7jW0BCuW5r9P0aCu-xvU,246
30
30
  lumis/core/utils/coroutine.py,sha256=B_KQfwa6_wWI7a3hVPWv8GLAyuDPQywPgBYDd0iI4cI,665
@@ -65,8 +65,8 @@ lumis/nlp/semantic_parser.py,sha256=ydJjGy5h-gzaG0AJkBZOwj8JagoPxefm8RZx9D9FnsM,
65
65
  lumis/nlp/spacy_summarizer.py,sha256=6_ZMOYJ0gs7bcsef-x6GEhzsssitlpf4Ovw58SfEllw,2762
66
66
  lumis/nlp/summarizer.py,sha256=R-oTjtS86TnySTXjVhNf_NaTNJNbrfX8p964V5YfEIA,6920
67
67
  lumis/nlp/vector_similarity_retriever.py,sha256=mR2FjISAkAgS5bzSBwZIdnSr3q9s_r0GhCgrt5PlMAA,1714
68
- lumis/nlp/information_extraction/FactExtractor.py,sha256=3gA2LbAO9xOdcguoZQVssQYfDCOT6O9glWqBCUWxu_o,9355
69
- lumis/nlp/ner/ner.py,sha256=Dfxz2fuDedrd5kwLTHnpQQ5KnFOsmHEe1IfmvgQMYcI,504
68
+ lumis/nlp/information_extraction/FactExtractor.py,sha256=Chu-fMoyBJe0axM-aH6T_LWcWCVyh_lzZOSRzePszJY,9564
69
+ lumis/nlp/ner/ner.py,sha256=CVTft8EKgl3kvy9gzM0I2ANnLNmAGnYz0SdXXdf34II,819
70
70
  lumis/nlp/ner/config/entity_rel_extraction.cfg,sha256=rQKm-Agl_qse0EwI9XgLy0kjU4hdLe4B15bvspny5qY,923
71
71
  lumis/nlp/ner/config/fill-config.cfg,sha256=iMhF-QfZs15UtDHTBC3OPAhfaqyHMpnvqRAcWVAMU6U,4130
72
72
  lumis/reader/__init__.py,sha256=707frfd3cLTb7LTjhsWyFhb-u21YqaifWcyiCpVgYvg,52
@@ -84,7 +84,7 @@ lumis/tools/search/search_engine_client.py,sha256=5Q0nb7Lztj0mjaN3EwZQfpRMNUbxcH
84
84
  lumis/tools/search/vector_search_retrieval_engine.py,sha256=RGZyFah2F-ojFzH9xiApILK5oQWWZEuihV2EN3Ae0cc,7889
85
85
  lumis/tools/search/wiki.py,sha256=gGm6I273KOLvDN0E7boAezjPq6cywRhbZEBqB_Pem4U,7864
86
86
  lumis/tools/search/yahoofinance.py,sha256=xQTTMJU7IDfH2WkzIWPjWwwLao0unfMHGrbhVEJJSJg,7548
87
- lumis_ai-0.1.0a1.dist-info/METADATA,sha256=bVQmNhCCxjia24iGCDc-brqlxqfrp2Poy74ubstINpU,3783
88
- lumis_ai-0.1.0a1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
89
- lumis_ai-0.1.0a1.dist-info/licenses/LICENSE,sha256=cKZn_mblbydX1fOrVMvUIrelUE9AElKLAR_7-VYRDow,1068
90
- lumis_ai-0.1.0a1.dist-info/RECORD,,
87
+ lumis_ai-0.1.1a1.dist-info/METADATA,sha256=91heIxT2Jsuyf9cVXQtZG6hSugavVlX0FMOk6oAjjL8,4451
88
+ lumis_ai-0.1.1a1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
89
+ lumis_ai-0.1.1a1.dist-info/licenses/LICENSE,sha256=cKZn_mblbydX1fOrVMvUIrelUE9AElKLAR_7-VYRDow,1068
90
+ lumis_ai-0.1.1a1.dist-info/RECORD,,