langroid 0.1.225__tar.gz → 0.1.227__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 (127) hide show
  1. {langroid-0.1.225 → langroid-0.1.227}/PKG-INFO +3 -3
  2. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/openai_assistant.py +10 -2
  3. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/doc_chat_agent.py +16 -14
  4. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/document_parser.py +30 -6
  5. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/qdrantdb.py +4 -4
  6. {langroid-0.1.225 → langroid-0.1.227}/pyproject.toml +3 -2
  7. {langroid-0.1.225 → langroid-0.1.227}/LICENSE +0 -0
  8. {langroid-0.1.225 → langroid-0.1.227}/README.md +0 -0
  9. {langroid-0.1.225 → langroid-0.1.227}/langroid/__init__.py +0 -0
  10. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/__init__.py +0 -0
  11. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/base.py +0 -0
  12. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/batch.py +0 -0
  13. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/callbacks/__init__.py +0 -0
  14. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/callbacks/chainlit.py +0 -0
  15. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/chat_agent.py +0 -0
  16. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/chat_document.py +0 -0
  17. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/helpers.py +0 -0
  18. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/junk +0 -0
  19. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/__init__.py +0 -0
  20. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_doc_chat_agent.py +0 -0
  21. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_rag/__init__.py +0 -0
  22. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_rag/critic_agent.py +0 -0
  23. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_rag/lance_rag_task.py +0 -0
  24. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_rag/query_planner_agent.py +0 -0
  25. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/lance_tools.py +0 -0
  26. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/neo4j/__init__.py +0 -0
  27. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/neo4j/csv_kg_chat.py +0 -0
  28. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -0
  29. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/neo4j/utils/__init__.py +0 -0
  30. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/neo4j/utils/system_message.py +0 -0
  31. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/relevance_extractor_agent.py +0 -0
  32. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/retriever_agent.py +0 -0
  33. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/__init__.py +0 -0
  34. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/sql_chat_agent.py +0 -0
  35. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/utils/__init__.py +0 -0
  36. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/utils/description_extractors.py +0 -0
  37. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/utils/populate_metadata.py +0 -0
  38. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/utils/system_message.py +0 -0
  39. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/sql/utils/tools.py +0 -0
  40. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/special/table_chat_agent.py +0 -0
  41. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/task.py +0 -0
  42. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tool_message.py +0 -0
  43. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/__init__.py +0 -0
  44. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/duckduckgo_search_tool.py +0 -0
  45. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/extract_tool.py +0 -0
  46. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/generator_tool.py +0 -0
  47. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/google_search_tool.py +0 -0
  48. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/metaphor_search_tool.py +0 -0
  49. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/recipient_tool.py +0 -0
  50. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/run_python_code.py +0 -0
  51. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/sciphi_search_rag_tool.py +0 -0
  52. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent/tools/segment_extract_tool.py +0 -0
  53. {langroid-0.1.225 → langroid-0.1.227}/langroid/agent_config.py +0 -0
  54. {langroid-0.1.225 → langroid-0.1.227}/langroid/cachedb/__init__.py +0 -0
  55. {langroid-0.1.225 → langroid-0.1.227}/langroid/cachedb/base.py +0 -0
  56. {langroid-0.1.225 → langroid-0.1.227}/langroid/cachedb/momento_cachedb.py +0 -0
  57. {langroid-0.1.225 → langroid-0.1.227}/langroid/cachedb/redis_cachedb.py +0 -0
  58. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/__init__.py +0 -0
  59. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/base.py +0 -0
  60. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/clustering.py +0 -0
  61. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/models.py +0 -0
  62. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/protoc/embeddings.proto +0 -0
  63. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/protoc/embeddings_pb2.py +0 -0
  64. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -0
  65. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -0
  66. {langroid-0.1.225 → langroid-0.1.227}/langroid/embedding_models/remote_embeds.py +0 -0
  67. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/__init__.py +0 -0
  68. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/azure_openai.py +0 -0
  69. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/base.py +0 -0
  70. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/config.py +0 -0
  71. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/openai_assistants.py +0 -0
  72. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/openai_gpt.py +0 -0
  73. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/prompt_formatter/__init__.py +0 -0
  74. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/prompt_formatter/base.py +0 -0
  75. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/prompt_formatter/hf_formatter.py +0 -0
  76. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/prompt_formatter/llama2_formatter.py +0 -0
  77. {langroid-0.1.225 → langroid-0.1.227}/langroid/language_models/utils.py +0 -0
  78. {langroid-0.1.225 → langroid-0.1.227}/langroid/mytypes.py +0 -0
  79. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/__init__.py +0 -0
  80. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/agent_chats.py +0 -0
  81. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/code-parsing.md +0 -0
  82. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/code_parser.py +0 -0
  83. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/config.py +0 -0
  84. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/image_text.py +0 -0
  85. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/para_sentence_split.py +0 -0
  86. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/parse_json.py +0 -0
  87. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/parser.py +0 -0
  88. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/repo_loader.py +0 -0
  89. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/search.py +0 -0
  90. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/spider.py +0 -0
  91. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/table_loader.py +0 -0
  92. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/url_loader.py +0 -0
  93. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/url_loader_cookies.py +0 -0
  94. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/urls.py +0 -0
  95. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/utils.py +0 -0
  96. {langroid-0.1.225 → langroid-0.1.227}/langroid/parsing/web_search.py +0 -0
  97. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/__init__.py +0 -0
  98. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/chat-gpt4-system-prompt.md +0 -0
  99. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/dialog.py +0 -0
  100. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/prompts_config.py +0 -0
  101. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/templates.py +0 -0
  102. {langroid-0.1.225 → langroid-0.1.227}/langroid/prompts/transforms.py +0 -0
  103. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/__init__.py +0 -0
  104. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/algorithms/__init__.py +0 -0
  105. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/algorithms/graph.py +0 -0
  106. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/configuration.py +0 -0
  107. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/constants.py +0 -0
  108. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/docker.py +0 -0
  109. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/globals.py +0 -0
  110. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/llms/__init__.py +0 -0
  111. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/llms/strings.py +0 -0
  112. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/logging.py +0 -0
  113. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/output/__init__.py +0 -0
  114. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/output/printing.py +0 -0
  115. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/output/status.py +0 -0
  116. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/pandas_utils.py +0 -0
  117. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/pydantic_utils.py +0 -0
  118. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/system.py +0 -0
  119. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/web/__init__.py +0 -0
  120. {langroid-0.1.225 → langroid-0.1.227}/langroid/utils/web/login.py +0 -0
  121. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/__init__.py +0 -0
  122. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/base.py +0 -0
  123. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/chromadb.py +0 -0
  124. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/lancedb.py +0 -0
  125. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/meilisearch.py +0 -0
  126. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/momento.py +0 -0
  127. {langroid-0.1.225 → langroid-0.1.227}/langroid/vector_store/qdrant_cloud.py +0 -0
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.225
3
+ Version: 0.1.227
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
7
7
  Author-email: pchalasani@gmail.com
