langroid 0.26.0__py3-none-any.whl → 0.26.2__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.
- langroid/agent/batch.py +33 -0
- langroid/agent/chat_agent.py +2 -0
- langroid/parsing/document_parser.py +7 -1
- {langroid-0.26.0.dist-info → langroid-0.26.2.dist-info}/METADATA +2 -2
- {langroid-0.26.0.dist-info → langroid-0.26.2.dist-info}/RECORD +8 -8
- pyproject.toml +2 -2
- {langroid-0.26.0.dist-info → langroid-0.26.2.dist-info}/LICENSE +0 -0
- {langroid-0.26.0.dist-info → langroid-0.26.2.dist-info}/WHEEL +0 -0
langroid/agent/batch.py
CHANGED
@@ -363,3 +363,36 @@ def agent_response_batch(
|
|
363
363
|
sequential=sequential,
|
364
364
|
stop_on_first_result=stop_on_first_result,
|
365
365
|
)
|
366
|
+
|
367
|
+
|
368
|
+
def run_batch_function(
|
369
|
+
function: Callable[[T], U],
|
370
|
+
items: list[T],
|
371
|
+
sequential: bool = True,
|
372
|
+
batch_size: Optional[int] = None,
|
373
|
+
) -> List[U]:
|
374
|
+
async def _do_task(item: T) -> U:
|
375
|
+
return function(item)
|
376
|
+
|
377
|
+
async def _do_all(items: Iterable[T]) -> List[U]:
|
378
|
+
if sequential:
|
379
|
+
results = []
|
380
|
+
for item in items:
|
381
|
+
result = await _do_task(item)
|
382
|
+
results.append(result)
|
383
|
+
return results
|
384
|
+
|
385
|
+
return await asyncio.gather(*(_do_task(item) for item in items))
|
386
|
+
|
387
|
+
results: List[U] = []
|
388
|
+
|
389
|
+
if batch_size is None:
|
390
|
+
with status(f"[bold green]Running {len(items)} tasks:"):
|
391
|
+
results = asyncio.run(_do_all(items))
|
392
|
+
else:
|
393
|
+
batches = batched(items, batch_size)
|
394
|
+
for batch in batches:
|
395
|
+
with status(f"[bold green]Running batch of {len(batch)} tasks:"):
|
396
|
+
results.extend(asyncio.run(_do_all(batch)))
|
397
|
+
|
398
|
+
return results
|
langroid/agent/chat_agent.py
CHANGED
@@ -58,6 +58,8 @@ class ChatAgentConfig(AgentConfig):
|
|
58
58
|
the OpenAI tool-call API is used, rather than the older/deprecated
|
59
59
|
function-call API. However the tool-call API has some tricky aspects,
|
60
60
|
hence we set this to False by default.
|
61
|
+
strict_recovery: whether to enable strict schema recovery when there
|
62
|
+
is a tool-generation error.
|
61
63
|
enable_orchestration_tool_handling: whether to enable handling of orchestration
|
62
64
|
tools, e.g. ForwardTool, DoneTool, PassTool, etc.
|
63
65
|
output_format: When supported by the LLM (certain OpenAI LLMs
|
@@ -357,6 +357,7 @@ class DocumentParser(Parser):
|
|
357
357
|
docs: List[Document] = []
|
358
358
|
# metadata.id to be shared by ALL chunks of this document
|
359
359
|
common_id = ObjectRegistry.new_id()
|
360
|
+
n_chunks = 0 # how many chunk so far
|
360
361
|
for i, page in self.iterate_pages():
|
361
362
|
page_text = self.extract_text_from_page(page)
|
362
363
|
split += self.tokenizer.encode(page_text)
|
@@ -378,9 +379,14 @@ class DocumentParser(Parser):
|
|
378
379
|
),
|
379
380
|
)
|
380
381
|
)
|
382
|
+
n_chunks += 1
|
381
383
|
split = split[self.config.chunk_size - self.config.overlap :]
|
382
384
|
pages = [str(i + 1)]
|
383
|
-
|
385
|
+
# there may be a last split remaining:
|
386
|
+
# if it's shorter than the overlap, we shouldn't make a chunk for it
|
387
|
+
# since it's already included in the prior chunk;
|
388
|
+
# the only exception is if there have been no chunks so far.
|
389
|
+
if len(split) > self.config.overlap or n_chunks == 0:
|
384
390
|
pg = "-".join([pages[0], pages[-1]])
|
385
391
|
text = self.tokenizer.decode(split[: self.config.chunk_size])
|
386
392
|
docs.append(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: langroid
|
3
|
-
Version: 0.26.
|
3
|
+
Version: 0.26.2
|
4
4
|
Summary: Harness LLMs with Multi-Agent Programming
|
5
5
|
License: MIT
|
6
6
|
Author: Prasad Chalasani
|
@@ -54,7 +54,7 @@ Requires-Dist: fire (>=0.5.0,<0.6.0)
|
|
54
54
|
Requires-Dist: gitpython (>=3.1.43,<4.0.0)
|
55
55
|
Requires-Dist: google-api-python-client (>=2.95.0,<3.0.0)
|
56
56
|
Requires-Dist: google-generativeai (>=0.5.2,<0.6.0)
|
57
|
-
Requires-Dist: groq (>=0.
|
57
|
+
Requires-Dist: groq (>=0.13.0,<0.14.0)
|
58
58
|
Requires-Dist: grpcio (>=1.62.1,<2.0.0)
|
59
59
|
Requires-Dist: halo (>=0.0.31,<0.0.32)
|
60
60
|
Requires-Dist: huggingface-hub (>=0.21.2,<0.22.0) ; extra == "hf-transformers" or extra == "all" or extra == "transformers"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
langroid/__init__.py,sha256=z_fCOLQJPOw3LLRPBlFB5-2HyCjpPgQa4m4iY5Fvb8Y,1800
|
2
2
|
langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
|
3
3
|
langroid/agent/base.py,sha256=jAt7tbyPIWoGJDe6Xi75nthl-JY47yWB9Q5O1m9QJq0,76798
|
4
|
-
langroid/agent/batch.py,sha256=
|
4
|
+
langroid/agent/batch.py,sha256=qK3ph6VNj_1sOhfXCZY4r6gh035DglDKU751p8BU0tY,14665
|
5
5
|
langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
langroid/agent/callbacks/chainlit.py,sha256=C6zzzYC30qC4eMA7al7eFpRoTgoe3475kaMKyXgQM0Q,20695
|
7
|
-
langroid/agent/chat_agent.py,sha256=
|
7
|
+
langroid/agent/chat_agent.py,sha256=wqpcTO0H3ZcxlUFBN49t0jvBG17n6fWSxqtIfdqsT8o,79634
|
8
8
|
langroid/agent/chat_document.py,sha256=xPUMGzR83rn4iAEXIw2jy5LQ6YJ6Y0TiZ78XRQeDnJQ,17778
|
9
9
|
langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
|
@@ -87,7 +87,7 @@ langroid/parsing/agent_chats.py,sha256=sbZRV9ujdM5QXvvuHVjIi2ysYSYlap-uqfMMUKulr
|
|
87
87
|
langroid/parsing/code-parsing.md,sha256=--cyyNiSZSDlIwcjAV4-shKrSiRe2ytF3AdSoS_hD2g,3294
|
88
88
|
langroid/parsing/code_parser.py,sha256=AOxb3xbYpTBPP3goOm5dKfJdh5hS_2BhLVCEkifWZN8,3796
|
89
89
|
langroid/parsing/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
90
|
-
langroid/parsing/document_parser.py,sha256=
|
90
|
+
langroid/parsing/document_parser.py,sha256=9xUOyrVNBAS9cpCvCptr2XK4Kq47W574i8zzGEoXc3c,24933
|
91
91
|
langroid/parsing/image_text.py,sha256=sbLIQ5nHe2UnYUksBaQsmZGaX-X0qgEpPd7CEzi_z5M,910
|
92
92
|
langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
|
93
93
|
langroid/parsing/parse_json.py,sha256=aADo38bAHQhC8on4aWZZzVzSDy-dK35vRLZsFI2ewh8,4756
|
@@ -142,8 +142,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
|
|
142
142
|
langroid/vector_store/momento.py,sha256=qR-zBF1RKVHQZPZQYW_7g-XpTwr46p8HJuYPCkfJbM4,10534
|
143
143
|
langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
|
144
144
|
langroid/vector_store/qdrantdb.py,sha256=v88lqFkepADvlN6lByUj9I4NEKa9X9lWH16uTPPbYrE,17457
|
145
|
-
pyproject.toml,sha256=
|
146
|
-
langroid-0.26.
|
147
|
-
langroid-0.26.
|
148
|
-
langroid-0.26.
|
149
|
-
langroid-0.26.
|
145
|
+
pyproject.toml,sha256=_oWo5xkx_o4Kibt75oyNuMuhI6120ltehonplPVZsAY,7496
|
146
|
+
langroid-0.26.2.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
147
|
+
langroid-0.26.2.dist-info/METADATA,sha256=UVItMAVeO-IVh6M2CvoWlroa2fXGaE9Skmeh0nyOsB4,57521
|
148
|
+
langroid-0.26.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
149
|
+
langroid-0.26.2.dist-info/RECORD,,
|
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "langroid"
|
3
|
-
version = "0.26.
|
3
|
+
version = "0.26.2"
|
4
4
|
description = "Harness LLMs with Multi-Agent Programming"
|
5
5
|
authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
|
6
6
|
readme = "README.md"
|
@@ -82,7 +82,7 @@ grpcio = "^1.62.1"
|
|
82
82
|
duckduckgo-search = "^6.0.0"
|
83
83
|
|
84
84
|
google-generativeai = "^0.5.2"
|
85
|
-
groq = "^0.
|
85
|
+
groq = "^0.13.0"
|
86
86
|
nest-asyncio = "^1.6.0"
|
87
87
|
async-generator = "^1.10"
|
88
88
|
|
File without changes
|
File without changes
|