langroid 0.45.3__py3-none-any.whl → 0.45.5__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 CHANGED
@@ -90,7 +90,7 @@ class AgentConfig(BaseSettings):
90
90
  parsing: Optional[ParsingConfig] = ParsingConfig()
91
91
  prompts: Optional[PromptsConfig] = PromptsConfig()
92
92
  show_stats: bool = True # show token usage/cost stats?
93
- hide_agent_response: bool = True # hide agent response?
93
+ hide_agent_response: bool = False # hide agent response?
94
94
  add_to_registry: bool = True # register agent in ObjectRegistry?
95
95
  respond_tools_only: bool = False # respond only to tool messages (not plain text)?
96
96
  # allow multiple tool messages in a single response?
@@ -1,7 +1,10 @@
1
+ import logging
1
2
  from typing import List, Tuple
2
3
 
3
4
  from langroid.mytypes import Document
4
5
 
6
+ logger = logging.getLogger(__name__)
7
+
5
8
 
6
9
  def extract_markdown_references(md_string: str) -> List[int]:
7
10
  """
@@ -87,15 +90,21 @@ def format_cited_references(
87
90
  full_citations_str = ""
88
91
  if len(citations) > 0:
89
92
  # append [i] source, content for each citation
93
+ good_citations = [c for c in citations if c > 0 and c <= len(passages)]
94
+ if len(good_citations) < len(citations):
95
+ logger.warning(f"Invalid citations: {set(citations) - set(good_citations)}")
96
+
97
+ # source and content for each citation
90
98
  full_citations_str = "\n".join(
91
99
  [
92
100
  f"[^{c}] {passages[c-1].metadata.source}"
93
101
  f"\n{format_footnote_text(passages[c-1].content)}"
94
- for c in citations
102
+ for c in good_citations
95
103
  ]
96
104
  )
97
- # append [i] source for each citation
105
+
106
+ # source for each citation
98
107
  citations_str = "\n".join(
99
- [f"[^{c}] {passages[c-1].metadata.source}" for c in citations]
108
+ [f"[^{c}] {passages[c-1].metadata.source}" for c in good_citations]
100
109
  )
101
110
  return full_citations_str, citations_str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.45.3
3
+ Version: 0.45.5
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -3,7 +3,7 @@ langroid/exceptions.py,sha256=OPjece_8cwg94DLPcOGA1ddzy5bGh65pxzcHMnssTz8,2995
3
3
  langroid/mytypes.py,sha256=wfb320SFnZVTv_CgcLWsvoKBXxAFfY4EISeue8MFqpQ,2912
4
4
  langroid/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  langroid/agent/__init__.py,sha256=ll0Cubd2DZ-fsCMl7e10hf9ZjFGKzphfBco396IKITY,786
6
- langroid/agent/base.py,sha256=yM7ul2byHhwCFm6w8_4RULkPdhI8XR3n7XqNBS0hD20,79567
6
+ langroid/agent/base.py,sha256=U-UjdpxIFqkzRIB5-LYwHrhMSNI3sDbfnNRqIhrtsyI,79568
7
7
  langroid/agent/batch.py,sha256=vi1r5i1-vN80WfqHDSwjEym_KfGsqPGUtwktmiK1nuk,20635
8
8
  langroid/agent/chat_agent.py,sha256=Z53oleOUcOXVs_UL90spttGoAooe0mrx3tDtOuhKVms,85214
9
9
  langroid/agent/chat_document.py,sha256=xzMtrPbaW-Y-BnF7kuhr2dorsD-D5rMWzfOqJ8HAoo8,17885
@@ -115,7 +115,7 @@ langroid/utils/types.py,sha256=-BvyIf_LmAJ5jR9NC7S4CSVNEr3XayAaxJ5o0TiIej0,2992
115
115
  langroid/utils/algorithms/__init__.py,sha256=WylYoZymA0fnzpB4vrsH_0n7WsoLhmuZq8qxsOCjUpM,41
116
116
  langroid/utils/algorithms/graph.py,sha256=JbdpPnUOhw4-D6O7ou101JLA3xPCD0Lr3qaPoFCaRfo,2866
117
117
  langroid/utils/output/__init__.py,sha256=7P0f--4IZneNsTxXY5fd6d6iW-CeVe-KSsl-87sbBPc,340
118
- langroid/utils/output/citations.py,sha256=ltdhBNRlF5qh8XnCVeeGKp1k0XZRcF22avDO4fadxH0,3547
118
+ langroid/utils/output/citations.py,sha256=5mhg2-kpBF7qgV82gJbIiUHfoJcpJiK1sAWdDF0o0Wc,3866
119
119
  langroid/utils/output/printing.py,sha256=yzPJZN-8_jyOJmI9N_oLwEDfjMwVgk3IDiwnZ4eK_AE,2962
120
120
  langroid/utils/output/status.py,sha256=rzbE7mDJcgNNvdtylCseQcPGCGghtJvVq3lB-OPJ49E,1049
121
121
  langroid/vector_store/__init__.py,sha256=8ktJUVsVUoc7FMmkUFpFBZu7VMWUqQY9zpm4kEJ8yTs,1537
@@ -127,7 +127,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
127
127
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
128
128
  langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
129
129
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
130
- langroid-0.45.3.dist-info/METADATA,sha256=_6oOG_rHqN8JUymnv8uIbHaqpk5N7gHiUUqMqEFXvFc,63335
131
- langroid-0.45.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
132
- langroid-0.45.3.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
133
- langroid-0.45.3.dist-info/RECORD,,
130
+ langroid-0.45.5.dist-info/METADATA,sha256=aQ1z8Qu1fZty_2w2Xj9fGCptUUNSPUCEFcTp4xVrats,63335
131
+ langroid-0.45.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
132
+ langroid-0.45.5.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
133
+ langroid-0.45.5.dist-info/RECORD,,