8
- Requires-Python: >=3.9.1,<3.12
8
+ Requires-Python: >=3.11,<3.12
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.10
12
11
  Classifier: Programming Language :: Python :: 3.11
13
12
  Provides-Extra: chainlit
14
13
  Provides-Extra: chromadb
@@ -101,6 +100,7 @@ Requires-Dist: tiktoken (>=0.5.1,<0.6.0)
101
100
  Requires-Dist: torch (==2.0.0) ; extra == "hf-embeddings"
102
101
  Requires-Dist: trafilatura (>=1.5.0,<2.0.0)
103
102
  Requires-Dist: typer (>=0.9.0,<0.10.0)
103
+ Requires-Dist: types-pillow (>=10.2.0.20240406,<11.0.0.0)
104
104
  Requires-Dist: types-pyyaml (>=6.0.12.20240311,<7.0.0.0)
105
105
  Requires-Dist: types-redis (>=4.5.5.2,<5.0.0.0)
106
106
  Requires-Dist: types-requests (>=2.31.0.1,<3.0.0.0)
@@ -8,6 +8,10 @@ from enum import Enum
8
8
  from typing import Any, Dict, List, Optional, Tuple, Type, cast, no_type_check
9
9
 
10
10
  from openai.types.beta import Assistant, Thread
