langroid 0.37.2__tar.gz → 0.37.4__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.37.2 → langroid-0.37.4}/PKG-INFO +1 -1
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/base.py +6 -1
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/chromadb.py +0 -1
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/lancedb.py +1 -3
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/momento.py +1 -3
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/qdrantdb.py +1 -3
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/weaviatedb.py +5 -7
- {langroid-0.37.2 → langroid-0.37.4}/pyproject.toml +1 -1
- {langroid-0.37.2 → langroid-0.37.4}/.gitignore +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/LICENSE +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/README.md +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/base.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/batch.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/callbacks/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/callbacks/chainlit.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/chat_document.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/openai_assistant.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/arangodb/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/arangodb/arangodb_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/arangodb/system_messages.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/arangodb/tools.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/arangodb/utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/doc_chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_rag/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/lance_tools.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/neo4j/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/neo4j/system_messages.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/neo4j/tools.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/relevance_extractor_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/retriever_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/utils/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/utils/system_message.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/sql/utils/tools.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/special/table_chat_agent.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/task.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tool_message.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/file_tools.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/google_search_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/metaphor_search_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/orchestration.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/recipient_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/retrieval_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/rewind_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/tools/segment_extract_tool.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/agent/xml_tool_message.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/cachedb/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/cachedb/base.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/cachedb/momento_cachedb.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/cachedb/redis_cachedb.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/base.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/models.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/protoc/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/protoc/embeddings.proto +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/embedding_models/remote_embeds.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/exceptions.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/azure_openai.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/base.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/config.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/mock_lm.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/openai_gpt.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/prompt_formatter/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/prompt_formatter/base.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/mytypes.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/agent_chats.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/code_parser.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/document_parser.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/para_sentence_split.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/parse_json.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/parser.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/pdf_utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/repo_loader.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/routing.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/search.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/spider.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/table_loader.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/url_loader.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/urls.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/parsing/web_search.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/prompts/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/prompts/dialog.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/prompts/prompts_config.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/prompts/templates.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/py.typed +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/pydantic_v1/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/pydantic_v1/main.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/algorithms/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/algorithms/graph.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/configuration.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/constants.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/git_utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/globals.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/logging.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/object_registry.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/output/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/output/citations.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/output/printing.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/output/status.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/pandas_utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/pydantic_utils.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/system.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/utils/types.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/__init__.py +0 -0
- {langroid-0.37.2 → langroid-0.37.4}/langroid/vector_store/meilisearch.py +0 -0
@@ -8,7 +8,7 @@ import pandas as pd
|
|
8
8
|
|
9
9
|
from langroid.embedding_models.base import EmbeddingModel, EmbeddingModelsConfig
|
10
10
|
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
|
11
|
-
from langroid.mytypes import DocMetaData, Document
|
11
|
+
from langroid.mytypes import DocMetaData, Document, EmbeddingFunction
|
12
12
|
from langroid.pydantic_v1 import BaseSettings
|
13
13
|
from langroid.utils.algorithms.graph import components, topological_sort
|
14
14
|
from langroid.utils.configuration import settings
|
@@ -51,6 +51,7 @@ class VectorStore(ABC):
|
|
51
51
|
self.embedding_model = EmbeddingModel.create(config.embedding)
|
52
52
|
else:
|
53
53
|
self.embedding_model = config.embedding_model
|
54
|
+
self.embedding_fn: EmbeddingFunction = self.embedding_model.embedding_fn()
|
54
55
|
|
55
56
|
@staticmethod
|
56
57
|
def create(config: VectorStoreConfig) -> Optional["VectorStore"]:
|
@@ -86,6 +87,10 @@ class VectorStore(ABC):
|
|
86
87
|
)
|
87
88
|
return None
|
88
89
|
|
90
|
+
@property
|
91
|
+
def embedding_dim(self) -> int:
|
92
|
+
return len(self.embedding_fn(["test"])[0])
|
93
|
+
|
89
94
|
@abstractmethod
|
90
95
|
def clear_empty_collections(self) -> int:
|
91
96
|
"""Clear all empty collections in the vector store.
|
@@ -35,7 +35,6 @@ class ChromaDB(VectorStore):
|
|
35
35
|
except ImportError:
|
36
36
|
raise LangroidImportError("chromadb", "chromadb")
|
37
37
|
self.config = config
|
38
|
-
self.embedding_fn = self.embedding_model.embedding_fn()
|
39
38
|
self.client = chromadb.Client(
|
40
39
|
chromadb.config.Settings(
|
41
40
|
# chroma_db_impl="duckdb+parquet",
|
@@ -26,7 +26,7 @@ from langroid.embedding_models.base import (
|
|
26
26
|
)
|
27
27
|
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
|
28
28
|
from langroid.exceptions import LangroidImportError
|
29
|
-
from langroid.mytypes import Document
|
29
|
+
from langroid.mytypes import Document
|
30
30
|
from langroid.utils.configuration import settings
|
31
31
|
from langroid.utils.pydantic_utils import (
|
32
32
|
dataframe_to_document_model,
|
@@ -60,8 +60,6 @@ class LanceDB(VectorStore):
|
|
60
60
|
raise LangroidImportError("lancedb", "lancedb")
|
61
61
|
|
62
62
|
self.config: LanceDBConfig = config
|
63
|
-
self.embedding_fn: EmbeddingFunction = self.embedding_model.embedding_fn()
|
64
|
-
self.embedding_dim = self.embedding_model.embedding_dims
|
65
63
|
self.host = config.host
|
66
64
|
self.port = config.port
|
67
65
|
self.is_from_dataframe = False # were docs ingested from a dataframe?
|
@@ -37,7 +37,7 @@ from langroid.embedding_models.base import (
|
|
37
37
|
EmbeddingModelsConfig,
|
38
38
|
)
|
39
39
|
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
|
40
|
-
from langroid.mytypes import Document
|
40
|
+
from langroid.mytypes import Document
|
41
41
|
from langroid.utils.configuration import settings
|
42
42
|
from langroid.utils.pydantic_utils import (
|
43
43
|
flatten_pydantic_instance,
|
@@ -61,8 +61,6 @@ class MomentoVI(VectorStore):
|
|
61
61
|
raise LangroidImportError("momento", "momento")
|
62
62
|
self.distance = SimilarityMetric.COSINE_SIMILARITY
|
63
63
|
self.config: MomentoVIConfig = config
|
64
|
-
self.embedding_fn: EmbeddingFunction = self.embedding_model.embedding_fn()
|
65
|
-
self.embedding_dim = self.embedding_model.embedding_dims
|
66
64
|
self.host = config.host
|
67
65
|
self.port = config.port
|
68
66
|
load_dotenv()
|
@@ -27,7 +27,7 @@ from langroid.embedding_models.base import (
|
|
27
27
|
EmbeddingModelsConfig,
|
28
28
|
)
|
29
29
|
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
|
30
|
-
from langroid.mytypes import Document,
|
30
|
+
from langroid.mytypes import Document, Embeddings
|
31
31
|
from langroid.utils.configuration import settings
|
32
32
|
from langroid.vector_store.base import VectorStore, VectorStoreConfig
|
33
33
|
|
@@ -77,8 +77,6 @@ class QdrantDB(VectorStore):
|
|
77
77
|
def __init__(self, config: QdrantDBConfig = QdrantDBConfig()):
|
78
78
|
super().__init__(config)
|
79
79
|
self.config: QdrantDBConfig = config
|
80
|
-
self.embedding_fn: EmbeddingFunction = self.embedding_model.embedding_fn()
|
81
|
-
self.embedding_dim = len(self.embedding_fn(["test"])[0])
|
82
80
|
if self.config.use_sparse_embeddings:
|
83
81
|
try:
|
84
82
|
from transformers import AutoModelForMaskedLM, AutoTokenizer
|
@@ -10,7 +10,7 @@ from langroid.embedding_models.base import (
|
|
10
10
|
)
|
11
11
|
from langroid.embedding_models.models import OpenAIEmbeddingsConfig
|
12
12
|
from langroid.exceptions import LangroidImportError
|
13
|
-
from langroid.mytypes import DocMetaData, Document
|
13
|
+
from langroid.mytypes import DocMetaData, Document
|
14
14
|
from langroid.utils.configuration import settings
|
15
15
|
from langroid.vector_store.base import VectorStore, VectorStoreConfig
|
16
16
|
|
@@ -38,8 +38,6 @@ class WeaviateDB(VectorStore):
|
|
38
38
|
def __init__(self, config: WeaviateDBConfig = WeaviateDBConfig()):
|
39
39
|
super().__init__(config)
|
40
40
|
self.config: WeaviateDBConfig = config
|
41
|
-
self.embedding_fn: EmbeddingFunction = self.embedding_model.embedding_fn()
|
42
|
-
self.embedding_dim = self.embedding_model.embedding_dims
|
43
41
|
load_dotenv()
|
44
42
|
key = os.getenv("WEAVIATE_API_KEY")
|
45
43
|
url = os.getenv("WEAVIATE_API_URL")
|
@@ -211,10 +209,10 @@ class WeaviateDB(VectorStore):
|
|
211
209
|
return_properties=True,
|
212
210
|
return_metadata=MetadataQuery(distance=True),
|
213
211
|
)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
212
|
+
maybe_distances = [item.metadata.distance for item in response.objects]
|
213
|
+
similarities = [0 if d is None else 1 - d for d in maybe_distances]
|
214
|
+
docs = [self.weaviate_obj_to_doc(item) for item in response.objects]
|
215
|
+
return list(zip(docs, similarities))
|
218
216
|
|
219
217
|
def _create_valid_uuid_id(self, id: str) -> Any:
|
220
218
|
try:
|
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
|
{langroid-0.37.2 → langroid-0.37.4}/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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{langroid-0.37.2 → langroid-0.37.4}/langroid/language_models/prompt_formatter/hf_formatter.py
RENAMED
File without changes
|
{langroid-0.37.2 → langroid-0.37.4}/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
|