langroid 0.31.0__py3-none-any.whl → 0.31.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.
@@ -450,17 +450,23 @@ class ChatAgent(Agent):
450
450
  return ""
451
451
  instructions = []
452
452
  for msg_cls in enabled_classes:
453
- if (
454
- hasattr(msg_cls, "instructions")
455
- and inspect.ismethod(msg_cls.instructions)
456
- and msg_cls.default_value("request") in self.llm_tools_usable
457
- ):
453
+ if msg_cls.default_value("request") in self.llm_tools_usable:
454
+ class_instructions = ""
455
+ if hasattr(msg_cls, "instructions") and inspect.ismethod(
456
+ msg_cls.instructions
457
+ ):
458
+ class_instructions = msg_cls.instructions()
459
+ if (
460
+ self.config.use_tools
461
+ and hasattr(msg_cls, "langroid_tools_instructions")
462
+ and inspect.ismethod(msg_cls.langroid_tools_instructions)
463
+ ):
464
+ class_instructions += msg_cls.langroid_tools_instructions()
458
465
  # example will be shown in tool_format_rules() when using TOOLs,
459
466
  # so we don't need to show it here.
460
467
  example = "" if self.config.use_tools else (msg_cls.usage_examples())
461
468
  if example != "":
462
469
  example = "EXAMPLES:\n" + example