11
+ from openai.types.beta.assistant_update_params import (
12
+ ToolResources,
13
+ ToolResourcesCodeInterpreter,
14
+ )
11
15
  from openai.types.beta.threads import Message, Run
12
16
  from openai.types.beta.threads.runs import RunStep
13
17
  from pydantic import BaseModel
@@ -29,7 +33,7 @@ logger = logging.getLogger(__name__)
29
33
 
30
34
 
31
35
  class ToolType(str, Enum):
32
- RETRIEVAL = "retrieval"
36
+ RETRIEVAL = "file_search"
33
37
  CODE_INTERPRETER = "code_interpreter"
34
38
  FUNCTION = "function"
35
39
 
@@ -127,7 +131,11 @@ class OpenAIAssistant(ChatAgent):
127
131
  self.config.files = list(set(self.config.files + files))
128
132
  self.assistant = self.assistants.update(
129
133
  self.assistant.id,
130
- file_ids=[f.id for f in self.files],
134
+ tool_resources=ToolResources(
135
+ code_interpreter=ToolResourcesCodeInterpreter(
136
+ file_ids=[f.id for f in self.files],
137
+ ),
138
+ ),
131
139
  )
132
140
 
133
141
  def add_assistant_tools(self, tools: List[AssistantTool]) -> None:
@@ -66,7 +66,7 @@ logger = logging.getLogger(__name__)
66
66
 
67
67
  DEFAULT_DOC_CHAT_INSTRUCTIONS = """
68
68
  Your task is to answer questions about various documents.
69
- You will be given various passages from these documents, and asked to answer questions
69
+ You will be given various passages from these documents, and asked to answer questions
70
70
  about them, or summarize them into coherent answers.
71
71
  """
72
72
 
@@ -76,7 +76,7 @@ You are a helpful assistant, helping me understand a collection of documents.
76
76
 
77
77
  has_sentence_transformers = False
78
78
  try:
79
- from sentence_transformer import SentenceTransformer # noqa: F401
79
+ from sentence_transformers import SentenceTransformer # noqa: F401
80
80
 
81
81
  has_sentence_transformers = True
82
82
  except ImportError:
@@ -169,7 +169,8 @@ class DocChatAgentConfig(ChatAgentConfig):
169
169
  dims=1536,
170
170
  )
171
171
 
