langroid 0.22.5__py3-none-any.whl → 0.22.6__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.
@@ -362,6 +362,17 @@ class SQLChatAgent(ChatAgent):
362
362
 
363
363
  return error_message_template
364
364
 
365
+ def _available_tool_names(self) -> str:
366
+ return ",".join(
367
+ tool.name() # type: ignore
368
+ for tool in [
369
+ RunQueryTool,
370
+ GetTableNamesTool,
371
+ GetTableSchemaTool,
372
+ GetColumnDescriptionsTool,
373
+ ]
374
+ )
375
+
365
376
  def run_query(self, msg: RunQueryTool) -> str:
366
377
  """
367
378
  Handle a RunQueryTool message by executing a SQL query and returning the result.
@@ -399,7 +410,20 @@ class SQLChatAgent(ChatAgent):
399
410
  finally:
400
411
  session.close()
401
412
 
402
- return response_message
413
+ final_message = f"""
414
+ Below is the result from your use of the TOOL `{RunQueryTool.name()}`:
415
+ ==== result ====
416
+ {response_message}
417
+ ================
418
+
419
+ If you are READY to ANSWER the ORIGINAL QUERY:
420
+ use the `{DoneTool.name()}` tool to send the result to the user,
421
+ with the `content` set to the answer or result
422
+ OTHERWISE:
423
+ continue using one of your available TOOLs:
424
+ {self._available_tool_names()}
425
+ """
426
+ return final_message
403
427
 
404
428
  def _format_rows(self, rows: Sequence[Row[Any]]) -> str:
405
429
  """
@@ -1,4 +1,4 @@
1
- from typing import List
1
+ from typing import List, Tuple
2
2
 
3
3
  from langroid.agent.tool_message import ToolMessage
4
4
 
@@ -11,6 +11,20 @@ class RunQueryTool(ToolMessage):
11
11
  """
12
12
  query: str
13
13
 
14
+ @classmethod
15
+ def examples(cls) -> List["ToolMessage" | Tuple[str, "ToolMessage"]]:
16
+ return [
17
+ cls(
18
+ query="SELECT * FROM movies WHERE genre = 'comedy'",
19
+ ),
20
+ (
21
+ "Find all movies with a rating of 5",
22
+ cls(
23
+ query="SELECT * FROM movies WHERE rating = 5",
24
+ ),
25
+ ),
26
+ ]
27
+
14
28
 
15
29
  class GetTableNamesTool(ToolMessage):
16
30
  request: str = "get_table_names"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.22.5
3
+ Version: 0.22.6
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -30,12 +30,12 @@ langroid/agent/special/neo4j/tools.py,sha256=Vw3HvtDfG2c4_bUHgt4_ZbJq48lpIQstbjj
30
30
  langroid/agent/special/relevance_extractor_agent.py,sha256=zIx8GUdVo1aGW6ASla0NPQjYYIpmriK_TYMijqAx3F8,4796
31
31
  langroid/agent/special/retriever_agent.py,sha256=lvMvf-u9rSosg4YASuFdUbGLgkzLPknXAbJZfZ1LZCc,1868
32
32
  langroid/agent/special/sql/__init__.py,sha256=mWfmm1QpXCezpFOS2eI57M0L_Ok3q5_ukG8tXBnBrEA,319
33
- langroid/agent/special/sql/sql_chat_agent.py,sha256=j8m1Lm8j_w3m3gzPjuC2vea_t_bfhNewCfDnPDzrc38,17191
33
+ langroid/agent/special/sql/sql_chat_agent.py,sha256=bh7UCFltngrQxsjH5PKM7JECjA6tMnntKOlUcjEmnT8,18011
34
34
  langroid/agent/special/sql/utils/__init__.py,sha256=JFif6CRTrN-bc91uuAI4K9fe2ndIWSNMVxJ0WA68--M,446
35
35
  langroid/agent/special/sql/utils/description_extractors.py,sha256=cX8TIpmTPXZXQTMpIi3OUFwFsPywxFFdurpx717Kq0I,6529
36
36
  langroid/agent/special/sql/utils/populate_metadata.py,sha256=1J22UsyEPKzwK0XlJZtYn9r6kYc0FXIr8-lZrndYlhc,3131
37
37
  langroid/agent/special/sql/utils/system_message.py,sha256=qKLHkvQWRQodTtPLPxr1GSLUYUFASZU8x-ybV67cB68,1885
38
- langroid/agent/special/sql/utils/tools.py,sha256=vFYysk6Vi7HJjII8B4RitA3pt_z3gkSglDNdhNVMiFc,1332
38
+ langroid/agent/special/sql/utils/tools.py,sha256=ovCePzq5cmbqw0vsVPBzxdZpUcSUIfTiDSMGXustZW8,1749
39
39
  langroid/agent/special/table_chat_agent.py,sha256=d9v2wsblaRx7oMnKhLV7uO_ujvk9gh59pSGvBXyeyNc,9659
40
40
  langroid/agent/structured_message.py,sha256=y7pud1EgRNeTFZlJmBkLmwME3yQJ_IYik-Xds9kdZbY,282
41
41
  langroid/agent/task.py,sha256=BdLNWFQqA9X-9ZtUIC2NwmRrPAX7GB0mAC0aXDzK0Uk,86877
@@ -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=m9VWz7kgw5OWUlJj_B-LP9ov67jCSioaLfCLTVdi-jg,7488
146
- langroid-0.22.5.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
147
- langroid-0.22.5.dist-info/METADATA,sha256=B7F4ITogUktXDfPGpjQB1RDNe2TV1se5JF321Jc2tNY,57107
148
- langroid-0.22.5.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
149
- langroid-0.22.5.dist-info/RECORD,,
145
+ pyproject.toml,sha256=iOYeCZhSZb6evu9r2X8g7nY_Q0m9PqX1Q-upDqifwek,7488
146
+ langroid-0.22.6.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
147
+ langroid-0.22.6.dist-info/METADATA,sha256=k9lDoCXrj1a8oEaphDoEeVfqf-2b2MkgNaY71axEE4w,57107
148
+ langroid-0.22.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
149
+ langroid-0.22.6.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.22.5"
3
+ version = "0.22.6"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"