langroid 0.1.265__py3-none-any.whl → 0.2.0__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.
@@ -0,0 +1,96 @@
1
+ """Mock Language Model for testing"""
2
+
3
+ from typing import Dict, List, Optional, Union
4
+
5
+ import langroid.language_models as lm
6
+ from langroid.language_models import LLMResponse
7
+ from langroid.language_models.base import LanguageModel, LLMConfig
8
+
9
+
10
+ class MockLMConfig(LLMConfig):
11
+ """
12
+ Mock Language Model Configuration.
13
+
14
+ Attributes:
15
+ response_dict (Dict[str, str]): A "response rule-book", in the form of a
16
+ dictionary; if last msg in dialog is x,then respond with response_dict[x]
17
+ """
18
+
19
+ response_dict: Dict[str, str] = {}
20
+ default_response: str = "Mock response"
21
+ type: str = "mock"
22
+
23
+
24
+ class MockLM(LanguageModel):
25
+
26
+ def __init__(self, config: MockLMConfig = MockLMConfig()):
27
+ super().__init__(config)
28
+ self.config: MockLMConfig = config
29
+
30
+ def chat(
31
+ self,
32
+ messages: Union[str, List[lm.LLMMessage]],
33
+ max_tokens: int = 200,
34
+ functions: Optional[List[lm.LLMFunctionSpec]] = None,
35
+ function_call: str | Dict[str, str] = "auto",
36
+ ) -> lm.LLMResponse:
37
+ """
38
+ Mock chat function for testing
39
+ """
40
+ last_msg = messages[-1].content if isinstance(messages, list) else messages
41
+ return lm.LLMResponse(
42
+ message=self.config.response_dict.get(
43
+ last_msg,
44
+ self.config.default_response,
45
+ ),
46
+ cached=False,
47
+ )
48
+
49
+ async def achat(
50
+ self,
51
+ messages: Union[str, List[lm.LLMMessage]],
52
+ max_tokens: int = 200,
53
+ functions: Optional[List[lm.LLMFunctionSpec]] = None,
54
+ function_call: str | Dict[str, str] = "auto",
55
+ ) -> lm.LLMResponse:
56
+ """
57
+ Mock chat function for testing
58
+ """
59
+ last_msg = messages[-1].content if isinstance(messages, list) else messages
60
+ return lm.LLMResponse(
61
+ message=self.config.response_dict.get(
62
+ last_msg,
63
+ self.config.default_response,
64
+ ),
65
+ cached=False,
66
+ )
67
+
68
+ def generate(self, prompt: str, max_tokens: int = 200) -> lm.LLMResponse:
69
+ """
70
+ Mock generate function for testing
71
+ """
72
+ return lm.LLMResponse(
73
+ message=self.config.response_dict.get(
74
+ prompt,
75
+ self.config.default_response,
76
+ ),
77
+ cached=False,
78
+ )
79
+
80
+ async def agenerate(self, prompt: str, max_tokens: int = 200) -> LLMResponse:
81
+ """
82
+ Mock generate function for testing
83
+ """
84
+ return lm.LLMResponse(
85
+ message=self.config.response_dict.get(
86
+ prompt,
87
+ self.config.default_response,
88
+ ),
89
+ cached=False,
90
+ )
91
+
92
+ def get_stream(self) -> bool:
93
+ return False
94
+
95
+ def set_stream(self, stream: bool) -> bool:
96
+ return False
@@ -62,7 +62,7 @@ def retry_with_exponential_backoff(
62
62
  if num_retries > max_retries:
63
63
  raise Exception(
64
64
  f"Maximum number of retries ({max_retries}) exceeded."
65
- f" Last error: {e}."
65
+ f" Last error: {str(e)}."
66
66
  )
67
67
 
68
68
  # Increment the delay
@@ -128,6 +128,7 @@ def async_retry_with_exponential_backoff(
128
128
  if num_retries > max_retries:
129
129
  raise Exception(
130
130
  f"Maximum number of retries ({max_retries}) exceeded."
131
+ f" Last error: {str(e)}."
131
132
  )
132
133
 
133
134
  # Increment the delay
langroid/mytypes.py CHANGED
@@ -1,10 +1,9 @@
1
- import hashlib
2
- import uuid
3
1
  from enum import Enum
4
2
  from textwrap import dedent
5
3
  from typing import Any, Callable, Dict, List, Union
4
+ from uuid import uuid4
6
5
 
7
- from langroid.pydantic_v1 import BaseModel, Extra
6
+ from langroid.pydantic_v1 import BaseModel, Extra, Field
8
7
 
9
8
  Number = Union[int, float]
10
9
  Embedding = List[Number]
@@ -40,7 +39,7 @@ class DocMetaData(BaseModel):
40
39
 
41
40
  source: str = "context"
42
41
  is_chunk: bool = False # if it is a chunk, don't split
43
- id: str = "" # unique id for the document
42
+ id: str = Field(default_factory=lambda: str(uuid4()))
44
43
  window_ids: List[str] = [] # for RAG: ids of chunks around this one
45
44
 
46
45
  def dict_bool_int(self, *args: Any, **kwargs: Any) -> Dict[str, Any]:
@@ -67,41 +66,11 @@ class Document(BaseModel):
67
66
  content: str
68
67
  metadata: DocMetaData
69
68
 
70
- @staticmethod
71
- def hash_id(doc: str) -> str:
72
- # Encode the document as UTF-8
73
- doc_utf8 = str(doc).encode("utf-8")
74
-
75
- # Create a SHA256 hash object
76
- sha256_hash = hashlib.sha256()
77
-
78
- # Update the hash object with the bytes of the document
79
- sha256_hash.update(doc_utf8)
80
-
81
- # Get the hexadecimal representation of the hash
82
- hash_hex = sha256_hash.hexdigest()
83
-
84
- # Convert the first part of the hash to a UUID
85
- hash_uuid = uuid.UUID(hash_hex[:32])
86
-
87
- return str(hash_uuid)
88
-
89
- def _unique_hash_id(self) -> str:
90
- return self.hash_id(str(self))
91
-
92
69
  def id(self) -> str:
93
- if (
94
- hasattr(self.metadata, "id")
95
- and self.metadata.id is not None
96
- and self.metadata.id != ""
97
- ):
98
- return self.metadata.id
99
- else:
100
- return self._unique_hash_id()
70
+ return self.metadata.id
101
71
 
102
72
  def __str__(self) -> str:
103
73
  # TODO: make metadata a pydantic model to enforce "source"
104
- self.metadata.json()
105
74
  return dedent(
106
75
  f"""
107
76
  CONTENT: {self.content}
@@ -8,6 +8,7 @@ from io import BytesIO
8
8
  from typing import TYPE_CHECKING, Any, Generator, List, Tuple
9
9
 
10
10
  from langroid.exceptions import LangroidImportError
11
+ from langroid.utils.object_registry import ObjectRegistry
11
12
 
12
13
  try:
13
14
  import fitz
@@ -341,6 +342,8 @@ class DocumentParser(Parser):
341
342
  split = [] # tokens in curr split
342
343
  pages: List[str] = []
343
344
  docs: List[Document] = []
345
+ # metadata.id to be shared by ALL chunks of this document
346
+ common_id = ObjectRegistry.new_id()
344
347
  for i, page in self.iterate_pages():
345
348
  page_text = self.extract_text_from_page(page)
346
349
  split += self.tokenizer.encode(page_text)
@@ -358,6 +361,7 @@ class DocumentParser(Parser):
358
361
  metadata=DocMetaData(
359
362
  source=f"{self.source} pages {pg}",
360
363
  is_chunk=True,
364
+ id=common_id,
361
365
  ),
362
366
  )
363
367
  )
@@ -372,6 +376,7 @@ class DocumentParser(Parser):
372
376
  metadata=DocMetaData(
373
377
  source=f"{self.source} pages {pg}",
374
378
  is_chunk=True,
379
+ id=common_id,
375
380
  ),
376
381
  )
377
382
  )
@@ -7,6 +7,7 @@ import tiktoken
7
7
  from langroid.mytypes import Document
8
8
  from langroid.parsing.para_sentence_split import create_chunks, remove_extra_whitespace
9
9
  from langroid.pydantic_v1 import BaseSettings
10
+ from langroid.utils.object_registry import ObjectRegistry
10
11
 
11
12
  logger = logging.getLogger(__name__)
12
13
  logger.setLevel(logging.WARNING)
@@ -75,11 +76,13 @@ class Parser:
75
76
  return
76
77
  # The original metadata.id (if any) is ignored since it will be same for all
77
78
  # chunks and is useless. We want a distinct id for each chunk.
79
+ # ASSUMPTION: all chunks c of a doc have same c.metadata.id !
78
80
  orig_ids = [c.metadata.id for c in chunks]
79
- ids = [Document.hash_id(str(c)) for c in chunks]
81
+ ids = [ObjectRegistry.new_id() for c in chunks]
80
82
  id2chunk = {id: c for id, c in zip(ids, chunks)}
81
83
 
82
84
  # group the ids by orig_id
85
+ # (each distinct orig_id refers to a different document)
83
86
  orig_id_to_ids: Dict[str, List[str]] = {}
84
87
  for orig_id, id in zip(orig_ids, ids):
85
88
  if orig_id not in orig_id_to_ids:
@@ -108,6 +111,10 @@ class Parser:
108
111
  if d.content.strip() == "":
109
112
  continue
110
113
  chunks = remove_extra_whitespace(d.content).split(self.config.separators[0])
114
+ # note we are ensuring we COPY the document metadata into each chunk,
115
+ # which ensures all chunks of a given doc have same metadata
116
+ # (and in particular same metadata.id, which is important later for
117
+ # add_window_ids)
111
118
  chunk_docs = [
112
119
  Document(
113
120
  content=c, metadata=d.metadata.copy(update=dict(is_chunk=True))
@@ -156,6 +163,10 @@ class Parser:
156
163
  if d.content.strip() == "":
157
164
  continue
158
165
  chunks = create_chunks(d.content, self.config.chunk_size, self.num_tokens)
166
+ # note we are ensuring we COPY the document metadata into each chunk,
167
+ # which ensures all chunks of a given doc have same metadata
168
+ # (and in particular same metadata.id, which is important later for
169
+ # add_window_ids)
159
170
  chunk_docs = [
160
171
  Document(
161
172
  content=c, metadata=d.metadata.copy(update=dict(is_chunk=True))
@@ -171,6 +182,10 @@ class Parser:
171
182
  final_docs = []
172
183
  for d in docs:
173
184
  chunks = self.chunk_tokens(d.content)
185
+ # note we are ensuring we COPY the document metadata into each chunk,
186
+ # which ensures all chunks of a given doc have same metadata
187
+ # (and in particular same metadata.id, which is important later for
188
+ # add_window_ids)
174
189
  chunk_docs = [
175
190
  Document(
176
191
  content=c, metadata=d.metadata.copy(update=dict(is_chunk=True))
@@ -274,7 +289,7 @@ class Parser:
274
289
  # we need this to distinguish docs later in add_window_ids
275
290
  for d in docs:
276
291
  if d.metadata.id in [None, ""]:
277
- d.metadata.id = d._unique_hash_id()
292
+ d.metadata.id = ObjectRegistry.new_id()
278
293
  # some docs are already splits, so don't split them further!
279
294
  chunked_docs = [d for d in docs if d.metadata.is_chunk]
280
295
  big_docs = [d for d in docs if not d.metadata.is_chunk]
@@ -5,6 +5,7 @@ from . import logging
5
5
  from . import pydantic_utils
6
6
  from . import system
7
7
  from . import output
8
+ from . import object_registry
8
9
 
9
10
  __all__ = [
10
11
  "configuration",
@@ -14,4 +15,5 @@ __all__ = [
14
15
  "pydantic_utils",
15
16
  "system",
16
17
  "output",
18
+ "object_registry",
17
19
  ]
@@ -0,0 +1,66 @@
1
+ import time
2
+ from typing import TYPE_CHECKING, Dict, Optional, TypeAlias, TypeVar
3
+ from uuid import uuid4
4
+
5
+ from langroid.pydantic_v1 import BaseModel
6
+
7
+ if TYPE_CHECKING:
8
+ from langroid.agent.base import Agent
9
+ from langroid.agent.chat_agent import ChatAgent
10
+ from langroid.agent.chat_document import ChatDocument
11
+
12
+ # any derivative of BaseModel that has an id() method or an id attribute
13
+ ObjWithId: TypeAlias = ChatDocument | ChatAgent | Agent
14
+ else:
15
+ ObjWithId = BaseModel
16
+
17
+ # Define a type variable that can be any subclass of BaseModel
18
+ T = TypeVar("T", bound=BaseModel)
19
+
20
+
21
+ class ObjectRegistry:
22
+ """A global registry to hold id -> object mappings."""
23
+
24
+ registry: Dict[str, ObjWithId] = {}
25
+
26
+ @classmethod
27
+ def add(cls, obj: ObjWithId) -> str:
28
+ """Adds an object to the registry, returning the object's ID."""
29
+ object_id = obj.id() if callable(obj.id) else obj.id
30
+ cls.registry[object_id] = obj
31
+ return object_id
32
+
33
+ @classmethod
34
+ def get(cls, obj_id: str) -> Optional[ObjWithId]:
35
+ """Retrieves an object by ID if it still exists."""
36
+ return cls.registry.get(obj_id)
37
+
38
+ @classmethod
39
+ def register_object(cls, obj: ObjWithId) -> str:
40
+ """Registers an object in the registry, returning the object's ID."""
41
+ return cls.add(obj)
42
+
43
+ @classmethod
44
+ def remove(cls, obj_id: str) -> None:
45
+ """Removes an object from the registry."""
46
+ if obj_id in cls.registry:
47
+ del cls.registry[obj_id]
48
+
49
+ @classmethod
50
+ def cleanup(cls) -> None:
51
+ """Cleans up the registry by removing entries where the object is None."""
52
+ to_remove = [key for key, value in cls.registry.items() if value is None]
53
+ for key in to_remove:
54
+ del cls.registry[key]
55
+
56
+ @staticmethod
57
+ def new_id() -> str:
58
+ """Generates a new unique ID."""
59
+ return str(uuid4())
60
+
61
+
62
+ def scheduled_cleanup(interval: int = 600) -> None:
63
+ """Periodically cleans up the global registry every 'interval' seconds."""
64
+ while True:
65
+ ObjectRegistry.cleanup()
66
+ time.sleep(interval)
langroid/utils/system.py CHANGED
@@ -181,5 +181,4 @@ def hash(s: str) -> str:
181
181
 
182
182
  def generate_unique_id() -> str:
183
183
  """Generate a unique ID using UUID4."""
184
- unique_id = str(uuid.uuid4())
185
- return unique_id
184
+ return str(uuid.uuid4())
@@ -12,6 +12,7 @@ from langroid.mytypes import Document
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
15
+ from langroid.utils.object_registry import ObjectRegistry
15
16
  from langroid.utils.output.printing import print_long_text
16
17
  from langroid.utils.pandas_utils import stringify
17
18
 
@@ -163,7 +164,7 @@ class VectorStore(ABC):
163
164
  vecdbs don't like having blank ids."""
164
165
  for d in documents:
165
166
  if d.metadata.id in [None, ""]:
166
- d.metadata.id = d._unique_hash_id()
167
+ d.metadata.id = ObjectRegistry.new_id()
167
168
 
168
169
  @abstractmethod
169
170
  def similar_texts_with_scores(
@@ -254,7 +255,7 @@ class VectorStore(ABC):
254
255
  metadata=metadata,
255
256
  )
256
257
  # make a fresh id since content is in general different
257
- document.metadata.id = document.hash_id(document.content)
258
+ document.metadata.id = ObjectRegistry.new_id()
258
259
  final_docs += [document]
259
260
  final_scores += [max(id2max_score[id] for id in w)]
260
261
  return list(zip(final_docs, final_scores))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.1.265
3
+ Version: 0.2.0
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -423,7 +423,7 @@ Here is what it looks like in action
423
423
 
424
424
  # :zap: Highlights
425
425
  (For a more up-to-date list see the
426
- [release](https://github.com/langroid/langroid?tab=readme-ov-file#fire-updatesreleases)
426
+ [Updates/Releases](https://github.com/langroid/langroid?tab=readme-ov-file#fire-updatesreleases)
427
427
  section above)
428
428
  - **Agents as first-class citizens:** The [Agent](https://langroid.github.io/langroid/reference/agent/base/#langroid.agent.base.Agent) class encapsulates LLM conversation state,
429
429
  and optionally a vector-store and tools. Agents are a core abstraction in Langroid;
@@ -439,8 +439,8 @@ section above)
439
439
  - **Modularity, Reusability, Loose coupling:** The `Agent` and `Task` abstractions allow users to design
440
440
  Agents with specific skills, wrap them in Tasks, and combine tasks in a flexible way.
441
441
  - **LLM Support**: Langroid supports OpenAI LLMs as well as LLMs from hundreds of
442
- providers (local/open or remote/commercial) via proxy libraries and local model servers
443
- such as [LiteLLM](https://docs.litellm.ai/docs/providers) that in effect mimic the OpenAI API.
442
+ providers ([local/open](https://langroid.github.io/langroid/tutorials/local-llm-setup/) or [remote/commercial](https://langroid.github.io/langroid/tutorials/non-openai-llms/)) via proxy libraries and local model servers
443
+ such as [ollama](https://github.com/ollama), [oobabooga](https://github.com/oobabooga/text-generation-webui), [LiteLLM](https://docs.litellm.ai/docs/providers) that in effect mimic the OpenAI API.
444
444
  - **Caching of LLM responses:** Langroid supports [Redis](https://redis.com/try-free/) and
445
445
  [Momento](https://www.gomomento.com/) to cache LLM responses.
446
446
  - **Vector-stores**: [LanceDB](https://github.com/lancedb/lancedb), [Qdrant](https://qdrant.tech/), [Chroma](https://www.trychroma.com/) are currently supported.
@@ -450,7 +450,7 @@ such as [LiteLLM](https://docs.litellm.ai/docs/providers) that in effect mimic t
450
450
  - **Observability, Logging, Lineage:** Langroid generates detailed logs of multi-agent interactions and
451
451
  maintains provenance/lineage of messages, so that you can trace back
452
452
  the origin of a message.
453
- - **Tools/Plugins/Function-calling**: Langroid supports OpenAI's recently
453
+ - **[Tools/Plugins/Function-calling](https://langroid.github.io/langroid/quick-start/chat-agent-tool/)**: Langroid supports OpenAI's recently
454
454
  released [function calling](https://platform.openai.com/docs/guides/gpt/function-calling)
455
455
  feature. In addition, Langroid has its own native equivalent, which we
456
456
  call **tools** (also known as "plugins" in other contexts). Function
@@ -1,16 +1,16 @@
1
1
  langroid/__init__.py,sha256=z_fCOLQJPOw3LLRPBlFB5-2HyCjpPgQa4m4iY5Fvb8Y,1800
2
2
  langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
3
- langroid/agent/base.py,sha256=CHFUZ4vnC1CSMMT5POnY4AWu96RQ-4uDUARUbhGAGo8,37195
3
+ langroid/agent/base.py,sha256=rqkf5FN1jO7IGqa_bvnQc37d8LZRal1RHVJe0Dvtlsc,37680
4
4
  langroid/agent/batch.py,sha256=feRA_yRG768ElOQjrKEefcRv6Aefd_yY7qktuYUQDwc,10040
5
5
  langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  langroid/agent/callbacks/chainlit.py,sha256=UKG2_v4ktfkEaGvdouVRHEqQejEYya2Rli8jrP65TmA,22055
7
- langroid/agent/chat_agent.py,sha256=hnmeOxdi4i5w8WaL2kPjQOEpenoRW_hG5EfeMWuuVsQ,39478
8
- langroid/agent/chat_document.py,sha256=tXFuUw2fs8WVIhVt10Sne0IpOzPPEaFz_1yqQgU6V4U,9218
7
+ langroid/agent/chat_agent.py,sha256=eRTrTjGlu36gTbdBLbQ5M5EtBMIcdEc9bjgMLTa40oQ,41506
8
+ langroid/agent/chat_document.py,sha256=8yH7o0aMVtUDHh3InpEErjhlY6t4Lr6KQzBrAKcYsEM,11141
9
9
  langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
11
11
  langroid/agent/openai_assistant.py,sha256=rmGJD5n0eE7_O1EkPyXgHFMNGc3vb2GKweZMhzmRWvI,33068
12
12
  langroid/agent/special/__init__.py,sha256=gik_Xtm_zV7U9s30Mn8UX3Gyuy4jTjQe9zjiE3HWmEo,1273
13
- langroid/agent/special/doc_chat_agent.py,sha256=dlXsY7brhrGOf_TA39EgkcL80L102Gkunoid7GvIZNY,54444
13
+ langroid/agent/special/doc_chat_agent.py,sha256=CXFLfDMEabaBZwZwFgNOaG3E3S86xcBM4txrsMD_70I,54014
14
14
  langroid/agent/special/lance_doc_chat_agent.py,sha256=USp0U3eTaJzwF_3bdqE7CedSLbaqAi2tm-VzygcyLaA,10175
15
15
  langroid/agent/special/lance_rag/__init__.py,sha256=QTbs0IVE2ZgDg8JJy1zN97rUUg4uEPH7SLGctFNumk4,174
16
16
  langroid/agent/special/lance_rag/critic_agent.py,sha256=ufTdpHSeHgCzN85Q0sfWOrpBpsCjGVZdAg5yOH1ogU8,7296
@@ -32,9 +32,9 @@ langroid/agent/special/sql/utils/populate_metadata.py,sha256=1J22UsyEPKzwK0XlJZt
32
32
  langroid/agent/special/sql/utils/system_message.py,sha256=qKLHkvQWRQodTtPLPxr1GSLUYUFASZU8x-ybV67cB68,1885
33
33
  langroid/agent/special/sql/utils/tools.py,sha256=vFYysk6Vi7HJjII8B4RitA3pt_z3gkSglDNdhNVMiFc,1332
34
34
  langroid/agent/special/table_chat_agent.py,sha256=d9v2wsblaRx7oMnKhLV7uO_ujvk9gh59pSGvBXyeyNc,9659
35
- langroid/agent/task.py,sha256=AA8MKWVeZ6VeI3uAVhXzMgZWULGRtYoNXQ6HeAzS4oU,61011
35
+ langroid/agent/task.py,sha256=ZTnG8h214FF3Vm54Eyl37j5OzKIHc313QbiUkMlofwM,67091
36
36
  langroid/agent/tool_message.py,sha256=wIyZnUcZpxkiRPvM9O3MO3b5BBAdLEEan9kqPbvtApc,9743
37
- langroid/agent/tools/__init__.py,sha256=8Pc9BlGCB5FQ2IDGKS_WPpHCoWp5jblMU8EHJwwikAY,303
37
+ langroid/agent/tools/__init__.py,sha256=e-63cfwQNk_ftRKQwgDAJQK16QLbRVWDBILeXIc7wLk,402
38
38
  langroid/agent/tools/duckduckgo_search_tool.py,sha256=NhsCaGZkdv28nja7yveAhSK_w6l_Ftym8agbrdzqgfo,1935
39
39
  langroid/agent/tools/extract_tool.py,sha256=u5lL9rKBzaLBOrRyLnTAZ97pQ1uxyLP39XsWMnpaZpw,3789
40
40
  langroid/agent/tools/generator_tool.py,sha256=y0fB0ZObjA0b3L0uSTtrqRCKHDUR95arBftqiUeKD2o,663
@@ -42,6 +42,7 @@ langroid/agent/tools/google_search_tool.py,sha256=y7b-3FtgXf0lfF4AYxrZ3K5pH2dhid
42
42
  langroid/agent/tools/metaphor_search_tool.py,sha256=qj4gt453cLEX3EGW7nVzVu6X7LCdrwjSlcNY0qJW104,2489
43
43
  langroid/agent/tools/recipient_tool.py,sha256=NrLxIeQT-kbMv7AeYX0uqvGeMK4Q3fIDvG15OVzlgk8,9624
44
44
  langroid/agent/tools/retrieval_tool.py,sha256=2q2pfoYbZNfbWQ0McxrtmfF0ekGglIgRl-6uF26pa-E,871
45
+ langroid/agent/tools/rewind_tool.py,sha256=aeu35_OjmCDTCgWH6nn8noXIC7ACD7-Rh-qh36wnBOg,5516
45
46
  langroid/agent/tools/run_python_code.py,sha256=BvoxYzzHijU-p4703n2iVlt5BCieR1oMSy50w0tQZAg,1787
46
47
  langroid/agent/tools/segment_extract_tool.py,sha256=__srZ_VGYLVOdPrITUM8S0HpmX4q7r5FHWMDdHdEv8w,1440
47
48
  langroid/agent_config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -60,28 +61,28 @@ langroid/embedding_models/protoc/embeddings_pb2.pyi,sha256=UkNy7BrNsmQm0vLb3NtGX
60
61
  langroid/embedding_models/protoc/embeddings_pb2_grpc.py,sha256=9dYQqkW3JPyBpSEjeGXTNpSqAkC-6FPtBHyteVob2Y8,2452
61
62
  langroid/embedding_models/remote_embeds.py,sha256=6_kjXByVbqhY9cGwl9R83ZcYC2km-nGieNNAo1McHaY,5151
62
63
  langroid/exceptions.py,sha256=w_Cr41nPAmsa6gW5nNFaO9yDcBCWdQqRspL1jYvZf5w,2209
63
- langroid/language_models/__init__.py,sha256=55602F5QA58MmRq-yRjoXK6xZOMRHQrR4QGaCnlX218,822
64
+ langroid/language_models/__init__.py,sha256=vrBtgR8Cq9UVfoI7nTms0IN7fd4y2JYpUP3GNV1DegY,898
64
65
  langroid/language_models/azure_openai.py,sha256=ncRCbKooqLVOY-PWQUIo9C3yTuKEFbAwyngXT_M4P7k,5989
65
- langroid/language_models/base.py,sha256=UbHcXSzQ5pTc_H5VSDh45c6dsyJwfY0H5_6ofEBXH-8,16917
66
+ langroid/language_models/base.py,sha256=aVptuo_LpymIQFpJh836lcFCUpJNOV3ukxvQAQMCqFc,17426
66
67
  langroid/language_models/config.py,sha256=9Q8wk5a7RQr8LGMT_0WkpjY8S4ywK06SalVRjXlfCiI,378
67
- langroid/language_models/openai_assistants.py,sha256=9K-DEAL2aSWHeXj2hwCo2RAlK9_1oCPtqX2u1wISCj8,36
68
+ langroid/language_models/mock_lm.py,sha256=L0YqrrxLCePs_5MrK7rJ5-SajNxDtuVU_VvZVRfs9q4,2834
68
69
  langroid/language_models/openai_gpt.py,sha256=RXnLKULuCSeDeUPQvaZ4naqJgMKcMZogCtRDLycd4j8,50714
69
70
  langroid/language_models/prompt_formatter/__init__.py,sha256=2-5cdE24XoFDhifOLl8yiscohil1ogbP1ECkYdBlBsk,372
70
71
  langroid/language_models/prompt_formatter/base.py,sha256=eDS1sgRNZVnoajwV_ZIha6cba5Dt8xjgzdRbPITwx3Q,1221
71
72
  langroid/language_models/prompt_formatter/hf_formatter.py,sha256=TFL6ppmeQWnzr6CKQzRZFYY810zE1mr8DZnhw6i85ok,5217
72
73
  langroid/language_models/prompt_formatter/llama2_formatter.py,sha256=YdcO88qyBeuMENVIVvVqSYuEpvYSTndUe_jd6hVTko4,2899
73
- langroid/language_models/utils.py,sha256=j8xEEm__-2b9eql1oTiWQk5dHW59UwmrRKs5kMHaGGo,4803
74
- langroid/mytypes.py,sha256=B5uKN4FMdHiJaAKozg8EmcPfle3sHlj11NcBnpXn7nE,3057
74
+ langroid/language_models/utils.py,sha256=o6Zo2cnnvKrfSgF26knVQ1xkSxEoE7yN85296gNdVOw,4858
75
+ langroid/mytypes.py,sha256=YjlunP4n_-J3wDNQM4MBtLyOuaa1qJJpwzVfvn0Ca1A,2206
75
76
  langroid/parsing/__init__.py,sha256=ZgSAfgTC6VsTLFlRSWT-TwYco7SQeRMeZG-49MnKYGY,936
76
77
  langroid/parsing/agent_chats.py,sha256=sbZRV9ujdM5QXvvuHVjIi2ysYSYlap-uqfMMUKulrW0,1068
77
78
  langroid/parsing/code-parsing.md,sha256=--cyyNiSZSDlIwcjAV4-shKrSiRe2ytF3AdSoS_hD2g,3294
78
79
  langroid/parsing/code_parser.py,sha256=Fwa8MWY5EGk7Ekr8II5c-o9vBf4m1HfB5_K7e_EDYzo,3739
79
80
  langroid/parsing/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
- langroid/parsing/document_parser.py,sha256=bN-D1kqx6qe1Sx-AMR8a8WbPJYPdoxLYPdgGl7dfW3I,24017
81
+ langroid/parsing/document_parser.py,sha256=WGnA5ADwMHliGJt6WW9rc4RiFXQcKU33b5zdPiGrtEY,24265
81
82
  langroid/parsing/image_text.py,sha256=sbLIQ5nHe2UnYUksBaQsmZGaX-X0qgEpPd7CEzi_z5M,910
82
83
  langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
83
84
  langroid/parsing/parse_json.py,sha256=tgB_oatcrgt6L9ZplC-xBBXjLzL1gjSQf1L2_W5kwFA,4230
84
- langroid/parsing/parser.py,sha256=VU3G2GXwho5vJ3tCDgw6_1W-guqAbPtml8RcJxvp-Xs,10755
85
+ langroid/parsing/parser.py,sha256=AgtmlVUvrkSG1l7-YZPX8rlldgXjh_HqXAMqpXkBxUo,11746
85
86
  langroid/parsing/repo_loader.py,sha256=3GjvPJS6Vf5L6gV2zOU8s-Tf1oq_fZm-IB_RL_7CTsY,29373
86
87
  langroid/parsing/routing.py,sha256=_NFPe7wLjd5B6s47w3M8-5vldL8e2Sz51Gb5bwF5ooY,1072
87
88
  langroid/parsing/search.py,sha256=plQtjarB9afGfJLB0CyPXPq3mM4m7kRsfd0_4brziEI,8846
@@ -99,7 +100,7 @@ langroid/prompts/prompts_config.py,sha256=p_lp9nbMuQwhhMwAZsOxveRw9C0ZFZvql7pdIf
99
100
  langroid/prompts/templates.py,sha256=kz0rPiM6iLGhhpDonF3Y87OznSe9FRI6A0pHU0wgW4Q,6314
100
101
  langroid/pydantic_v1/__init__.py,sha256=HxPGVERapVueRUORgSpj2JX_vTZxVlVbWvhpQlpjygE,283
101
102
  langroid/pydantic_v1/main.py,sha256=p_k7kDY9eDrsA5dxNNqXusKLgx7mS_icGnS7fu4goqY,147
102
- langroid/utils/__init__.py,sha256=ARx5To4Hsv1K5QAzK4uUqdEoB_iq5HK797vae1AcMBI,300
103
+ langroid/utils/__init__.py,sha256=Sruos2tB4G7Tn0vlblvYlX9PEGR0plI2uE0PJ4d_EC4,353
103
104
  langroid/utils/algorithms/__init__.py,sha256=WylYoZymA0fnzpB4vrsH_0n7WsoLhmuZq8qxsOCjUpM,41
104
105
  langroid/utils/algorithms/graph.py,sha256=JbdpPnUOhw4-D6O7ou101JLA3xPCD0Lr3qaPoFCaRfo,2866
105
106
  langroid/utils/configuration.py,sha256=A70LdvdMuunlLSGI1gBmBL5j6Jhz-1syNP8R4AdjqDc,3295
@@ -109,25 +110,26 @@ langroid/utils/globals.py,sha256=Az9dOFqR6n9CoTYSqa2kLikQWS0oCQ9DFQIQAnG-2q8,135
109
110
  langroid/utils/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
110
111
  langroid/utils/llms/strings.py,sha256=CSAX9Z6FQOLXOzbLMe_Opqtc3ruDAKTTk7cPqc6Blh0,263
111
112
  langroid/utils/logging.py,sha256=WN180zjxhlozwtyTcLWmbVkXylBs5EvQj85dBPeVUwc,3985
113
+ langroid/utils/object_registry.py,sha256=iPz9GHzvmCeVoidB3JdAMEKcxJEqTdUr0otQEexDZ5s,2100
112
114
  langroid/utils/output/__init__.py,sha256=7P0f--4IZneNsTxXY5fd6d6iW-CeVe-KSsl-87sbBPc,340
113
115
  langroid/utils/output/citations.py,sha256=PSY2cpti8W-ZGFMAgj1lYoEIZy0lsniLpCliMsVkXtc,1425
114
116
  langroid/utils/output/printing.py,sha256=yzPJZN-8_jyOJmI9N_oLwEDfjMwVgk3IDiwnZ4eK_AE,2962
115
117
  langroid/utils/output/status.py,sha256=rzbE7mDJcgNNvdtylCseQcPGCGghtJvVq3lB-OPJ49E,1049
116
118
  langroid/utils/pandas_utils.py,sha256=UctS986Jtl_MvU5rA7-GfrjEHXP7MNu8ePhepv0bTn0,755
117
119
  langroid/utils/pydantic_utils.py,sha256=FKC8VKXH2uBEpFjnnMgIcEsQn6hs31ftea8zv5pMK9g,21740
118
- langroid/utils/system.py,sha256=ClIQOpJOeCgfi9n5c-bOS62B2cuqrZFGkWPRbjCpSqk,5208
120
+ langroid/utils/system.py,sha256=nvKeeUAj4eviR4kYpcr9h-HYdhqUNMTRBTHBOhz0GdU,5182
119
121
  langroid/utils/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
120
122
  langroid/utils/web/login.py,sha256=1iz9eUAHa87vpKIkzwkmFa00avwFWivDSAr7QUhK7U0,2528
121
123
  langroid/vector_store/__init__.py,sha256=6xBjb_z4QtUy4vz4RuFbcbSwmHrggHL8-q0DwCf3PMM,972
122
- langroid/vector_store/base.py,sha256=1bzFEDJcbKIaZnTPhBjnQ260c6QYs5SpZwGMtwt0-6Y,13481
124
+ langroid/vector_store/base.py,sha256=tuEPaxJcuU_39sRnUjjNd8D8n8IjP6jrbwQv_ecNpSw,13532
123
125
  langroid/vector_store/chromadb.py,sha256=bZ5HjwgKgfJj1PUHsatYsrHv-v0dpOfMR2l0tJ2H0_A,7890
124
126
  langroid/vector_store/lancedb.py,sha256=9x7e_5zo7nLhMbhjYby2ZpBJ-vyawcC0_XAuatfHJf8,20517
125
127
  langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3HmhHQICXLs,11663
126
128
  langroid/vector_store/momento.py,sha256=QaPzUnTwlswoawGB-paLtUPyLRvckFXLfLDfvbTzjNQ,10505
127
129
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
128
130
  langroid/vector_store/qdrantdb.py,sha256=wYOuu5c2vIKn9ZgvTXcAiZXMpV8AOXEWFAzI8S8UP-0,16828
129
- pyproject.toml,sha256=zJRntm67SKuTYmuGM9SuBHq3t8_YCES7QJZrUnOBhEs,6966
130
- langroid-0.1.265.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
131
- langroid-0.1.265.dist-info/METADATA,sha256=k8pBX7RAwBzJqfOxHE0HOezRNV1HGgxhRFEu9r9BpWQ,52514
132
- langroid-0.1.265.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
133
- langroid-0.1.265.dist-info/RECORD,,
131
+ pyproject.toml,sha256=dZYHxf2D_qc8g68xt4KgMoa7tuxbY_JpLn-Pd541kuw,6964
132
+ langroid-0.2.0.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
133
+ langroid-0.2.0.dist-info/METADATA,sha256=vcctmhiBgiBI4LlzmbJFMfRG7nwjD4B1IZvnDu0XR_M,52823
134
+ langroid-0.2.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
135
+ langroid-0.2.0.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.1.265"
3
+ version = "0.2.0"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"
@@ -1,3 +0,0 @@
1
- import openai
2
-
3
- openai.models.list()