langroid 0.1.198__tar.gz → 0.1.200__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.
- {langroid-0.1.198 → langroid-0.1.200}/PKG-INFO +13 -10
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/doc_chat_agent.py +12 -2
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/hf_formatter.py +13 -8
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/__init__.py +16 -5
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/chromadb.py +11 -2
- {langroid-0.1.198 → langroid-0.1.200}/pyproject.toml +15 -11
- {langroid-0.1.198 → langroid-0.1.200}/LICENSE +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/README.md +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/batch.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/callbacks/chainlit.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/chat_document.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/helpers.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/junk +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/lance_tools.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/neo4j/utils/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/neo4j/utils/system_message.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/task.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tool_message.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/extract_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/generator_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/run_python_code.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/sciphi_search_rag_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/agent_config.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/cachedb/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/embedding_models/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/embedding_models/clustering.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/embedding_models/models.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/config.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/openai_assistants.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/openai_gpt.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/utils.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/mytypes.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/code-parsing.md +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/config.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/json.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/parser.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/search.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/spider.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/url_loader_cookies.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/urls.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/utils.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/parsing/web_search.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/chat-gpt4-system-prompt.md +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/dialog.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/templates.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/prompts/transforms.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/configuration.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/constants.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/docker.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/globals.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/llms/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/llms/strings.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/logging.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/output/printing.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/system.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/web/__init__.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/web/login.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/utils/web/selenium_login.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/base.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/lancedb.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/meilisearch.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/momento.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/qdrant_cloud.py +0 -0
- {langroid-0.1.198 → langroid-0.1.200}/langroid/vector_store/qdrantdb.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.200
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
License: MIT
|
6
6
|
Author: Prasad Chalasani
|
@@ -11,9 +11,11 @@ Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
13
|
Provides-Extra: chainlit
|
14
|
+
Provides-Extra: chromadb
|
14
15
|
Provides-Extra: hf-embeddings
|
15
16
|
Provides-Extra: litellm
|
16
17
|
Provides-Extra: metaphor
|
18
|
+
Provides-Extra: mkdocs
|
17
19
|
Provides-Extra: mysql
|
18
20
|
Provides-Extra: neo4j
|
19
21
|
Provides-Extra: postgres
|
@@ -27,7 +29,7 @@ Requires-Dist: autopep8 (>=2.0.2,<3.0.0)
|
|
27
29
|
Requires-Dist: black[jupyter] (>=23.3.0,<24.0.0)
|
28
30
|
Requires-Dist: bs4 (>=0.0.1,<0.0.2)
|
29
31
|
Requires-Dist: chainlit (>=1.0.301,<2.0.0) ; extra == "chainlit"
|
30
|
-
Requires-Dist: chromadb (>=0.4.21,<=0.4.23)
|
32
|
+
Requires-Dist: chromadb (>=0.4.21,<=0.4.23) ; extra == "chromadb"
|
31
33
|
Requires-Dist: colorlog (>=6.7.0,<7.0.0)
|
32
34
|
Requires-Dist: docstring-parser (>=0.15,<0.16)
|
33
35
|
Requires-Dist: duckduckgo-search (>=4.4,<5.0)
|
@@ -37,6 +39,7 @@ Requires-Dist: fire (>=0.5.0,<0.6.0)
|
|
37
39
|
Requires-Dist: flake8 (>=6.0.0,<7.0.0)
|
38
40
|
Requires-Dist: google-api-python-client (>=2.95.0,<3.0.0)
|
39
41
|
Requires-Dist: halo (>=0.0.31,<0.0.32)
|
42
|
+
Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "transformers"
|
40
43
|
Requires-Dist: jinja2 (>=3.1.2,<4.0.0)
|
41
44
|
Requires-Dist: lancedb (>=0.4.1,<0.5.0)
|
42
45
|
Requires-Dist: litellm (>=1.23.0,<2.0.0) ; extra == "litellm"
|
@@ -44,15 +47,15 @@ Requires-Dist: lxml (>=4.9.3,<5.0.0)
|
|
44
47
|
Requires-Dist: meilisearch (>=0.28.3,<0.29.0)
|
45
48
|
Requires-Dist: meilisearch-python-sdk (>=2.2.3,<3.0.0)
|
46
49
|
Requires-Dist: metaphor-python (>=0.1.23,<0.2.0) ; extra == "metaphor"
|
47
|
-
Requires-Dist: mkdocs (>=1.4.2,<2.0.0)
|
48
|
-
Requires-Dist: mkdocs-awesome-pages-plugin (>=2.8.0,<3.0.0)
|
49
|
-
Requires-Dist: mkdocs-gen-files (>=0.4.0,<0.5.0)
|
50
|
-
Requires-Dist: mkdocs-jupyter (>=0.24.1,<0.25.0)
|
51
|
-
Requires-Dist: mkdocs-literate-nav (>=0.6.0,<0.7.0)
|
52
|
-
Requires-Dist: mkdocs-material (>=9.1.5,<10.0.0)
|
50
|
+
Requires-Dist: mkdocs (>=1.4.2,<2.0.0) ; extra == "mkdocs"
|
51
|
+
Requires-Dist: mkdocs-awesome-pages-plugin (>=2.8.0,<3.0.0) ; extra == "mkdocs"
|
52
|
+
Requires-Dist: mkdocs-gen-files (>=0.4.0,<0.5.0) ; extra == "mkdocs"
|
53
|
+
Requires-Dist: mkdocs-jupyter (>=0.24.1,<0.25.0) ; extra == "mkdocs"
|
54
|
+
Requires-Dist: mkdocs-literate-nav (>=0.6.0,<0.7.0) ; extra == "mkdocs"
|
55
|
+
Requires-Dist: mkdocs-material (>=9.1.5,<10.0.0) ; extra == "mkdocs"
|
53
56
|
Requires-Dist: mkdocs-rss-plugin (>=1.8.0,<2.0.0)
|
54
|
-
Requires-Dist: mkdocs-section-index (>=0.3.5,<0.4.0)
|
55
|
-
Requires-Dist: mkdocstrings[python] (>=0.21.2,<0.22.0)
|
57
|
+
Requires-Dist: mkdocs-section-index (>=0.3.5,<0.4.0) ; extra == "mkdocs"
|
58
|
+
Requires-Dist: mkdocstrings[python] (>=0.21.2,<0.22.0) ; extra == "mkdocs"
|
56
59
|
Requires-Dist: momento (>=1.10.2,<2.0.0)
|
57
60
|
Requires-Dist: mypy (>=1.7.0,<2.0.0)
|
58
61
|
Requires-Dist: neo4j (>=5.14.1,<6.0.0) ; extra == "neo4j"
|
@@ -68,6 +68,14 @@ DEFAULT_DOC_CHAT_SYSTEM_MESSAGE = """
|
|
68
68
|
You are a helpful assistant, helping me understand a collection of documents.
|
69
69
|
"""
|
70
70
|
|
71
|
+
has_sentence_transformers = False
|
72
|
+
try:
|
73
|
+
from sentence_transformer import SentenceTransformer # noqa: F401
|
74
|
+
|
75
|
+
has_sentence_transformers = True
|
76
|
+
except ImportError:
|
77
|
+
pass
|
78
|
+
|
71
79
|
|
72
80
|
class DocChatAgentConfig(ChatAgentConfig):
|
73
81
|
system_message: str = DEFAULT_DOC_CHAT_SYSTEM_MESSAGE
|
@@ -98,7 +106,9 @@ class DocChatAgentConfig(ChatAgentConfig):
|
|
98
106
|
n_fuzzy_neighbor_words: int = 100 # num neighbor words to retrieve for fuzzy match
|
99
107
|
use_fuzzy_match: bool = True
|
100
108
|
use_bm25_search: bool = True
|
101
|
-
cross_encoder_reranking_model: str =
|
109
|
+
cross_encoder_reranking_model: str = (
|
110
|
+
"cross-encoder/ms-marco-MiniLM-L-6-v2" if has_sentence_transformers else ""
|
111
|
+
)
|
102
112
|
rerank_diversity: bool = True # rerank to maximize diversity?
|
103
113
|
rerank_periphery: bool = True # rerank to avoid Lost In the Middle effect?
|
104
114
|
embed_batch_size: int = 500 # get embedding of at most this many at a time
|
@@ -156,7 +166,7 @@ class DocChatAgentConfig(ChatAgentConfig):
|
|
156
166
|
collection_name="doc-chat-lancedb",
|
157
167
|
replace_collection=True,
|
158
168
|
storage_path=".lancedb/data/",
|
159
|
-
embedding=oai_embed_config,
|
169
|
+
embedding=hf_embed_config if has_sentence_transformers else oai_embed_config,
|
160
170
|
)
|
161
171
|
llm: OpenAIGPTConfig = OpenAIGPTConfig(
|
162
172
|
type="openai",
|
{langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
@@ -6,9 +6,8 @@ models will have the same tokenizer, so we just use the first one.
|
|
6
6
|
"""
|
7
7
|
import logging
|
8
8
|
import re
|
9
|
-
from typing import Any, List, Set, Type
|
9
|
+
from typing import Any, List, Set, Tuple, Type
|
10
10
|
|
11
|
-
from huggingface_hub import HfApi, ModelFilter
|
12
11
|
from jinja2.exceptions import TemplateError
|
13
12
|
|
14
13
|
from langroid.language_models.base import LanguageModel, LLMMessage, Role
|
@@ -18,7 +17,7 @@ from langroid.language_models.prompt_formatter.base import PromptFormatter
|
|
18
17
|
logger = logging.getLogger(__name__)
|
19
18
|
|
20
19
|
|
21
|
-
def
|
20
|
+
def try_import_hf_modules() -> Tuple[Type[Any], Type[Any], Type[Any]]:
|
22
21
|
"""
|
23
22
|
Attempts to import the AutoTokenizer class from the transformers package.
|
24
23
|
Returns:
|
@@ -27,14 +26,18 @@ def try_import_AutoTokenizer() -> Type[Any]:
|
|
27
26
|
ImportError: If the transformers package is not installed.
|
28
27
|
"""
|
29
28
|
try:
|
29
|
+
from huggingface_hub import HfApi, ModelFilter
|
30
30
|
from transformers import AutoTokenizer
|
31
31
|
|
32
|
-
return AutoTokenizer
|
32
|
+
return AutoTokenizer, HfApi, ModelFilter
|
33
33
|
except ImportError:
|
34
34
|
raise ImportError(
|
35
35
|
"""
|
36
|
-
You are trying to use
|
37
|
-
|
36
|
+
You are trying to use some/all of:
|
37
|
+
HuggingFace transformers.AutoTokenizer,
|
38
|
+
huggingface_hub.HfApi,
|
39
|
+
huggingface_hub.ModelFilter,
|
40
|
+
but these are not not installed
|
38
41
|
by default with Langroid. Please install langroid using the
|
39
42
|
`transformers` extra, like so:
|
40
43
|
pip install "langroid[transformers]"
|
@@ -44,6 +47,7 @@ def try_import_AutoTokenizer() -> Type[Any]:
|
|
44
47
|
|
45
48
|
|
46
49
|
def find_hf_formatter(model_name: str) -> str:
|
50
|
+
AutoTokenizer, HfApi, ModelFilter = try_import_hf_modules()
|
47
51
|
hf_api = HfApi()
|
48
52
|
# try to find a matching model, with progressivly shorter prefixes of model_name
|
49
53
|
model_name = model_name.lower().split("/")[-1]
|
@@ -61,7 +65,7 @@ def find_hf_formatter(model_name: str) -> str:
|
|
61
65
|
mdl = next(models)
|
62
66
|
except StopIteration:
|
63
67
|
continue
|
64
|
-
|
68
|
+
|
65
69
|
tokenizer = AutoTokenizer.from_pretrained(mdl.id)
|
66
70
|
if tokenizer.chat_template is not None:
|
67
71
|
return str(mdl.id)
|
@@ -73,6 +77,7 @@ class HFFormatter(PromptFormatter):
|
|
73
77
|
|
74
78
|
def __init__(self, config: HFPromptFormatterConfig):
|
75
79
|
super().__init__(config)
|
80
|
+
AutoTokenizer, HfApi, ModelFilter = try_import_hf_modules()
|
76
81
|
self.config: HFPromptFormatterConfig = config
|
77
82
|
hf_api = HfApi()
|
78
83
|
models = hf_api.list_models(
|
@@ -85,7 +90,7 @@ class HFFormatter(PromptFormatter):
|
|
85
90
|
mdl = next(models)
|
86
91
|
except StopIteration:
|
87
92
|
raise ValueError(f"Model {config.model_name} not found on HuggingFace Hub")
|
88
|
-
|
93
|
+
|
89
94
|
self.tokenizer = AutoTokenizer.from_pretrained(mdl.id)
|
90
95
|
if self.tokenizer.chat_template is None:
|
91
96
|
raise ValueError(
|
@@ -1,22 +1,30 @@
|
|
1
1
|
from . import base
|
2
|
-
|
2
|
+
|
3
3
|
from . import qdrantdb
|
4
4
|
from . import meilisearch
|
5
5
|
from . import lancedb
|
6
6
|
|
7
|
-
from .chromadb import ChromaDBConfig, ChromaDB
|
8
7
|
from .qdrantdb import QdrantDBConfig, QdrantDB
|
9
8
|
from .meilisearch import MeiliSearch, MeiliSearchConfig
|
10
9
|
from .lancedb import LanceDB, LanceDBConfig
|
11
10
|
|
11
|
+
has_chromadb = False
|
12
|
+
try:
|
13
|
+
from . import chromadb
|
14
|
+
from .chromadb import ChromaDBConfig, ChromaDB
|
15
|
+
|
16
|
+
chromadb # silence linters
|
17
|
+
ChromaDB
|
18
|
+
ChromaDBConfig
|
19
|
+
has_chromadb = True
|
20
|
+
except ImportError:
|
21
|
+
pass
|
22
|
+
|
12
23
|
__all__ = [
|
13
24
|
"base",
|
14
|
-
"chromadb",
|
15
25
|
"qdrantdb",
|
16
26
|
"meilisearch",
|
17
27
|
"lancedb",
|
18
|
-
"ChromaDBConfig",
|
19
|
-
"ChromaDB",
|
20
28
|
"QdrantDBConfig",
|
21
29
|
"QdrantDB",
|
22
30
|
"MeiliSearch",
|
@@ -24,3 +32,6 @@ __all__ = [
|
|
24
32
|
"LanceDB",
|
25
33
|
"LanceDBConfig",
|
26
34
|
]
|
35
|
+
|
36
|
+
if has_chromadb:
|
37
|
+
__all__.extend(["chromadb", "ChromaDBConfig", "ChromaDB"])
|
@@ -2,8 +2,6 @@ import json
|
|
2
2
|
import logging
|
3
3
|
from typing import Any, Dict, List, Optional, Sequence, Tuple
|
4
4
|
|
5
|
-
import chromadb
|
6
|
-
|
7
5
|
from langroid.embedding_models.base import (
|
8
6
|
EmbeddingModel,
|
9
7
|
EmbeddingModelsConfig,
|
@@ -28,6 +26,17 @@ class ChromaDBConfig(VectorStoreConfig):
|
|
28
26
|
class ChromaDB(VectorStore):
|
29
27
|
def __init__(self, config: ChromaDBConfig = ChromaDBConfig()):
|
30
28
|
super().__init__(config)
|
29
|
+
try:
|
30
|
+
import chromadb
|
31
|
+
except ImportError:
|
32
|
+
raise ImportError(
|
33
|
+
"""
|
34
|
+
ChromaDB is not installed by default with Langroid.
|
35
|
+
If you want to use it, please install it with the `chromadb` extra, e.g.
|
36
|
+
pip install "langroid[chromadb]"
|
37
|
+
or an equivalent command.
|
38
|
+
"""
|
39
|
+
)
|
31
40
|
self.config = config
|
32
41
|
emb_model = EmbeddingModel.create(config.embedding)
|
33
42
|
self.embedding_fn = emb_model.embedding_fn()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "langroid"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.200"
|
4
4
|
description = "Harness LLMs with Multi-Agent Programming"
|
5
5
|
authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -8,15 +8,15 @@ license = "MIT"
|
|
8
8
|
|
9
9
|
[tool.poetry.dependencies]
|
10
10
|
python = ">=3.9.1,<3.12"
|
11
|
-
mkdocs = "^1.4.2"
|
12
|
-
mkdocs-material = "^9.1.5"
|
13
|
-
mkdocstrings = {extras = ["python"], version = "^0.21.2"}
|
14
|
-
mkdocs-awesome-pages-plugin = "^2.8.0"
|
15
|
-
mkdocs-gen-files = "^0.4.0"
|
16
|
-
mkdocs-literate-nav = "^0.6.0"
|
17
|
-
mkdocs-section-index = "^0.3.5"
|
18
|
-
mkdocs-jupyter = "^0.24.1"
|
19
|
-
chromadb = ">=0.4.21, <=0.4.23"
|
11
|
+
mkdocs = {version="^1.4.2", optional=true}
|
12
|
+
mkdocs-material = {version="^9.1.5", optional=true}
|
13
|
+
mkdocstrings = {extras = ["python"], version = "^0.21.2", optional=true}
|
14
|
+
mkdocs-awesome-pages-plugin = {version="^2.8.0", optional=true}
|
15
|
+
mkdocs-gen-files = {version="^0.4.0", optional=true}
|
16
|
+
mkdocs-literate-nav = {version="^0.6.0", optional=true}
|
17
|
+
mkdocs-section-index = {version="^0.3.5", optional=true}
|
18
|
+
mkdocs-jupyter = {version="^0.24.1", optional=true}
|
19
|
+
chromadb = {version=">=0.4.21, <=0.4.23", optional=true}
|
20
20
|
onnxruntime = "1.16.1"
|
21
21
|
fire = "^0.5.0"
|
22
22
|
black = {extras = ["jupyter"], version = "^23.3.0"}
|
@@ -87,12 +87,13 @@ metaphor-python = {version = "^0.1.23", optional = true}
|
|
87
87
|
chainlit = {version = "^1.0.301", optional = true}
|
88
88
|
python-socketio = {version="^5.11.0", optional=true}
|
89
89
|
duckduckgo-search = "^4.4"
|
90
|
+
huggingface-hub = {version="^0.21.2", optional=true}
|
90
91
|
|
91
92
|
[tool.poetry.extras]
|
92
93
|
# install these using `poetry install -E [...]` where [...] is one of the extras below
|
93
94
|
# or install multiple extras using, e.g., `poetry install -E "litellm mysql"
|
94
95
|
hf-embeddings = ["sentence-transformers", "torch"]
|
95
|
-
transformers = ["transformers"]
|
96
|
+
transformers = ["transformers", "huggingface-hub"]
|
96
97
|
unstructured = ["unstructured"]
|
97
98
|
postgres = ["psycopg2", "pytest-postgresql"]
|
98
99
|
mysql = ["pymysql", "pytest-mysql"]
|
@@ -101,6 +102,9 @@ neo4j = ["neo4j"]
|
|
101
102
|
sciphi = ["agent-search"]
|
102
103
|
metaphor = ["metaphor-python"]
|
103
104
|
chainlit = ["chainlit", "python-socketio"]
|
105
|
+
chromadb = ["chromadb"]
|
106
|
+
mkdocs = ["mkdocs", "mkdocs-material", "mkdocstrings", "mkdocs-awesome-pages-plugin",
|
107
|
+
"mkdocs-gen-files", "mkdocs-literate-nav", "mkdocs-section-index", "mkdocs-jupyter"]
|
104
108
|
|
105
109
|
[tool.poetry.group.dev.dependencies]
|
106
110
|
pytest = "^7.3.1"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/lance_rag/query_planner_agent.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.1.198 → langroid-0.1.200}/langroid/agent/special/sql/utils/description_extractors.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.1.198 → langroid-0.1.200}/langroid/language_models/prompt_formatter/llama2_formatter.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|