langroid 0.53.1__py3-none-any.whl → 0.53.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.
@@ -134,6 +134,24 @@ class FastMCPClient:
134
134
  camel_case = "".join(part.capitalize() for part in parts)
135
135
  model_name = f"{camel_case}Tool"
136
136
 
137
+ from langroid.agent.tool_message import ToolMessage as _BaseToolMessage
138
+
139
+ # IMPORTANT: Avoid clashes with reserved field names in Langroid ToolMessage!
140
+ # First figure out which field names are reserved
141
+ reserved = set(_BaseToolMessage.__annotations__.keys())
142
+ reserved.update(["recipient", "_handler"])
143
+ renamed: Dict[str, str] = {}
144
+ new_fields: Dict[str, Tuple[type, Any]] = {}
145
+ for fname, (ftype, fld) in fields.items():
146
+ if fname in reserved:
147
+ new_name = fname + "__"
148
+ renamed[fname] = new_name
149
+ new_fields[new_name] = (ftype, fld)
150
+ else:
151
+ new_fields[fname] = (ftype, fld)
152
+ # now replace fields with our renamed‐aware mapping
153
+ fields = new_fields
154
+
137
155
  # create Langroid ToolMessage subclass, with expected fields.
138
156
  tool_model = cast(
139
157
  Type[ToolMessage],
@@ -146,6 +164,7 @@ class FastMCPClient:
146
164
  ),
147
165
  )
148
166
  tool_model._server = self.server # type: ignore[attr-defined]
167
+ tool_model._renamed_fields = renamed # type: ignore[attr-defined]
149
168
 
150
169
  # 2) define an arg-free call_tool_async()
151
170
  async def call_tool_async(self: ToolMessage) -> Any:
@@ -153,6 +172,12 @@ class FastMCPClient:
153
172
 
154
173
  # pack up the payload
155
174
  payload = self.dict(exclude=self.Config.schema_extra["exclude"])
175
+
176
+ # restore any renamed fields
177
+ for orig, new in self.__class__._renamed_fields.items(): # type: ignore
178
+ if new in payload:
179
+ payload[orig] = payload.pop(new)
180
+
156
181
  # open a fresh client, call the tool, then close
157
182
  async with FastMCPClient(self.__class__._server) as client: # type: ignore
158
183
  return await client.call_mcp_tool(self.request, payload)
@@ -185,7 +210,8 @@ class FastMCPClient:
185
210
 
186
211
  async def get_mcp_tool_async(self, name: str) -> Optional[Tool]:
187
212
  """Find the "original" MCP Tool (i.e. of type mcp.types.Tool) on the server
188
- matching `name`, or None if missing.
213
+ matching `name`, or None if missing. This contains the metadata for the tool:
214
+ name, description, inputSchema, etc.
189
215
 
190
216
  Args:
191
217
  name: Name of the tool to look up.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.53.1
3
+ Version: 0.53.2
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -338,6 +338,22 @@ teacher_task.run()
338
338
  <details>
339
339
  <summary> <b>Click to expand</b></summary>
340
340
 
341
+ - **Mar-Apr 2025:**
342
+ - [0.53.0](https://github.com/langroid/langroid/releases/tag/0.53.0) MCP Tools Support.
343
+ - [0.52.0](https://github.com/langroid/langroid/releases/tag/0.52.0) Multimodal support, i.e. allow PDF, image
344
+ inputs to LLM.
345
+ - [0.51.0](https://github.com/langroid/langroid/releases/tag/0.51.0) `LLMPdfParser`, generalizing
346
+ `GeminiPdfParser` to parse documents directly with LLM.
347
+ - [0.50.0](https://github.com/langroid/langroid/releases/tag/0.50.0) Structure-aware Markdown chunking with chunks
348
+ enriched by section headers.
349
+ - [0.49.0](https://github.com/langroid/langroid/releases/tag/0.49.0) Enable easy switch to LiteLLM Proxy-server
350
+ - [0.48.0](https://github.com/langroid/langroid/releases/tag/0.48.0) Exa Crawler, Markitdown Parser
351
+ - [0.47.0](https://github.com/langroid/langroid/releases/tag/0.47.0) Support Firecrawl URL scraper/crawler -
352
+ thanks @abab-dev
353
+ - [0.46.0](https://github.com/langroid/langroid/releases/tag/0.46.0) Support LangDB LLM Gateway - thanks @MrunmayS.
354
+ - [0.45.0](https://github.com/langroid/langroid/releases/tag/0.45.0) Markdown parsing with `Marker` - thanks @abab-dev
355
+ - [0.44.0](https://github.com/langroid/langroid/releases/tag/0.44.0) Late imports to reduce startup time. Thanks
356
+ @abab-dev
341
357
  - **Feb 2025:**
342
358
  - [0.43.0](https://github.com/langroid/langroid/releases/tag/0.43.0): `GeminiPdfParser` for parsing PDF using
343
359
  Gemini LLMs - Thanks @abab-dev.
@@ -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=cQb3gYxXk0YZ23QCqbVNMbMeCeWCJj6w3gqGnvyqv7w,459
58
58
  langroid/agent/tools/mcp/decorators.py,sha256=mWnlTjyI9PMNi750PWzC_2B6V5K_XdxH0Co9kE2yAj0,1145
59
- langroid/agent/tools/mcp/fastmcp_client.py,sha256=KUe73yqyKMTT7PxZfUaC0x23aRai0O09bbuyhHZfVo0,10630
59
+ langroid/agent/tools/mcp/fastmcp_client.py,sha256=ffOV0lJOtE3DLfA6y3Fib28jyACySJPgbqjNJpSAEQA,11815
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
@@ -132,7 +132,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
132
132
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
133
133
  langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
134
134
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
135
- langroid-0.53.1.dist-info/METADATA,sha256=A36mOdb9KvdWGTTWAxCzr0jLyLU4IGoXUk8bO7CmCnc,63549
136
- langroid-0.53.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
137
- langroid-0.53.1.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
138
- langroid-0.53.1.dist-info/RECORD,,
135
+ langroid-0.53.2.dist-info/METADATA,sha256=t3on9Riu1tK0c1icC8e3mhsCFEjTU4a7SkMGI1kV4bY,64823
136
+ langroid-0.53.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
137
+ langroid-0.53.2.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
138
+ langroid-0.53.2.dist-info/RECORD,,