langroid 0.53.15__py3-none-any.whl → 0.53.16__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.
@@ -38,6 +38,7 @@ class VectorStoreConfig(BaseSettings):
38
38
  document_class: Type[Document] = Document
39
39
  metadata_class: Type[DocMetaData] = DocMetaData
40
40
  # compose_file: str = "langroid/vector_store/docker-compose-qdrant.yml"
41
+ full_eval: bool = False # runs eval without sanitization. Use only on trusted input
41
42
 
42
43
 
43
44
  class VectorStore(ABC):
@@ -153,6 +154,10 @@ class VectorStore(ABC):
153
154
  def compute_from_docs(self, docs: List[Document], calc: str) -> str:
154
155
  """Compute a result on a set of documents,
155
156
  using a dataframe calc string like `df.groupby('state')['income'].mean()`.
157
+
158
+ If full_eval is False (default), the input expression is sanitized to prevent
159
+ most common code injection attack vectors.
160
+ If full_eval is True, sanitization is bypassed - use only with trusted input!
156
161
  """
157
162
  # convert each doc to a dict, using dotted paths for nested fields
158
163
  dicts = [flatten_dict(doc.dict(by_alias=True)) for doc in docs]
@@ -160,9 +165,10 @@ class VectorStore(ABC):
160
165
 
161
166
  try:
162
167
  # SECURITY MITIGATION: Eval input is sanitized to prevent most common
163
- # code injection attack vectors.
168
+ # code injection attack vectors when full_eval is False.
164
169
  vars = {"df": df}
165
- calc = sanitize_command(calc)
170
+ if not self.config.full_eval:
171
+ calc = sanitize_command(calc)
166
172
  code = compile(calc, "<calc>", "eval")
167
173
  result = eval(code, vars, {})
168
174
  except Exception as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langroid
3
- Version: 0.53.15
3
+ Version: 0.53.16
4
4
  Summary: Harness LLMs with Multi-Agent Programming
5
5
  Author-email: Prasad Chalasani <pchalasani@gmail.com>
6
6
  License: MIT
@@ -125,7 +125,7 @@ langroid/utils/output/citations.py,sha256=9W0slQQgzRGLS7hU51mm5UWao5cS_xr8AVosVe
125
125
  langroid/utils/output/printing.py,sha256=yzPJZN-8_jyOJmI9N_oLwEDfjMwVgk3IDiwnZ4eK_AE,2962
126
126
  langroid/utils/output/status.py,sha256=rzbE7mDJcgNNvdtylCseQcPGCGghtJvVq3lB-OPJ49E,1049
127
127
  langroid/vector_store/__init__.py,sha256=8ktJUVsVUoc7FMmkUFpFBZu7VMWUqQY9zpm4kEJ8yTs,1537
128
- langroid/vector_store/base.py,sha256=uIRz3ZVmqxzuq2V71Kpys_6-j460gGjHXQIAJWJLI78,14675
128
+ langroid/vector_store/base.py,sha256=jbLH0bH_1tioX1nCA5vzaKZij4kx6xiLd5TbmqLjF8g,15058
129
129
  langroid/vector_store/chromadb.py,sha256=p9mEqJwO2BrL2jSSXfa23kCPlPOwWpF3xJYd5zoWw_c,8661
130
130
  langroid/vector_store/lancedb.py,sha256=Qd20gKjWozPWfW5-D66J6U8dSrJo1yl-maj6s1lbf1c,14688
131
131
  langroid/vector_store/meilisearch.py,sha256=6frB7GFWeWmeKzRfLZIvzRjllniZ1cYj3HmhHQICXLs,11663
@@ -133,7 +133,7 @@ langroid/vector_store/pineconedb.py,sha256=otxXZNaBKb9f_H75HTaU3lMHiaR2NUp5MqwLZ
133
133
  langroid/vector_store/postgres.py,sha256=wHPtIi2qM4fhO4pMQr95pz1ZCe7dTb2hxl4VYspGZoA,16104
134
134
  langroid/vector_store/qdrantdb.py,sha256=O6dSBoDZ0jzfeVBd7LLvsXu083xs2fxXtPa9gGX3JX4,18443
135
135
  langroid/vector_store/weaviatedb.py,sha256=Yn8pg139gOy3zkaPfoTbMXEEBCiLiYa1MU5d_3UA1K4,11847
136
- langroid-0.53.15.dist-info/METADATA,sha256=893X5dUY-L85Q0rKwS2Ex6fIH3L_W3TZ0NFqCeMbz4Q,64946
137
- langroid-0.53.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
138
- langroid-0.53.15.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
139
- langroid-0.53.15.dist-info/RECORD,,
136
+ langroid-0.53.16.dist-info/METADATA,sha256=hGXx5kkmGfUFp2QEBTeGNGhaegoHB5z4Pwdi5WELxa0,64946
137
+ langroid-0.53.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
138
+ langroid-0.53.16.dist-info/licenses/LICENSE,sha256=EgVbvA6VSYgUlvC3RvPKehSg7MFaxWDsFuzLOsPPfJg,1065
139
+ langroid-0.53.16.dist-info/RECORD,,