463
- class_instructions = msg_cls.instructions()
464
470
  guidance = (
465
471
  ""
466
472
  if class_instructions == ""
@@ -126,6 +126,18 @@ class ToolMessage(ABC, BaseModel):
126
126
 
127
127
  @classmethod
128
128
  def instructions(cls) -> str:
129
+ """
130
+ Instructions on tool usage.
131
+ """
132
+ return ""
133
+
134
+ @classmethod
135
+ def langroid_tools_instructions(cls) -> str:
136
+ """
137
+ Instructions on tool usage when `use_tools == True`, i.e.
138
+ when using langroid built-in tools
139
+ (as opposed to OpenAI-like function calls/tools).
140
+ """
129
141
  return """
130
142
  IMPORTANT: When using this or any other tool/function, you MUST include a
131
143
  `request` field and set it equal to the FUNCTION/TOOL NAME you intend to use.
@@ -1,7 +1,7 @@
1
1
  import atexit
2
2
  import os
3
3
  from functools import cached_property
4
- from typing import Any, Callable, Dict, List, Optional, Union
4
+ from typing import Any, Callable, Dict, List, Optional
5
5
 
6
6
  import requests
7
7
  import tiktoken
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langroid
3
- Version: 0.31.0
3
+ Version: 0.31.1
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  License: MIT
6
6
  Author: Prasad Chalasani
@@ -16,7 +16,7 @@ langroid/agent/base.py,sha256=ZgWsRBC9rugcWp9aZLAmFFteU47pqKIEoTy_dgkYtBI,77529
16
16
  langroid/agent/batch.py,sha256=qK3ph6VNj_1sOhfXCZY4r6gh035DglDKU751p8BU0tY,14665
17
17
  langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  langroid/agent/callbacks/chainlit.py,sha256=C6zzzYC30qC4eMA7al7eFpRoTgoe3475kaMKyXgQM0Q,20695
19
- langroid/agent/chat_agent.py,sha256=qPo-avgv4ng7f3vdU4kCbQHLtSTpT2U8XRZbmE0uVKo,79684
19
+ langroid/agent/chat_agent.py,sha256=Idts_HDO1tW052POVOQ9FvuU37TTB7c1I96YVbnBumo,80030
20
20
  langroid/agent/chat_document.py,sha256=xPUMGzR83rn4iAEXIw2jy5LQ6YJ6Y0TiZ78XRQeDnJQ,17778
21
21
  langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
@@ -51,7 +51,7 @@ langroid/agent/special/sql/utils/tools.py,sha256=ovCePzq5cmbqw0vsVPBzxdZpUcSUIfT
51
51
  langroid/agent/special/table_chat_agent.py,sha256=d9v2wsblaRx7oMnKhLV7uO_ujvk9gh59pSGvBXyeyNc,9659
52
52
  langroid/agent/structured_message.py,sha256=y7pud1EgRNeTFZlJmBkLmwME3yQJ_IYik-Xds9kdZbY,282
53
53
  langroid/agent/task.py,sha256=_iQTpjPIR1OGF0lq-ZFzQ92f_OmdIFmv7LlhoUA1QB8,89729
54
- langroid/agent/tool_message.py,sha256=aaJSypRy2sC8b2qOszc7efgr5TrQva51SUGnxTwKXEg,14406
54
+ langroid/agent/tool_message.py,sha256=HDW_FVQXvZAHI61CtOYNuZet0qlK_WwOnjSYd1g81eo,14742
55
55
  langroid/agent/tools/__init__.py,sha256=IMgCte-_ZIvCkozGQmvMqxIw7_nKLKzD78ccJL1bnQU,804
56
56
  langroid/agent/tools/duckduckgo_search_tool.py,sha256=NhsCaGZkdv28nja7yveAhSK_w6l_Ftym8agbrdzqgfo,1935
57
57
  langroid/agent/tools/file_tools.py,sha256=GjPB5YDILucYapElnvvoYpGJuZQ25ecLs2REv7edPEo,7292
@@ -72,7 +72,7 @@ langroid/cachedb/redis_cachedb.py,sha256=7kgnbf4b5CKsCrlL97mHWKvdvlLt8zgn7lc528j
72
72
  langroid/embedding_models/__init__.py,sha256=XhVIMQJbQRpImcnhA9sJR7h6r7QgPo1SKDCvwEUD9j4,851
73
73
  langroid/embedding_models/base.py,sha256=DUhvzALoW2UMbtmLxP4eJTfPii99WjUNX7bwFpj_K-0,2395
74
74
  langroid/embedding_models/clustering.py,sha256=tZWElUqXl9Etqla0FAa7og96iDKgjqWjucZR_Egtp-A,6684
75
- langroid/embedding_models/models.py,sha256=e-05H5hj0rptoHFdMCctBHBhY83aKFhkm2PnG3fXrOo,16783
75
+ langroid/embedding_models/models.py,sha256=sW6baTvFSeZBZ5w-Kd9Vgo93gokesJ3aHP4x9htoF2E,16776
76
76
  langroid/embedding_models/protoc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  langroid/embedding_models/protoc/embeddings.proto,sha256=_O-SgFpTaylQeOTgSpxhEJ7CUw7PeCQQJLaPqpPYKJg,321
78
78
  langroid/embedding_models/protoc/embeddings_pb2.py,sha256=4Q57PhOunv-uZNJrxYrWBXAI0ZtfnVZXFRhRj5JuRSg,1662
@@ -155,8 +155,8 @@ langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3Hmh
155
155
  langroid/vector_store/momento.py,sha256=UNHGT6jXuQtqY9f6MdqGU14bVnS0zHgIJUa30ULpUJo,10474
156
156
  langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
157
157
  langroid/vector_store/qdrantdb.py,sha256=v7mCsijc2GdRJyil-yFaUVAX4SX5D75mD3vzlpjCMuo,17393
158
- pyproject.toml,sha256=t-XPQ3oaaPpYGOGrHG3vyhzPSb5ea5OnIN-LzC1AsEk,7525
159
- langroid-0.31.0.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
160
- langroid-0.31.0.dist-info/METADATA,sha256=2VwUSexCK89Ovgr7a3E2h1Ifuqaosv0yZ8dduwsD72w,58250
161
- langroid-0.31.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
162
- langroid-0.31.0.dist-info/RECORD,,
158
+ pyproject.toml,sha256=4LnvkHuotknbr-AsiwehYqKmmVSs_Xi7bYBbOf0E6X0,7525
159
+ langroid-0.31.1.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
160
+ langroid-0.31.1.dist-info/METADATA,sha256=g593rbues9sKvoTGX88_zLbVE5DqIxvo-ZkmamSnJt8,58250
161
+ langroid-0.31.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
162
+ langroid-0.31.1.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langroid"
3
- version = "0.31.0"
3
+ version = "0.31.1"
4
4
  description = "Harness LLMs with Multi-Agent Programming"
5
5
  authors = ["Prasad Chalasani <pchalasani@gmail.com>"]
6
6
  readme = "README.md"
@@ -155,7 +155,7 @@ fastembed = ["fastembed"]
155
155
  black = {extras = ["jupyter"], version = "^24.3.0"}
156
156
  flake8 = "^6.0.0"
157
157
  mypy = "^1.11.2"
158
- ruff = "^0.7.2"
158
+ ruff = "^0.8.4"
159
159
  pre-commit = "^3.3.2"
160
160
  autopep8 = "^2.0.2"
161
161