langchain-core 0.3.78__py3-none-any.whl → 0.3.79__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.

Potentially problematic release.


This version of langchain-core might be problematic. Click here for more details.

@@ -4,8 +4,9 @@ from __future__ import annotations
4
4
 
5
5
  import warnings
6
6
  from abc import ABC
7
+ from collections.abc import Callable, Sequence
7
8
  from string import Formatter
8
- from typing import Any, Callable, Literal
9
+ from typing import Any, Literal
9
10
 
10
11
  from pydantic import BaseModel, create_model
11
12
 
@@ -148,9 +149,7 @@ def mustache_template_vars(
148
149
  Defs = dict[str, "Defs"]
149
150
 
150
151
 
151
- def mustache_schema(
152
- template: str,
153
- ) -> type[BaseModel]:
152
+ def mustache_schema(template: str) -> type[BaseModel]:
154
153
  """Get the variables from a mustache template.
155
154
 
156
155
  Args:
@@ -174,6 +173,11 @@ def mustache_schema(
174
173
  fields[prefix] = False
175
174
  elif type_ in {"variable", "no escape"}:
176
175
  fields[prefix + tuple(key.split("."))] = True
176
+
177
+ for fkey, fval in fields.items():
178
+ fields[fkey] = fval and not any(
179
+ is_subsequence(fkey, k) for k in fields if k != fkey
180
+ )
177
181
  defs: Defs = {} # None means leaf node
178
182
  while fields:
179
183
  field, is_leaf = fields.popitem()
@@ -326,3 +330,12 @@ class StringPromptTemplate(BasePromptTemplate, ABC):
326
330
  def pretty_print(self) -> None:
327
331
  """Print a pretty representation of the prompt."""
328
332
  print(self.pretty_repr(html=is_interactive_env())) # noqa: T201
333
+
334
+
335
+ def is_subsequence(child: Sequence, parent: Sequence) -> bool:
336
+ """Return True if child is subsequence of parent."""
337
+ if len(child) == 0 or len(parent) == 0:
338
+ return False
339
+ if len(parent) < len(child):
340
+ return False
341
+ return all(child[i] == parent[i] for i in range(len(child)))
langchain_core/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """langchain-core version information and utilities."""
2
2
 
3
- VERSION = "0.3.78"
3
+ VERSION = "0.3.79"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-core
3
- Version: 0.3.78
3
+ Version: 0.3.79
4
4
  Summary: Building applications with LLMs through composability
5
5
  License: MIT
6
6
  Project-URL: Source Code, https://github.com/langchain-ai/langchain/tree/master/libs/core
@@ -1,6 +1,6 @@
1
- langchain_core-0.3.78.dist-info/METADATA,sha256=p2mFMUB3yNtnZkcOLujqkN0d3ZdiSvzbJDFawVy0fEQ,3155
2
- langchain_core-0.3.78.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- langchain_core-0.3.78.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ langchain_core-0.3.79.dist-info/METADATA,sha256=zXbyMC_ayuewGmdE_v74VpKWbKQ6-YQSK6TVcoYNz8s,3155
2
+ langchain_core-0.3.79.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ langchain_core-0.3.79.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  langchain_core/__init__.py,sha256=TgvhxbrjCRVJwr2HddiyHvtH8W94K-uLM6-6ifNIBXo,713
5
5
  langchain_core/_api/__init__.py,sha256=WDOMw4faVuscjDCL5ttnRQNienJP_M9vGMmJUXS6L5w,1976
6
6
  langchain_core/_api/beta_decorator.py,sha256=XK7dDgbsyBTiZMjUxVB_bUuuGR1X8T_zBgEBya55mQU,8813
@@ -98,7 +98,7 @@ langchain_core/prompts/loading.py,sha256=_T26PCTuZuOsCkHk_uv-h_zoIMonXojBdYJA3Us
98
98
  langchain_core/prompts/message.py,sha256=9I5IZXFn2Bwv8CIZ0zMp7k8C48xQyiAOqyv6uAYJdY0,2624
99
99
  langchain_core/prompts/pipeline.py,sha256=Zj6aqIcU874mnYG__0I4nHmz4p7uaNAdYsJpMDb1LyQ,4612
100
100
  langchain_core/prompts/prompt.py,sha256=RfD-w7GKolgptGB72UVIb1q3iIOm4pv2hby6EmJf9kk,11667
101
- langchain_core/prompts/string.py,sha256=biN76hgwqZx-SjtXgy3qe9QmM2I2STSg8DylD0Mf0RE,10361
101
+ langchain_core/prompts/string.py,sha256=3S2JvvlXxYj1bU_9jQZ1TUMruHGef4ht394bN3Kbn6E,10852
102
102
  langchain_core/prompts/structured.py,sha256=V5qfOpSPWBnF5xcRl_qEmrv1u7T_IfzONHJ-rUFiTyE,5957
103
103
  langchain_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
104
104
  langchain_core/pydantic_v1/__init__.py,sha256=hqAsQjsfqLduCo5E0oAAAt21Nkls0S6bCQ4tD2moFfU,1080
@@ -170,5 +170,5 @@ langchain_core/vectorstores/__init__.py,sha256=5P0eoeoH5LHab64JjmEeWa6SxX4eMy-et
170
170
  langchain_core/vectorstores/base.py,sha256=nWlfzbkVdOObfbPpvfdLKHw9J0PryACVohHC_Y6wWZM,41529
171
171
  langchain_core/vectorstores/in_memory.py,sha256=btq53JnPZHMRGCbejVx1H-6RSNRAgtacd-XAx6dt-Q8,18076
172
172
  langchain_core/vectorstores/utils.py,sha256=D6St53Xg1kO73dnw4MPd8vlkro4C3gmCpcghUzcepi0,4971
173
- langchain_core/version.py,sha256=RvXW3LZZh5kETtasiibosMdNbMuRUYCC5xKy9MPZnU0,76
174
- langchain_core-0.3.78.dist-info/RECORD,,
173
+ langchain_core/version.py,sha256=ZGSZY6K4Q6YurFJFB-TZaakyu68sDUPdaH7fA7HxP98,76
174
+ langchain_core-0.3.79.dist-info/RECORD,,