langroid 0.1.168__py3-none-any.whl → 0.1.170__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 +3 -2
- langroid/agent/chat_agent.py +7 -3
- langroid/agent/special/neo4j/neo4j_chat_agent.py +3 -3
- langroid/agent/special/neo4j/utils/tools.py +1 -1
- langroid/parsing/json.py +1 -1
- langroid/utils/logging.py +2 -1
- {langroid-0.1.168.dist-info → langroid-0.1.170.dist-info}/METADATA +1 -1
- {langroid-0.1.168.dist-info → langroid-0.1.170.dist-info}/RECORD +10 -10
- {langroid-0.1.168.dist-info → langroid-0.1.170.dist-info}/LICENSE +0 -0
- {langroid-0.1.168.dist-info → langroid-0.1.170.dist-info}/WHEEL +0 -0
langroid/agent/base.py
CHANGED
@@ -21,6 +21,7 @@ from typing import (
|
|
21
21
|
from pydantic import BaseSettings, ValidationError
|
22
22
|
from rich import print
|
23
23
|
from rich.console import Console
|
24
|
+
from rich.markup import escape
|
24
25
|
from rich.prompt import Prompt
|
25
26
|
|
26
27
|
from langroid.agent.chat_document import ChatDocMetaData, ChatDocument
|
@@ -449,7 +450,7 @@ class Agent(ABC):
|
|
449
450
|
# streaming was enabled, AND we did not find a cached response.
|
450
451
|
# If we are here, it means the response has not yet been displayed.
|
451
452
|
cached = f"[red]{self.indent}(cached)[/red]" if response.cached else ""
|
452
|
-
print(cached + "[green]" + response.message)
|
453
|
+
print(cached + "[green]" + escape(response.message))
|
453
454
|
async with self.lock:
|
454
455
|
self.update_token_usage(
|
455
456
|
response,
|
@@ -522,7 +523,7 @@ class Agent(ABC):
|
|
522
523
|
# If we are here, it means the response has not yet been displayed.
|
523
524
|
cached = f"[red]{self.indent}(cached)[/red]" if response.cached else ""
|
524
525
|
console.print(f"[green]{self.indent}", end="")
|
525
|
-
print(cached + "[green]" + response.message)
|
526
|
+
print(cached + "[green]" + escape(response.message))
|
526
527
|
self.update_token_usage(
|
527
528
|
response,
|
528
529
|
prompt,
|
langroid/agent/chat_agent.py
CHANGED
@@ -6,6 +6,7 @@ from typing import Dict, List, Optional, Set, Tuple, Type, cast
|
|
6
6
|
|
7
7
|
from rich import print
|
8
8
|
from rich.console import Console
|
9
|
+
from rich.markup import escape
|
9
10
|
|
10
11
|
from langroid.agent.base import Agent, AgentConfig
|
11
12
|
from langroid.agent.chat_document import ChatDocument
|
@@ -570,7 +571,10 @@ class ChatAgent(Agent):
|
|
570
571
|
raise ValueError(
|
571
572
|
"""
|
572
573
|
The message history is longer than the max chat context
|
573
|
-
length allowed, and we have run out of messages to drop.
|
574
|
+
length allowed, and we have run out of messages to drop.
|
575
|
+
HINT: In your `OpenAIGPTConfig` object, try increasing
|
576
|
+
`chat_context_length` or decreasing `max_output_tokens`.
|
577
|
+
"""
|
574
578
|
)
|
575
579
|
# drop the second message, i.e. first msg after the sys msg
|
576
580
|
# (typically user msg).
|
@@ -663,7 +667,7 @@ class ChatAgent(Agent):
|
|
663
667
|
else:
|
664
668
|
response_str = response.message
|
665
669
|
if not settings.quiet:
|
666
|
-
print(cached + "[green]" + response_str)
|
670
|
+
print(cached + "[green]" + escape(response_str))
|
667
671
|
self.update_token_usage(
|
668
672
|
response,
|
669
673
|
messages,
|
@@ -706,7 +710,7 @@ class ChatAgent(Agent):
|
|
706
710
|
else:
|
707
711
|
response_str = response.message
|
708
712
|
if not settings.quiet:
|
709
|
-
print(cached + "[green]" + response_str)
|
713
|
+
print(cached + "[green]" + escape(response_str))
|
710
714
|
|
711
715
|
self.update_token_usage(
|
712
716
|
response,
|
@@ -228,15 +228,15 @@ class Neo4jChatAgent(ChatAgent):
|
|
228
228
|
|
229
229
|
def make_query(self, msg: CypherQueryTool) -> str:
|
230
230
|
""" "
|
231
|
-
Handle a
|
231
|
+
Handle a CypherQueryTool message by executing a Cypher query and
|
232
232
|
returning the result.
|
233
233
|
Args:
|
234
234
|
msg (CypherQueryTool): The tool-message to handle.
|
235
235
|
|
236
236
|
Returns:
|
237
|
-
str: The result of executing the
|
237
|
+
str: The result of executing the cypher_query.
|
238
238
|
"""
|
239
|
-
query = msg.
|
239
|
+
query = msg.cypher_query
|
240
240
|
|
241
241
|
logger.info(f"Executing Cypher query: {query}")
|
242
242
|
return self.read_query(query)
|
@@ -5,7 +5,7 @@ class CypherQueryTool(ToolMessage):
|
|
5
5
|
request: str = "make_query"
|
6
6
|
purpose: str = """Use this tool to send me the Generated Cypher query based on
|
7
7
|
text description and schema that I will provide you."""
|
8
|
-
|
8
|
+
cypher_query: str
|
9
9
|
|
10
10
|
|
11
11
|
class GraphSchemaTool(ToolMessage):
|
langroid/parsing/json.py
CHANGED
@@ -57,7 +57,7 @@ def extract_top_level_json(s: str) -> List[str]:
|
|
57
57
|
json_candidates = get_json_candidates(s)
|
58
58
|
|
59
59
|
normalized_candidates = [
|
60
|
-
candidate.replace("\\{", "{").replace("\\}", "}")
|
60
|
+
candidate.replace("\\{", "{").replace("\\}", "}").replace("\\_", "_")
|
61
61
|
for candidate in json_candidates
|
62
62
|
]
|
63
63
|
top_level_jsons = [
|
langroid/utils/logging.py
CHANGED
@@ -4,6 +4,7 @@ from typing import no_type_check
|
|
4
4
|
|
5
5
|
import colorlog
|
6
6
|
from rich.console import Console
|
7
|
+
from rich.markup import escape
|
7
8
|
|
8
9
|
|
9
10
|
# Define a function to set up the colored logger
|
@@ -125,6 +126,6 @@ class RichFileLogger:
|
|
125
126
|
with open(self.log_file, "a") as f:
|
126
127
|
if self.color:
|
127
128
|
console = Console(file=f, force_terminal=True, width=200)
|
128
|
-
console.print(message)
|
129
|
+
console.print(escape(message))
|
129
130
|
else:
|
130
131
|
print(message, file=f)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
langroid/__init__.py,sha256=I9edNDkpmfd5C4WvTONaGaTFzIlvFyp5GpFEaMCAKMk,778
|
2
2
|
langroid/agent/__init__.py,sha256=w2pap-rHrp41gMzdtzur2YY_m62LqQhF2Du-AmoIQi4,752
|
3
|
-
langroid/agent/base.py,sha256=
|
3
|
+
langroid/agent/base.py,sha256=X_B9WxTwRfTNTkDwNGzGU-tvgdwJ6AnW22vL0kl_97g,33285
|
4
4
|
langroid/agent/batch.py,sha256=Cg7Qv1yGi_M9rMl38_4-hjXPsoLlZrOSXDhbOFqUcKY,5593
|
5
|
-
langroid/agent/chat_agent.py,sha256=
|
5
|
+
langroid/agent/chat_agent.py,sha256=vLHFUPzOVQlGfeXCOMxLi5gtTGOHX7q6JKf_926TFmg,35261
|
6
6
|
langroid/agent/chat_document.py,sha256=MRp2YCy5f3Q_yPoFXVyr1vGu48wz33UGxAUtMn7MJpo,7958
|
7
7
|
langroid/agent/helpers.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
langroid/agent/junk,sha256=LxfuuW7Cijsg0szAzT81OjWWv1PMNI-6w_-DspVIO2s,339
|
@@ -16,10 +16,10 @@ langroid/agent/special/lance_rag/lance_rag_task.py,sha256=l_HQgrYY-CX2FwIsS961aE
|
|
16
16
|
langroid/agent/special/lance_rag/lance_tools.py,sha256=WypIS-3ZMDqY_PZEGB2K80-o4RfS43_OnER0dyFlsDY,1339
|
17
17
|
langroid/agent/special/lance_rag/query_planner_agent.py,sha256=dZXVano2NbRZy91nBcEW6LrvedsHfxL1oNCgMQEHZ-U,8016
|
18
18
|
langroid/agent/special/neo4j/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
|
-
langroid/agent/special/neo4j/neo4j_chat_agent.py,sha256=
|
19
|
+
langroid/agent/special/neo4j/neo4j_chat_agent.py,sha256=ytx-FBDCGsn5m2sUzaYj6zHQhwsOGgdX1anuIXtvebI,11391
|
20
20
|
langroid/agent/special/neo4j/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
21
21
|
langroid/agent/special/neo4j/utils/system_message.py,sha256=7rwq4CYpb1-1AvGLJBI6-X8UIu5RP5LiWU9re-umXxs,1959
|
22
|
-
langroid/agent/special/neo4j/utils/tools.py,sha256=
|
22
|
+
langroid/agent/special/neo4j/utils/tools.py,sha256=dSbL9cNzu6ZUofyK2eaSrHPzFzS_-YEruGodsVvMrQQ,441
|
23
23
|
langroid/agent/special/relevance_extractor_agent.py,sha256=lychVpSEhMzi_CdeLN1yO-O2AVOe2W0F3Ha8aC3nd9M,4624
|
24
24
|
langroid/agent/special/retriever_agent.py,sha256=uu6vqFg85uCVM-_DrXesYe2gH_-WcoHhlsKRlLuZPXk,1867
|
25
25
|
langroid/agent/special/sql/__init__.py,sha256=qUM-b4FfvIt0gYWP7_niyqR3OwVMMkuK2SyqUYWjyxs,207
|
@@ -66,7 +66,7 @@ langroid/parsing/code-parsing.md,sha256=--cyyNiSZSDlIwcjAV4-shKrSiRe2ytF3AdSoS_h
|
|
66
66
|
langroid/parsing/code_parser.py,sha256=BbDAzp35wkYQ9U1dpf1ARL0lVyi0tfqEc6_eox2C090,3727
|
67
67
|
langroid/parsing/config.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
68
|
langroid/parsing/document_parser.py,sha256=SEW53fnEsOrsJbVUy9Fq5ygQzF_5UiGB5_Ogkte1u2Y,16697
|
69
|
-
langroid/parsing/json.py,sha256=
|
69
|
+
langroid/parsing/json.py,sha256=OgS3MV1bCegrqop5k2oe79iRj3WJQa_8EZLHeEZ0qSc,2571
|
70
70
|
langroid/parsing/para_sentence_split.py,sha256=AJBzZojP3zpB-_IMiiHismhqcvkrVBQ3ZINoQyx_bE4,2000
|
71
71
|
langroid/parsing/parser.py,sha256=727QivWlZNlQiRFgkxTZpPoTMqB2yaltOkAGqLZGI_Q,10513
|
72
72
|
langroid/parsing/repo_loader.py,sha256=52jTajXOkq_66NCRKLMNQoGKMJ59H-m2CZB9arMT7Wo,29346
|
@@ -92,7 +92,7 @@ langroid/utils/docker.py,sha256=kJQOLTgM0x9j9pgIIqp0dZNZCTvoUDhp6i8tYBq1Jr0,1105
|
|
92
92
|
langroid/utils/globals.py,sha256=VkTHhlqSz86oOPq65sjul0XU8I52UNaFC5vwybMQ74w,1343
|
93
93
|
langroid/utils/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
94
|
langroid/utils/llms/strings.py,sha256=CSAX9Z6FQOLXOzbLMe_Opqtc3ruDAKTTk7cPqc6Blh0,263
|
95
|
-
langroid/utils/logging.py,sha256=
|
95
|
+
langroid/utils/logging.py,sha256=CXe8w2gjFhhvgyGr1iwU--Je916H2rOrDNJosv5Tl3Y,3956
|
96
96
|
langroid/utils/output/__init__.py,sha256=Z58-2ZKnGpGNaKw_nEjHV_CHTzjMz-WRSRQnazTLrWU,289
|
97
97
|
langroid/utils/output/printing.py,sha256=5EsYB1O4qKhocW19aebOUzK82RD9U5nygbY21yo8gfg,2872
|
98
98
|
langroid/utils/pandas_utils.py,sha256=nSA1tIgOUTkRDn-IKq7HP8XGJcL6bA110LcPfRF7h8I,707
|
@@ -109,7 +109,7 @@ langroid/vector_store/meilisearch.py,sha256=d2huA9P-NoYRuAQ9ZeXJmMKr7ry8u90RUSR2
|
|
109
109
|
langroid/vector_store/momento.py,sha256=j6Eo6oIDN2fe7lsBOlCXJn3uvvERHHTFL5QJfeREeOM,10044
|
110
110
|
langroid/vector_store/qdrant_cloud.py,sha256=3im4Mip0QXLkR6wiqVsjV1QvhSElfxdFSuDKddBDQ-4,188
|
111
111
|
langroid/vector_store/qdrantdb.py,sha256=qt7Dye6rcgoe0551WzmOxRGIlJfL87D4MX7HdqxuEok,13393
|
112
|
-
langroid-0.1.
|
113
|
-
langroid-0.1.
|
114
|
-
langroid-0.1.
|
115
|
-
langroid-0.1.
|
112
|
+
langroid-0.1.170.dist-info/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
113
|
+
langroid-0.1.170.dist-info/METADATA,sha256=AcAQoXTrF0JdskDnTZh6keWIm7YLM_vGEulYxs-KCE4,43613
|
114
|
+
langroid-0.1.170.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
115
|
+
langroid-0.1.170.dist-info/RECORD,,
|
File without changes
|
File without changes
|