langroid 0.53.12__py3-none-any.whl → 0.53.14__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/base.py +4 -0
- langroid/agent/batch.py +15 -0
- langroid/agent/callbacks/chainlit.py +6 -1
- langroid/agent/tools/mcp/fastmcp_client.py +1 -1
- langroid/utils/logging.py +12 -2
- {langroid-0.53.12.dist-info → langroid-0.53.14.dist-info}/METADATA +1 -1
- {langroid-0.53.12.dist-info → langroid-0.53.14.dist-info}/RECORD +9 -9
- {langroid-0.53.12.dist-info → langroid-0.53.14.dist-info}/WHEEL +0 -0
- {langroid-0.53.12.dist-info → langroid-0.53.14.dist-info}/licenses/LICENSE +0 -0
langroid/agent/base.py
CHANGED
@@ -503,6 +503,10 @@ class Agent(ABC):
|
|
503
503
|
self.callbacks.show_agent_response(
|
504
504
|
content=results_str,
|
505
505
|
language="json" if maybe_json else "text",
|
506
|
+
is_tool=(
|
507
|
+
isinstance(results, ChatDocument)
|
508
|
+
and self.has_tool_message_attempt(results)
|
509
|
+
),
|
506
510
|
)
|
507
511
|
if isinstance(results, ChatDocument):
|
508
512
|
# Preserve trail of tool_ids for OpenAI Assistant fn-calls
|
langroid/agent/batch.py
CHANGED
@@ -334,6 +334,21 @@ def run_batch_task_gen(
|
|
334
334
|
task_i.kill()
|
335
335
|
# exception will be handled by the caller
|
336
336
|
raise e
|
337
|
+
# ----------------------------------------
|
338
|
+
# Propagate any exception stored on the task that may have been
|
339
|
+
# swallowed inside `Task.run_async`, so that the upper-level
|
340
|
+
# exception-handling logic works as expected.
|
341
|
+
for attr in ("_exception", "last_exception", "exception"):
|
342
|
+
exc = getattr(task_i, attr, None)
|
343
|
+
if isinstance(exc, BaseException):
|
344
|
+
raise exc
|
345
|
+
# Fallback: treat a KILL-status result as an error
|
346
|
+
if (
|
347
|
+
isinstance(result, ChatDocument)
|
348
|
+
and getattr(result, "status", None) is not None
|
349
|
+
and str(getattr(result, "status")) == "StatusCode.KILL"
|
350
|
+
):
|
351
|
+
raise RuntimeError(str(result.content))
|
337
352
|
return result
|
338
353
|
|
339
354
|
return run_batched_tasks(
|
@@ -410,7 +410,12 @@ class ChainlitAgentCallbacks:
|
|
410
410
|
self.last_step = step
|
411
411
|
run_sync(step.send())
|
412
412
|
|
413
|
-
def show_agent_response(
|
413
|
+
def show_agent_response(
|
414
|
+
self,
|
415
|
+
content: str,
|
416
|
+
language="text",
|
417
|
+
is_tool: bool = False,
|
418
|
+
) -> None:
|
414
419
|
"""Show message from agent (typically tool handler)."""
|
415
420
|
if language == "text":
|
416
421
|
content = wrap_text_preserving_structure(content, width=90)
|
@@ -68,7 +68,7 @@ class FastMCPClient:
|
|
68
68
|
roots=self.roots,
|
69
69
|
log_handler=self.log_handler,
|
70
70
|
message_handler=self.message_handler,
|
71
|
-
|
71
|
+
timeout=self.read_timeout_seconds,
|
72
72
|
)
|
73
73
|
# actually enter it (opens the session)
|
74
74
|
self.client = await self._cm.__aenter__() # type: ignore
|
langroid/utils/logging.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import os
|
3
3
|
import os.path
|
4
|
+
import sys
|
4
5
|
import threading
|
5
6
|
from typing import ClassVar, Dict, no_type_check
|
6
7
|
|
@@ -163,7 +164,16 @@ class RichFileLogger:
|
|
163
164
|
|
164
165
|
os.makedirs(os.path.dirname(log_file), exist_ok=True)
|
165
166
|
mode = "a" if append else "w"
|
166
|
-
self.
|
167
|
+
self._owns_file: bool = True
|
168
|
+
try:
|
169
|
+
self.file = open(log_file, mode, buffering=1, encoding="utf-8")
|
170
|
+
except OSError as exc: # EMFILE: too many open files
|
171
|
+
if exc.errno == 24:
|
172
|
+
# Fallback: reuse an already-open stream to avoid creating a new FD
|
173
|
+
self.file = sys.stderr
|
174
|
+
self._owns_file = False
|
175
|
+
else:
|
176
|
+
raise
|
167
177
|
self.log_file: str = log_file
|
168
178
|
self.color: bool = color
|
169
179
|
self.console: Console | None = (
|
@@ -195,7 +205,7 @@ class RichFileLogger:
|
|
195
205
|
self._ref_counts.pop(self.log_file, None)
|
196
206
|
self._instances.pop(self.log_file, None)
|
197
207
|
with self._write_lock:
|
198
|
-
if not self.file.closed:
|
208
|
+
if self._owns_file and not self.file.closed:
|
199
209
|
self.file.close()
|
200
210
|
else:
|
201
211
|
self._ref_counts[self.log_file] = count
|
@@ -3,8 +3,8 @@ langroid/exceptions.py,sha256=OPjece_8cwg94DLPcOGA1ddzy5bGh65pxzcHMnssTz8,2995
|
|
3
3
|
langroid/mytypes.py,sha256=HIcYAqGeA9OK0Hlscym2FI5Oax9QFljDZoVgRlomhRk,4014
|
4
4
|
langroid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
|
6
|
-
langroid/agent/base.py,sha256=
|
7
|
-
langroid/agent/batch.py,sha256=
|
6
|
+
langroid/agent/base.py,sha256=9ZA2PhluFXReeqtGr7mdOUZZ7AXX6Eg_YymzdniUB-E,80181
|
7
|
+
langroid/agent/batch.py,sha256=wpE9RqCNDVDhAXkCB7wEqfCIEAi6qKcrhaZ-Zr9T4C0,21375
|
8
8
|
langroid/agent/chat_agent.py,sha256=2HIYzYxkrGkRIS97ioKfIqjaW3RbX89M39LjzBobBEY,88381
|
9
9
|
langroid/agent/chat_document.py,sha256=6O20Fp4QrquykaF2jFtwNHkvcoDte1LLwVZNk9mVH9c,18057
|
10
10
|
langroid/agent/openai_assistant.py,sha256=JkAcs02bIrgPNVvUWVR06VCthc5-ulla2QMBzux_q6o,34340
|
@@ -12,7 +12,7 @@ langroid/agent/task.py,sha256=dJ2nRKc9-ulZyzNaABMKb9PKJzWRdZTonH9TPswpdbc,90801
|
|
12
12
|
langroid/agent/tool_message.py,sha256=BhjP-_TfQ2tgxuY4Yo_JHLOwwt0mJ4BwjPnREvEY4vk,14744
|
13
13
|
langroid/agent/xml_tool_message.py,sha256=oeBKnJNoGaKdtz39XoWGMTNlVyXew2MWH5lgtYeh8wQ,15496
|
14
14
|
langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
|
-
langroid/agent/callbacks/chainlit.py,sha256=
|
15
|
+
langroid/agent/callbacks/chainlit.py,sha256=4rJw07NIIVTIVvksVY08h5PdLE_kRoJItjbQM0UjRn0,20962
|
16
16
|
langroid/agent/special/__init__.py,sha256=gik_Xtm_zV7U9s30Mn8UX3Gyuy4jTjQe9zjiE3HWmEo,1273
|
17
17
|
langroid/agent/special/doc_chat_agent.py,sha256=7PvVKHrXHw2LoSgU2-3hE7mz46r5oKB3o_bFhWmfT_I,65642
|
18
18
|
langroid/agent/special/doc_chat_task.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -56,7 +56,7 @@ langroid/agent/tools/segment_extract_tool.py,sha256=__srZ_VGYLVOdPrITUM8S0HpmX4q
|
|
56
56
|
langroid/agent/tools/tavily_search_tool.py,sha256=soI-j0HdgVQLf09wRQScaEK4b5RpAX9C4cwOivRFWWI,1903
|
57
57
|
langroid/agent/tools/mcp/__init__.py,sha256=DJNM0VeFnFS3pJKCyFGggT8JVjVu0rBzrGzasT1HaSM,387
|
58
58
|
langroid/agent/tools/mcp/decorators.py,sha256=h7dterhsmvWJ8q4mp_OopmuG2DF71ty8cZwOyzdDZuk,1127
|
59
|
-
langroid/agent/tools/mcp/fastmcp_client.py,sha256=
|
59
|
+
langroid/agent/tools/mcp/fastmcp_client.py,sha256=0ohGFa47ZqMEFR0QNJbIgHC0M6WeWm-lepkW8S8oMQk,17440
|
60
60
|
langroid/cachedb/__init__.py,sha256=G2KyNnk3Qkhv7OKyxTOnpsxfDycx3NY0O_wXkJlalNY,96
|
61
61
|
langroid/cachedb/base.py,sha256=ztVjB1DtN6pLCujCWnR6xruHxwVj3XkYniRTYAKKqk0,1354
|
62
62
|
langroid/cachedb/redis_cachedb.py,sha256=7kgnbf4b5CKsCrlL97mHWKvdvlLt8zgn7lc528jEpiE,5141
|
@@ -112,7 +112,7 @@ langroid/utils/configuration.py,sha256=ZkHHkEeWuS-o3_S4g0SE0wz-UK_of23NOWve1kpQi
|
|
112
112
|
langroid/utils/constants.py,sha256=CK09kda9bNDEhnwClq7ZTWZOh38guJlfcZ5hKUS1Ijo,1075
|
113
113
|
langroid/utils/git_utils.py,sha256=WnflJ3R3owhlD0LNdSJakcKhExcEehE1UW5jYVQl8JY,7955
|
114
114
|
langroid/utils/globals.py,sha256=Az9dOFqR6n9CoTYSqa2kLikQWS0oCQ9DFQIQAnG-2q8,1355
|
115
|
-
langroid/utils/logging.py,sha256=
|
115
|
+
langroid/utils/logging.py,sha256=kmdpj1ozH1apf3o00Zgz-ZT-S4BHqUfF81GkY0Gf578,7262
|
116
116
|
langroid/utils/object_registry.py,sha256=iPz9GHzvmCeVoidB3JdAMEKcxJEqTdUr0otQEexDZ5s,2100
|
117
117
|
langroid/utils/pandas_utils.py,sha256=UctS986Jtl_MvU5rA7-GfrjEHXP7MNu8ePhepv0bTn0,755
|
118
118
|
langroid/utils/pydantic_utils.py,sha256=R7Ps8VP56-eSo-LYHWllFo-SJ2zDmdItuuYpUq2gGJ8,20854
|
@@ -133,7 +133,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
|
|
133
133
|
langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
|
134
134
|
langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
|
135
135
|
langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
|
136
|
-
langroid-0.53.
|
137
|
-
langroid-0.53.
|
138
|
-
langroid-0.53.
|
139
|
-
langroid-0.53.
|
136
|
+
langroid-0.53.14.dist-info/METADATA,sha256=yo2Whf1Lk_qxKbRRe0uTxO-QiLTlkd7MYQBusvZilbw,64946
|
137
|
+
langroid-0.53.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
138
|
+
langroid-0.53.14.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
139
|
+
langroid-0.53.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|