langroid 0.26.0__py3-none-any.whl → 0.26.1__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 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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.26.0
3
+ Version: 0.26.1
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.5.0,<0.6.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,7 +1,7 @@
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=QZdlt1563hx4l3AXrCaGovE-PNG93M3DsvQAbDzdiS8,13705
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
7
  langroid/agent/chat_agent.py,sha256=jZaeMOQsGZlrnWj7RBT7RR17Bd0zR9H4D6n_F4rPUn0,79517
@@ -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=hm5QzEMcabDq_y8pe7dEvEfkVvJQe6Bx7qVdtB1A8ro,7495
146
- langroid-0.26.0.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
147
- langroid-0.26.0.dist-info/METADATA,sha256=E7vU0iufbOSBvgaDtCUEUgEquSch0eMfWsYyXtTJIE0,57519
148
- langroid-0.26.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
149
- langroid-0.26.0.dist-info/RECORD,,
145
+ pyproject.toml,sha256=eBqM11UEFyExp9V3T3mzm3ecLHYfwjlcMZ_p9iihz8I,7496
146
+ langroid-0.26.1.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
147
+ langroid-0.26.1.dist-info/METADATA,sha256=MA5FyOkURNni69GpGG3yEHoUufurJh4pwtENzET6WsI,57521
148
+ langroid-0.26.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
149
+ langroid-0.26.1.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.26.0"
3
+ version = "0.26.1"
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.5.0"
85
+ groq = "^0.13.0"
86
86
  nest-asyncio = "^1.6.0"
87
87
  async-generator = "^1.10"
88
88