langroid 0.52.5__py3-none-any.whl → 0.52.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.
- langroid/agent/chat_agent.py +8 -1
- langroid/agent/special/doc_chat_agent.py +8 -2
- {langroid-0.52.5.dist-info → langroid-0.52.6.dist-info}/METADATA +1 -1
- {langroid-0.52.5.dist-info → langroid-0.52.6.dist-info}/RECORD +6 -6
- {langroid-0.52.5.dist-info → langroid-0.52.6.dist-info}/WHEEL +0 -0
- {langroid-0.52.5.dist-info → langroid-0.52.6.dist-info}/licenses/LICENSE +0 -0
langroid/agent/chat_agent.py
CHANGED
@@ -735,7 +735,11 @@ class ChatAgent(Agent):
|
|
735
735
|
self.llm_tools_usable.discard(t)
|
736
736
|
self.llm_functions_usable.discard(t)
|
737
737
|
|
738
|
-
|
738
|
+
self._update_tool_instructions()
|
739
|
+
|
740
|
+
def _update_tool_instructions(self) -> None:
|
741
|
+
# Set tool instructions and JSON format instructions,
|
742
|
+
# in case Tools have been enabled/disabled.
|
739
743
|
if self.config.use_tools:
|
740
744
|
self.system_tool_format_instructions = self.tool_format_rules()
|
741
745
|
self.system_tool_instructions = self.tool_instructions()
|
@@ -977,6 +981,8 @@ class ChatAgent(Agent):
|
|
977
981
|
self.llm_tools_usable.discard(t)
|
978
982
|
self.llm_functions_usable.discard(t)
|
979
983
|
|
984
|
+
self._update_tool_instructions()
|
985
|
+
|
980
986
|
def disable_message_use_except(self, message_class: Type[ToolMessage]) -> None:
|
981
987
|
"""
|
982
988
|
Disable this agent from USING ALL messages EXCEPT a message class (Tool)
|
@@ -988,6 +994,7 @@ class ChatAgent(Agent):
|
|
988
994
|
for r in to_remove:
|
989
995
|
self.llm_tools_usable.discard(r)
|
990
996
|
self.llm_functions_usable.discard(r)
|
997
|
+
self._update_tool_instructions()
|
991
998
|
|
992
999
|
def _load_output_format(self, message: ChatDocument) -> None:
|
993
1000
|
"""
|
@@ -123,6 +123,9 @@ class DocChatAgentConfig(ChatAgentConfig):
|
|
123
123
|
None # filter condition for various lexical/semantic search fns
|
124
124
|
)
|
125
125
|
conversation_mode: bool = True # accumulate message history?
|
126
|
+
# retain retrieved context? Setting to True increases token consumption, but
|
127
|
+
# helps LLM fix citation errors and improve accuracy of follow-up questions.
|
128
|
+
retain_context: bool = False
|
126
129
|
# In assistant mode, DocChatAgent receives questions from another Agent,
|
127
130
|
# and those will already be in stand-alone form, so in this mode
|
128
131
|
# there is no need to convert them to stand-alone form.
|
@@ -861,8 +864,11 @@ class DocChatAgent(ChatAgent):
|
|
861
864
|
# one for `final_prompt`, and one for the LLM response
|
862
865
|
|
863
866
|
if self.config.conversation_mode:
|
864
|
-
|
865
|
-
|
867
|
+
if self.config.retain_context:
|
868
|
+
answer_doc = super().llm_response(final_prompt)
|
869
|
+
else:
|
870
|
+
# respond with temporary context
|
871
|
+
answer_doc = super()._llm_response_temp_context(question, final_prompt)
|
866
872
|
else:
|
867
873
|
answer_doc = super().llm_response_forget(final_prompt)
|
868
874
|
|
@@ -5,7 +5,7 @@ langroid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
|
6
6
|
langroid/agent/base.py,sha256=lWR4ivX_elTFejpknLhkO-DlAGT3aG6ojQAVkzDOqMc,80090
|
7
7
|
langroid/agent/batch.py,sha256=vi1r5i1-vN80WfqHDSwjEym_KfGsqPGUtwktmiK1nuk,20635
|
8
|
-
langroid/agent/chat_agent.py,sha256=
|
8
|
+
langroid/agent/chat_agent.py,sha256=nsFSARSANCVByL4fAl_DhyWm9gM7s_6waqNsmePXJMA,85309
|
9
9
|
langroid/agent/chat_document.py,sha256=6O20Fp4QrquykaF2jFtwNHkvcoDte1LLwVZNk9mVH9c,18057
|
10
10
|
langroid/agent/openai_assistant.py,sha256=JkAcs02bIrgPNVvUWVR06VCthc5-ulla2QMBzux_q6o,34340
|
11
11
|
langroid/agent/task.py,sha256=HB6N-Jn80HFqCf0ZYOC1v3Bn3oO7NLjShHQJJFwW0q4,90557
|
@@ -14,7 +14,7 @@ langroid/agent/xml_tool_message.py,sha256=6SshYZJKIfi4mkE-gIoSwjkEYekQ8GwcSiCv7a
|
|
14
14
|
langroid/agent/callbacks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
langroid/agent/callbacks/chainlit.py,sha256=UHB6P_J40vsVnssosqkpkOVWRf9NK4TOY0_G2g_Arsg,20900
|
16
16
|
langroid/agent/special/__init__.py,sha256=gik_Xtm_zV7U9s30Mn8UX3Gyuy4jTjQe9zjiE3HWmEo,1273
|
17
|
-
langroid/agent/special/doc_chat_agent.py,sha256
|
17
|
+
langroid/agent/special/doc_chat_agent.py,sha256=-ABgZiaIowFVqYMYlU1Nf8WfOqXOTmlMCEnafEXucPo,65564
|
18
18
|
langroid/agent/special/doc_chat_task.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
langroid/agent/special/lance_doc_chat_agent.py,sha256=s8xoRs0gGaFtDYFUSIRchsgDVbS5Q3C2b2mr3V1Fd-Q,10419
|
20
20
|
langroid/agent/special/lance_tools.py,sha256=qS8x4wi8mrqfbYV2ztFzrcxyhHQ0ZWOc-zkYiH7awj0,2105
|
@@ -129,7 +129,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
|
|
129
129
|
langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
|
130
130
|
langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
|
131
131
|
langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
|
132
|
-
langroid-0.52.
|
133
|
-
langroid-0.52.
|
134
|
-
langroid-0.52.
|
135
|
-
langroid-0.52.
|
132
|
+
langroid-0.52.6.dist-info/METADATA,sha256=fOf2NTPNfbS1F9rSfa7oLtYHB66xFiN65MnRWybC9sU,63519
|
133
|
+
langroid-0.52.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
134
|
+
langroid-0.52.6.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
|
135
|
+
langroid-0.52.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|