172
- vecdb: VectorStoreConfig = LanceDBConfig(
172
+ # Allow vecdb to be None in case we want to explicitly set it later
173
+ vecdb: Optional[VectorStoreConfig] = LanceDBConfig(
173
174
  collection_name="doc-chat-lancedb",
174
175
  replace_collection=True,
175
176
  storage_path=".lancedb/data/",
@@ -209,12 +210,13 @@ class DocChatAgent(ChatAgent):
209
210
 
210
211
  def clear(self) -> None:
211
212
  """Clear the document collection and the specific collection in vecdb"""
212
- if self.vecdb is None:
213
- raise ValueError("VecDB not set")
214
213
  self.original_docs = []
215
214
  self.original_docs_length = 0
216
215
  self.chunked_docs = []
217
216
  self.chunked_docs_clean = []
217
+ if self.vecdb is None:
218
+ logger.warning("Attempting to clear VecDB, but VecDB not set.")
219
+ return
218
220
  collection_name = self.vecdb.config.collection_name
219
221
  if collection_name is None:
220
222
  return
@@ -339,7 +341,7 @@ class DocChatAgent(ChatAgent):
339
341
  n_paths = len(paths)
340
342
  print(
341
343
  f"""
342
- [green]I have processed the following {n_urls} URLs
344
+ [green]I have processed the following {n_urls} URLs
343
345
  and {n_paths} docs into {n_splits} parts:
344
346
  """.strip()
345
347
  )
@@ -443,7 +445,7 @@ class DocChatAgent(ChatAgent):
443
445
  if content not in df.columns:
444
446
  raise ValueError(
445
447
  f"""
446
- Content column {content} not in dataframe,
448
+ Content column {content} not in dataframe,
447
449
  so we cannot ingest into the DocChatAgent.
448
450
  Please specify the `content` parameter as a suitable
449
451
  text-based column in the dataframe.
@@ -816,12 +818,12 @@ class DocChatAgent(ChatAgent):
816
818
  # Adjust this prompt depending on context.
817
819
  answer = self.llm_response_forget(
818
820
  f"""
819
- Give an ideal answer to the following query,
820
- in up to 3 sentences. Do not explain yourself,
821
- and do not apologize, just show
821
+ Give an ideal answer to the following query,
822
+ in up to 3 sentences. Do not explain yourself,
823
+ and do not apologize, just show
822
824
  a good possible answer, even if you do not have any information.
823
825
  Preface your answer with "HYPOTHETICAL ANSWER: "
824
-
826
+
825
827
  QUERY: {query}
826
828
  """
827
829
  ).content
@@ -1293,9 +1295,9 @@ class DocChatAgent(ChatAgent):
1293
1295
  logger.warning(
1294
1296
  """
1295
1297
  No docs to summarize! Perhaps you are re-using a previously
1296
- defined collection?
1298
+ defined collection?
1297
1299
  In that case, we don't have access to the original docs.
1298
- To create a summary, use a new collection, and specify a list of docs.
1300
+ To create a summary, use a new collection, and specify a list of docs.
1299
1301
  """
1300
1302
  )
1301
1303
  return None
@@ -1318,7 +1320,7 @@ class DocChatAgent(ChatAgent):
1318
1320
  )
1319
1321
  prompt = f"""
1320
1322
  {instruction}
1321
-
1323
+
1322
1324
  FULL TEXT:
1323
1325
  {full_text}
1324
1326
  """.strip()
@@ -25,7 +25,29 @@ class DocumentType(str, Enum):
25
25
  TXT = "txt"
26
26
 
27
27
 
28
+ def find_last_full_char(possible_unicode: bytes) -> int:
29
+ """
30
+ Find the index of the last full character in a byte string.
31
+ Args:
32
+ possible_unicode (bytes): The bytes to check.
33
+ Returns:
34
+ int: The index of the last full unicode character.
35
+ """
36
+
37
+ for i in range(len(possible_unicode) - 1, 0, -1):
38
+ if (possible_unicode[i] & 0xC0) != 0x80:
39
+ return i
40
+ return 0
41
+
42
+
28
43
  def is_plain_text(path_or_bytes: str | bytes) -> bool:
44
+ """
45
+ Check if a file is plain text by attempting to decode it as UTF-8.
46
+ Args:
47
+ path_or_bytes (str|bytes): The file path or bytes object.
48
+ Returns:
49
+ bool: True if the file is plain text, False otherwise.
50
+ """
29
51
  if isinstance(path_or_bytes, str):
30
52
  if path_or_bytes.startswith(("http://", "https://")):
31
53
  response = requests.get(path_or_bytes)
@@ -38,6 +60,8 @@ def is_plain_text(path_or_bytes: str | bytes) -> bool:
38
60
  content = path_or_bytes[:1024]
39
61
  try:
40
62
  # Attempt to decode the content as UTF-8
63
+ content = content[: find_last_full_char(content)]
64
+
41
65
  _ = content.decode("utf-8")
42
66
  # Additional checks can go here, e.g., to verify that the content
43
67
  # doesn't contain too many unusual characters for it to be considered text
@@ -431,14 +455,14 @@ class ImagePdfParser(DocumentParser):
431
455
 
432
456
  def iterate_pages(
433
457
  self,
434
- ) -> Generator[Tuple[int, Image], None, None]:
458
+ ) -> Generator[Tuple[int, Image], None, None]: # type: ignore
435
459
  from pdf2image import convert_from_bytes
436
460
 
437
461
  images = convert_from_bytes(self.doc_bytes.getvalue())
438
462
  for i, image in enumerate(images):
439
463
  yield i, image
440
464
 
441
- def extract_text_from_page(self, page: Image) -> str:
465
+ def extract_text_from_page(self, page: Image) -> str: # type: ignore
442
466
  """
443
467
  Extract text from a given `pdf2image` page.
444
468
 
@@ -466,7 +490,7 @@ class UnstructuredPDFParser(DocumentParser):
466
490
  raise ImportError(
467
491
  """
468
492
  The `unstructured` library is not installed by default with langroid.
469
- To include this library, please install langroid with the
493
+ To include this library, please install langroid with the
470
494
  `unstructured` extra by running `pip install "langroid[unstructured]"`
471
495
  or equivalent.
472
496
  """
@@ -483,7 +507,7 @@ class UnstructuredPDFParser(DocumentParser):
483
507
  The `unstructured` library failed to parse the pdf.
484
508
  Please try a different library by setting the `library` field
485
509
  in the `pdf` section of the `parsing` field in the config file.
486
- Supported libraries are:
510
+ Supported libraries are:
487
511
  fitz, pypdf, pdfplumber, unstructured
488
512
  """
489
513
  )
@@ -529,7 +553,7 @@ class UnstructuredDocxParser(DocumentParser):
529
553
  raise ImportError(
530
554
  """
531
555
  The `unstructured` library is not installed by default with langroid.
532
- To include this library, please install langroid with the
556
+ To include this library, please install langroid with the
533
557
  `unstructured` extra by running `pip install "langroid[unstructured]"`
534
558
  or equivalent.
535
559
  """
@@ -580,7 +604,7 @@ class UnstructuredDocParser(UnstructuredDocxParser):
580
604
  raise ImportError(
581
605
  """
582
606
  The `unstructured` library is not installed by default with langroid.
583
- To include this library, please install langroid with the
607
+ To include this library, please install langroid with the
584
608
  `unstructured` extra by running `pip install "langroid[unstructured]"`
585
609
  or equivalent.
586
610
  """
@@ -192,8 +192,7 @@ class QdrantDB(VectorStore):
192
192
  with the same name. Defaults to False.
193
193
  """
194
194
  self.config.collection_name = collection_name
195
- collections = self.list_collections()
196
- if collection_name in collections:
195
+ if self.client.collection_exists(collection_name=collection_name):
197
196
  coll = self.client.get_collection(collection_name=collection_name)
198
197
  if (
199
198
  coll.status == CollectionStatus.GREEN
@@ -205,7 +204,8 @@ class QdrantDB(VectorStore):
205
204
  return
206
205
  else:
207
206
  logger.warning("Recreating fresh collection")
208
- self.client.recreate_collection(
207
+ self.client.delete_collection(collection_name=collection_name)
208
+ self.client.create_collection(
209
209
  collection_name=collection_name,
210
210
  vectors_config=VectorParams(
211
211
  size=self.embedding_dim,
@@ -214,7 +214,7 @@ class QdrantDB(VectorStore):
214
214
  )
215
215
  collection_info = self.client.get_collection(collection_name=collection_name)
216
216
  assert collection_info.status == CollectionStatus.GREEN
217
- assert collection_info.vectors_count == 0
217
+ assert collection_info.vectors_count in [0, None]
218
218
  if settings.debug:
219
219
  level = logger.getEffectiveLevel()
220
220
  logger.setLevel(logging.INFO)
@@ -1,13 +1,13 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.1.225"
3
+ version = "0.1.227"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"
7
7
  license = "MIT"
8
8
 
9
9
  [tool.poetry.dependencies]
10
- python = ">=3.9.1,<3.12"
10
+ python = ">=3.11,<3.12"
11
11
  mkdocs = {version="^1.4.2", optional=true}
12
12
  mkdocs-material = {version="^9.1.5", optional=true}
13
13
  mkdocstrings = {extras = ["python"], version = "^0.21.2", optional=true}
@@ -96,6 +96,7 @@ huggingface-hub = {version="^0.21.2", optional=true}
96
96
  pdf2image = "^1.17.0"
97
97
  pytesseract = "^0.3.10"
98
98
  types-pyyaml = "^6.0.12.20240311"
99
+ types-pillow = "^10.2.0.20240406"
99
100
 
100
101
  [tool.poetry.extras]
101
102
  # install these using `poetry install -E [...]` where [...] is one of the extras below
File without changes
File without changes