langchain-core 1.0.4__py3-none-any.whl → 1.0.7__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.
@@ -5,13 +5,12 @@ from __future__ import annotations
5
5
  import logging
6
6
  from typing import TYPE_CHECKING, Any
7
7
 
8
- from typing_extensions import Self
9
-
10
8
  if TYPE_CHECKING:
11
9
  from collections.abc import Sequence
12
10
  from uuid import UUID
13
11
 
14
12
  from tenacity import RetryCallState
13
+ from typing_extensions import Self
15
14
 
16
15
  from langchain_core.agents import AgentAction, AgentFinish
17
16
  from langchain_core.documents import Document
@@ -39,7 +39,6 @@ from langchain_core.tracers.context import (
39
39
  tracing_v2_callback_var,
40
40
  )
41
41
  from langchain_core.tracers.langchain import LangChainTracer
42
- from langchain_core.tracers.schemas import Run
43
42
  from langchain_core.tracers.stdout import ConsoleCallbackHandler
44
43
  from langchain_core.utils.env import env_var_is_set
45
44
 
@@ -52,6 +51,7 @@ if TYPE_CHECKING:
52
51
  from langchain_core.documents import Document
53
52
  from langchain_core.outputs import ChatGenerationChunk, GenerationChunk, LLMResult
54
53
  from langchain_core.runnables.config import RunnableConfig
54
+ from langchain_core.tracers.schemas import Run
55
55
 
56
56
  logger = logging.getLogger(__name__)
57
57
 
@@ -6,16 +6,9 @@ import hashlib
6
6
  import json
7
7
  import uuid
8
8
  import warnings
9
- from collections.abc import (
10
- AsyncIterable,
11
- AsyncIterator,
12
- Callable,
13
- Iterable,
14
- Iterator,
15
- Sequence,
16
- )
17
9
  from itertools import islice
18
10
  from typing import (
11
+ TYPE_CHECKING,
19
12
  Any,
20
13
  Literal,
21
14
  TypedDict,
@@ -29,6 +22,16 @@ from langchain_core.exceptions import LangChainException
29
22
  from langchain_core.indexing.base import DocumentIndex, RecordManager
30
23
  from langchain_core.vectorstores import VectorStore
31
24
 
25
+ if TYPE_CHECKING:
26
+ from collections.abc import (
27
+ AsyncIterable,
28
+ AsyncIterator,
29
+ Callable,
30
+ Iterable,
31
+ Iterator,
32
+ Sequence,
33
+ )
34
+
32
35
  # Magic UUID to use as a namespace for hashing.
33
36
  # Used to try and generate a unique UUID for each document
34
37
  # from hashing the document content and metadata.
@@ -299,6 +299,9 @@ class BaseLanguageModel(
299
299
 
300
300
  Useful for checking if an input fits in a model's context window.
301
301
 
302
+ This should be overridden by model-specific implementations to provide accurate
303
+ token counts via model-specific tokenizers.
304
+
302
305
  Args:
303
306
  text: The string input to tokenize.
304
307
 
@@ -317,9 +320,17 @@ class BaseLanguageModel(
317
320
 
318
321
  Useful for checking if an input fits in a model's context window.
319
322
 
323
+ This should be overridden by model-specific implementations to provide accurate
324
+ token counts via model-specific tokenizers.
325
+
320
326
  !!! note
321
- The base implementation of `get_num_tokens_from_messages` ignores tool
322
- schemas.
327
+
328
+ * The base implementation of `get_num_tokens_from_messages` ignores tool
329
+ schemas.
330
+ * The base implementation of `get_num_tokens_from_messages` adds additional
331
+ prefixes to messages in represent user roles, which will add to the
332
+ overall token count. Model-specific implementations may choose to
333
+ handle this differently.
323
334
 
324
335
  Args:
325
336
  messages: The message inputs to tokenize.
@@ -91,7 +91,10 @@ def _generate_response_from_error(error: BaseException) -> list[ChatGeneration]:
91
91
  try:
92
92
  metadata["body"] = response.json()
93
93
  except Exception:
94
- metadata["body"] = getattr(response, "text", None)
94
+ try:
95
+ metadata["body"] = getattr(response, "text", None)
96
+ except Exception:
97
+ metadata["body"] = None
95
98
  if hasattr(response, "headers"):
96
99
  try:
97
100
  metadata["headers"] = dict(response.headers)
@@ -61,13 +61,15 @@ class Reviver:
61
61
  """Initialize the reviver.
62
62
 
63
63
  Args:
64
- secrets_map: A map of secrets to load. If a secret is not found in
65
- the map, it will be loaded from the environment if `secrets_from_env`
66
- is True.
64
+ secrets_map: A map of secrets to load.
65
+
66
+ If a secret is not found in the map, it will be loaded from the
67
+ environment if `secrets_from_env` is `True`.
67
68
  valid_namespaces: A list of additional namespaces (modules)
68
69
  to allow to be deserialized.
69
70
  secrets_from_env: Whether to load secrets from the environment.
70
71
  additional_import_mappings: A dictionary of additional namespace mappings
72
+
71
73
  You can use this to override default mappings or add new mappings.
72
74
  ignore_unserializable_fields: Whether to ignore unserializable fields.
73
75
  """
@@ -195,13 +197,15 @@ def loads(
195
197
 
196
198
  Args:
197
199
  text: The string to load.
198
- secrets_map: A map of secrets to load. If a secret is not found in
199
- the map, it will be loaded from the environment if `secrets_from_env`
200
- is True.
200
+ secrets_map: A map of secrets to load.
201
+
202
+ If a secret is not found in the map, it will be loaded from the environment
203
+ if `secrets_from_env` is `True`.
201
204
  valid_namespaces: A list of additional namespaces (modules)
202
205
  to allow to be deserialized.
203
206
  secrets_from_env: Whether to load secrets from the environment.
204
207
  additional_import_mappings: A dictionary of additional namespace mappings
208
+
205
209
  You can use this to override default mappings or add new mappings.
206
210
  ignore_unserializable_fields: Whether to ignore unserializable fields.
207
211
 
@@ -237,13 +241,15 @@ def load(
237
241
 
238
242
  Args:
239
243
  obj: The object to load.
240
- secrets_map: A map of secrets to load. If a secret is not found in
241
- the map, it will be loaded from the environment if `secrets_from_env`
242
- is True.
244
+ secrets_map: A map of secrets to load.
245
+
246
+ If a secret is not found in the map, it will be loaded from the environment
247
+ if `secrets_from_env` is `True`.
243
248
  valid_namespaces: A list of additional namespaces (modules)
244
249
  to allow to be deserialized.
245
250
  secrets_from_env: Whether to load secrets from the environment.
246
251
  additional_import_mappings: A dictionary of additional namespace mappings
252
+
247
253
  You can use this to override default mappings or add new mappings.
248
254
  ignore_unserializable_fields: Whether to ignore unserializable fields.
249
255
 
@@ -5,11 +5,9 @@ from __future__ import annotations
5
5
  from typing import TYPE_CHECKING, Any, cast, overload
6
6
 
7
7
  from pydantic import ConfigDict, Field
8
- from typing_extensions import Self
9
8
 
10
9
  from langchain_core._api.deprecation import warn_deprecated
11
10
  from langchain_core.load.serializable import Serializable
12
- from langchain_core.messages import content as types
13
11
  from langchain_core.utils import get_bolded_text
14
12
  from langchain_core.utils._merge import merge_dicts, merge_lists
15
13
  from langchain_core.utils.interactive_env import is_interactive_env
@@ -17,6 +15,9 @@ from langchain_core.utils.interactive_env import is_interactive_env
17
15
  if TYPE_CHECKING:
18
16
  from collections.abc import Sequence
19
17
 
18
+ from typing_extensions import Self
19
+
20
+ from langchain_core.messages import content as types
20
21
  from langchain_core.prompts.chat import ChatPromptTemplate
21
22
 
22
23
 
@@ -12,10 +12,11 @@ the implementation in `BaseMessage`.
12
12
 
13
13
  from __future__ import annotations
14
14
 
15
- from collections.abc import Callable
16
15
  from typing import TYPE_CHECKING
17
16
 
18
17
  if TYPE_CHECKING:
18
+ from collections.abc import Callable
19
+
19
20
  from langchain_core.messages import AIMessage, AIMessageChunk
20
21
  from langchain_core.messages import content as types
21
22
 
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import warnings
7
- from collections.abc import Iterable
8
7
  from typing import TYPE_CHECKING, Any, Literal, cast
9
8
 
10
9
  from langchain_core.language_models._utils import (
@@ -14,6 +13,8 @@ from langchain_core.language_models._utils import (
14
13
  from langchain_core.messages import content as types
15
14
 
16
15
  if TYPE_CHECKING:
16
+ from collections.abc import Iterable
17
+
17
18
  from langchain_core.messages import AIMessage, AIMessageChunk
18
19
 
19
20
 
@@ -2,15 +2,17 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Literal
5
+ from typing import TYPE_CHECKING, Literal
6
6
 
7
7
  from pydantic import model_validator
8
- from typing_extensions import Self
9
8
 
10
9
  from langchain_core.messages import BaseMessage, BaseMessageChunk
11
10
  from langchain_core.outputs.generation import Generation
12
11
  from langchain_core.utils._merge import merge_dicts
13
12
 
13
+ if TYPE_CHECKING:
14
+ from typing_extensions import Self
15
+
14
16
 
15
17
  class ChatGeneration(Generation):
16
18
  """A single chat generation output.
@@ -6,7 +6,7 @@ import contextlib
6
6
  import json
7
7
  import typing
8
8
  from abc import ABC, abstractmethod
9
- from collections.abc import Callable, Mapping
9
+ from collections.abc import Mapping
10
10
  from functools import cached_property
11
11
  from pathlib import Path
12
12
  from typing import (
@@ -33,6 +33,8 @@ from langchain_core.runnables.config import ensure_config
33
33
  from langchain_core.utils.pydantic import create_model_v2
34
34
 
35
35
  if TYPE_CHECKING:
36
+ from collections.abc import Callable
37
+
36
38
  from langchain_core.documents import Document
37
39
 
38
40
 
@@ -6,10 +6,10 @@ from abc import ABC, abstractmethod
6
6
  from typing import TYPE_CHECKING, Any
7
7
 
8
8
  from langchain_core.load import Serializable
9
- from langchain_core.messages import BaseMessage
10
9
  from langchain_core.utils.interactive_env import is_interactive_env
11
10
 
12
11
  if TYPE_CHECKING:
12
+ from langchain_core.messages import BaseMessage
13
13
  from langchain_core.prompts.chat import ChatPromptTemplate
14
14
 
15
15
 
@@ -4,9 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  import warnings
6
6
  from abc import ABC
7
- from collections.abc import Callable, Sequence
8
7
  from string import Formatter
9
- from typing import Any, Literal
8
+ from typing import TYPE_CHECKING, Any, Literal
10
9
 
11
10
  from pydantic import BaseModel, create_model
12
11
 
@@ -16,10 +15,70 @@ from langchain_core.utils import get_colored_text, mustache
16
15
  from langchain_core.utils.formatting import formatter
17
16
  from langchain_core.utils.interactive_env import is_interactive_env
18
17
 
18
+ if TYPE_CHECKING:
19
+ from collections.abc import Callable, Sequence
20
+
19
21
  try:
20
- from jinja2 import Environment, meta
22
+ from jinja2 import meta
23
+ from jinja2.exceptions import SecurityError
21
24
  from jinja2.sandbox import SandboxedEnvironment
22
25
 
26
+ class _RestrictedSandboxedEnvironment(SandboxedEnvironment):
27
+ """A more restrictive Jinja2 sandbox that blocks all attribute/method access.
28
+
29
+ This sandbox only allows simple variable lookups, no attribute or method access.
30
+ This prevents template injection attacks via methods like parse_raw().
31
+ """
32
+
33
+ def is_safe_attribute(self, _obj: Any, _attr: str, _value: Any) -> bool:
34
+ """Block ALL attribute access for security.
35
+
36
+ Only allow accessing variables directly from the context dict,
37
+ no attribute access on those objects.
38
+
39
+ Args:
40
+ _obj: The object being accessed (unused, always blocked).
41
+ _attr: The attribute name (unused, always blocked).
42
+ _value: The attribute value (unused, always blocked).
43
+
44
+ Returns:
45
+ False - all attribute access is blocked.
46
+ """
47
+ # Block all attribute access
48
+ return False
49
+
50
+ def is_safe_callable(self, _obj: Any) -> bool:
51
+ """Block all method calls for security.
52
+
53
+ Args:
54
+ _obj: The object being checked (unused, always blocked).
55
+
56
+ Returns:
57
+ False - all callables are blocked.
58
+ """
59
+ return False
60
+
61
+ def getattr(self, obj: Any, attribute: str) -> Any:
62
+ """Override getattr to block all attribute access.
63
+
64
+ Args:
65
+ obj: The object.
66
+ attribute: The attribute name.
67
+
68
+ Returns:
69
+ Never returns.
70
+
71
+ Raises:
72
+ SecurityError: Always, to block attribute access.
73
+ """
74
+ msg = (
75
+ f"Access to attributes is not allowed in templates. "
76
+ f"Attempted to access '{attribute}' on {type(obj).__name__}. "
77
+ f"Use only simple variable names like {{{{variable}}}} "
78
+ f"without dots or methods."
79
+ )
80
+ raise SecurityError(msg)
81
+
23
82
  _HAS_JINJA2 = True
24
83
  except ImportError:
25
84
  _HAS_JINJA2 = False
@@ -59,14 +118,10 @@ def jinja2_formatter(template: str, /, **kwargs: Any) -> str:
59
118
  )
60
119
  raise ImportError(msg)
61
120
 
62
- # This uses a sandboxed environment to prevent arbitrary code execution.
63
- # Jinja2 uses an opt-out rather than opt-in approach for sand-boxing.
64
- # Please treat this sand-boxing as a best-effort approach rather than
65
- # a guarantee of security.
66
- # We recommend to never use jinja2 templates with untrusted inputs.
67
- # https://jinja.palletsprojects.com/en/3.1.x/sandbox/
68
- # approach not a guarantee of security.
69
- return SandboxedEnvironment().from_string(template).render(**kwargs)
121
+ # Use a restricted sandbox that blocks ALL attribute/method access
122
+ # Only simple variable lookups like {{variable}} are allowed
123
+ # Attribute access like {{variable.attr}} or {{variable.method()}} is blocked
124
+ return _RestrictedSandboxedEnvironment().from_string(template).render(**kwargs)
70
125
 
71
126
 
72
127
  def validate_jinja2(template: str, input_variables: list[str]) -> None:
@@ -101,7 +156,7 @@ def _get_jinja2_variables_from_template(template: str) -> set[str]:
101
156
  "Please install it with `pip install jinja2`."
102
157
  )
103
158
  raise ImportError(msg)
104
- env = Environment() # noqa: S701
159
+ env = _RestrictedSandboxedEnvironment()
105
160
  ast = env.parse(template)
106
161
  return meta.find_undeclared_variables(ast)
107
162
 
@@ -271,6 +326,30 @@ def get_template_variables(template: str, template_format: str) -> list[str]:
271
326
  msg = f"Unsupported template format: {template_format}"
272
327
  raise ValueError(msg)
273
328
 
329
+ # For f-strings, block attribute access and indexing syntax
330
+ # This prevents template injection attacks via accessing dangerous attributes
331
+ if template_format == "f-string":
332
+ for var in input_variables:
333
+ # Formatter().parse() returns field names with dots/brackets if present
334
+ # e.g., "obj.attr" or "obj[0]" - we need to block these
335
+ if "." in var or "[" in var or "]" in var:
336
+ msg = (
337
+ f"Invalid variable name {var!r} in f-string template. "
338
+ f"Variable names cannot contain attribute "
339
+ f"access (.) or indexing ([])."
340
+ )
341
+ raise ValueError(msg)
342
+
343
+ # Block variable names that are all digits (e.g., "0", "100")
344
+ # These are interpreted as positional arguments, not keyword arguments
345
+ if var.isdigit():
346
+ msg = (
347
+ f"Invalid variable name {var!r} in f-string template. "
348
+ f"Variable names cannot be all digits as they are interpreted "
349
+ f"as positional arguments."
350
+ )
351
+ raise ValueError(msg)
352
+
274
353
  return sorted(input_variables)
275
354
 
276
355
 
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import inspect
6
6
  from collections import defaultdict
7
- from collections.abc import Callable
8
7
  from dataclasses import dataclass, field
9
8
  from enum import Enum
10
9
  from typing import (
@@ -22,7 +21,7 @@ from langchain_core.runnables.base import Runnable, RunnableSerializable
22
21
  from langchain_core.utils.pydantic import _IgnoreUnserializable, is_basemodel_subclass
23
22
 
24
23
  if TYPE_CHECKING:
25
- from collections.abc import Sequence
24
+ from collections.abc import Callable, Sequence
26
25
 
27
26
  from pydantic import BaseModel
28
27
 
@@ -642,6 +641,7 @@ class Graph:
642
641
  retry_delay: float = 1.0,
643
642
  frontmatter_config: dict[str, Any] | None = None,
644
643
  base_url: str | None = None,
644
+ proxies: dict[str, str] | None = None,
645
645
  ) -> bytes:
646
646
  """Draw the graph as a PNG image using Mermaid.
647
647
 
@@ -674,11 +674,10 @@ class Graph:
674
674
  }
675
675
  ```
676
676
  base_url: The base URL of the Mermaid server for rendering via API.
677
-
677
+ proxies: HTTP/HTTPS proxies for requests (e.g. `{"http": "http://127.0.0.1:7890"}`).
678
678
 
679
679
  Returns:
680
680
  The PNG image as bytes.
681
-
682
681
  """
683
682
  # Import locally to prevent circular import
684
683
  from langchain_core.runnables.graph_mermaid import ( # noqa: PLC0415
@@ -699,6 +698,7 @@ class Graph:
699
698
  padding=padding,
700
699
  max_retries=max_retries,
701
700
  retry_delay=retry_delay,
701
+ proxies=proxies,
702
702
  base_url=base_url,
703
703
  )
704
704
 
@@ -7,7 +7,6 @@ from __future__ import annotations
7
7
 
8
8
  import math
9
9
  import os
10
- from collections.abc import Mapping, Sequence
11
10
  from typing import TYPE_CHECKING, Any
12
11
 
13
12
  try:
@@ -20,6 +19,8 @@ except ImportError:
20
19
  _HAS_GRANDALF = False
21
20
 
22
21
  if TYPE_CHECKING:
22
+ from collections.abc import Mapping, Sequence
23
+
23
24
  from langchain_core.runnables.graph import Edge as LangEdge
24
25
 
25
26
 
@@ -281,6 +281,7 @@ def draw_mermaid_png(
281
281
  max_retries: int = 1,
282
282
  retry_delay: float = 1.0,
283
283
  base_url: str | None = None,
284
+ proxies: dict[str, str] | None = None,
284
285
  ) -> bytes:
285
286
  """Draws a Mermaid graph as PNG using provided syntax.
286
287
 
@@ -293,6 +294,7 @@ def draw_mermaid_png(
293
294
  max_retries: Maximum number of retries (MermaidDrawMethod.API).
294
295
  retry_delay: Delay between retries (MermaidDrawMethod.API).
295
296
  base_url: Base URL for the Mermaid.ink API.
297
+ proxies: HTTP/HTTPS proxies for requests (e.g. `{"http": "http://127.0.0.1:7890"}`).
296
298
 
297
299
  Returns:
298
300
  PNG image bytes.
@@ -314,6 +316,7 @@ def draw_mermaid_png(
314
316
  max_retries=max_retries,
315
317
  retry_delay=retry_delay,
316
318
  base_url=base_url,
319
+ proxies=proxies,
317
320
  )
318
321
  else:
319
322
  supported_methods = ", ".join([m.value for m in MermaidDrawMethod])
@@ -405,6 +408,7 @@ def _render_mermaid_using_api(
405
408
  file_type: Literal["jpeg", "png", "webp"] | None = "png",
406
409
  max_retries: int = 1,
407
410
  retry_delay: float = 1.0,
411
+ proxies: dict[str, str] | None = None,
408
412
  base_url: str | None = None,
409
413
  ) -> bytes:
410
414
  """Renders Mermaid graph using the Mermaid.INK API."""
@@ -445,7 +449,7 @@ def _render_mermaid_using_api(
445
449
 
446
450
  for attempt in range(max_retries + 1):
447
451
  try:
448
- response = requests.get(image_url, timeout=10)
452
+ response = requests.get(image_url, timeout=10, proxies=proxies)
449
453
  if response.status_code == requests.codes.ok:
450
454
  img_bytes = response.content
451
455
  if output_file_path is not None:
@@ -7,8 +7,7 @@ import asyncio
7
7
  import inspect
8
8
  import sys
9
9
  import textwrap
10
- from collections.abc import Callable, Mapping, Sequence
11
- from contextvars import Context
10
+ from collections.abc import Mapping, Sequence
12
11
  from functools import lru_cache
13
12
  from inspect import signature
14
13
  from itertools import groupby
@@ -31,9 +30,11 @@ if TYPE_CHECKING:
31
30
  AsyncIterable,
32
31
  AsyncIterator,
33
32
  Awaitable,
33
+ Callable,
34
34
  Coroutine,
35
35
  Iterable,
36
36
  )
37
+ from contextvars import Context
37
38
 
38
39
  from langchain_core.runnables.schema import StreamEvent
39
40
 
@@ -386,6 +386,8 @@ class ToolException(Exception): # noqa: N818
386
386
 
387
387
  ArgsSchema = TypeBaseModel | dict[str, Any]
388
388
 
389
+ _EMPTY_SET: frozenset[str] = frozenset()
390
+
389
391
 
390
392
  class BaseTool(RunnableSerializable[str | dict | ToolCall, Any]):
391
393
  """Base class for all LangChain tools.
@@ -569,6 +571,11 @@ class ChildTool(BaseTool):
569
571
  self.name, full_schema, fields, fn_description=self.description
570
572
  )
571
573
 
574
+ @functools.cached_property
575
+ def _injected_args_keys(self) -> frozenset[str]:
576
+ # base implementation doesn't manage injected args
577
+ return _EMPTY_SET
578
+
572
579
  # --- Runnable ---
573
580
 
574
581
  @override
@@ -649,6 +656,7 @@ class ChildTool(BaseTool):
649
656
  if isinstance(input_args, dict):
650
657
  return tool_input
651
658
  if issubclass(input_args, BaseModel):
659
+ # Check args_schema for InjectedToolCallId
652
660
  for k, v in get_all_basemodel_annotations(input_args).items():
653
661
  if _is_injected_arg_type(v, injected_type=InjectedToolCallId):
654
662
  if tool_call_id is None:
@@ -664,6 +672,7 @@ class ChildTool(BaseTool):
664
672
  result = input_args.model_validate(tool_input)
665
673
  result_dict = result.model_dump()
666
674
  elif issubclass(input_args, BaseModelV1):
675
+ # Check args_schema for InjectedToolCallId
667
676
  for k, v in get_all_basemodel_annotations(input_args).items():
668
677
  if _is_injected_arg_type(v, injected_type=InjectedToolCallId):
669
678
  if tool_call_id is None:
@@ -683,9 +692,25 @@ class ChildTool(BaseTool):
683
692
  f"args_schema must be a Pydantic BaseModel, got {self.args_schema}"
684
693
  )
685
694
  raise NotImplementedError(msg)
686
- return {
687
- k: getattr(result, k) for k, v in result_dict.items() if k in tool_input
695
+ validated_input = {
696
+ k: getattr(result, k) for k in result_dict if k in tool_input
688
697
  }
698
+ for k in self._injected_args_keys:
699
+ if k == "tool_call_id":
700
+ if tool_call_id is None:
701
+ msg = (
702
+ "When tool includes an InjectedToolCallId "
703
+ "argument, tool must always be invoked with a full "
704
+ "model ToolCall of the form: {'args': {...}, "
705
+ "'name': '...', 'type': 'tool_call', "
706
+ "'tool_call_id': '...'}"
707
+ )
708
+ raise ValueError(msg)
709
+ validated_input[k] = tool_call_id
710
+ if k in tool_input:
711
+ injected_val = tool_input[k]
712
+ validated_input[k] = injected_val
713
+ return validated_input
689
714
  return tool_input
690
715
 
691
716
  @abstractmethod
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import functools
5
6
  import textwrap
6
7
  from collections.abc import Awaitable, Callable
7
8
  from inspect import signature
@@ -21,10 +22,12 @@ from langchain_core.callbacks import (
21
22
  )
22
23
  from langchain_core.runnables import RunnableConfig, run_in_executor
23
24
  from langchain_core.tools.base import (
25
+ _EMPTY_SET,
24
26
  FILTERED_ARGS,
25
27
  ArgsSchema,
26
28
  BaseTool,
27
29
  _get_runnable_config_param,
30
+ _is_injected_arg_type,
28
31
  create_schema_from_function,
29
32
  )
30
33
  from langchain_core.utils.pydantic import is_basemodel_subclass
@@ -241,6 +244,17 @@ class StructuredTool(BaseTool):
241
244
  **kwargs,
242
245
  )
243
246
 
247
+ @functools.cached_property
248
+ def _injected_args_keys(self) -> frozenset[str]:
249
+ fn = self.func or self.coroutine
250
+ if fn is None:
251
+ return _EMPTY_SET
252
+ return frozenset(
253
+ k
254
+ for k, v in signature(fn).parameters.items()
255
+ if _is_injected_arg_type(v.annotation)
256
+ )
257
+
244
258
 
245
259
  def _filter_schema_args(func: Callable) -> list[str]:
246
260
  filter_args = list(FILTERED_ARGS)
@@ -15,12 +15,6 @@ from typing import (
15
15
 
16
16
  from langchain_core.exceptions import TracerException
17
17
  from langchain_core.load import dumpd
18
- from langchain_core.outputs import (
19
- ChatGeneration,
20
- ChatGenerationChunk,
21
- GenerationChunk,
22
- LLMResult,
23
- )
24
18
  from langchain_core.tracers.schemas import Run
25
19
 
26
20
  if TYPE_CHECKING:
@@ -31,6 +25,12 @@ if TYPE_CHECKING:
31
25
 
32
26
  from langchain_core.documents import Document
33
27
  from langchain_core.messages import BaseMessage
28
+ from langchain_core.outputs import (
29
+ ChatGeneration,
30
+ ChatGenerationChunk,
31
+ GenerationChunk,
32
+ LLMResult,
33
+ )
34
34
 
35
35
  logger = logging.getLogger(__name__)
36
36
 
@@ -8,7 +8,6 @@ import logging
8
8
  import types
9
9
  import typing
10
10
  import uuid
11
- from collections.abc import Callable
12
11
  from typing import (
13
12
  TYPE_CHECKING,
14
13
  Annotated,
@@ -33,6 +32,8 @@ from langchain_core.utils.json_schema import dereference_refs
33
32
  from langchain_core.utils.pydantic import is_basemodel_subclass
34
33
 
35
34
  if TYPE_CHECKING:
35
+ from collections.abc import Callable
36
+
36
37
  from langchain_core.tools import BaseTool
37
38
 
38
39
  logger = logging.getLogger(__name__)
@@ -4,11 +4,13 @@ from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import re
7
- from collections.abc import Callable
8
- from typing import Any
7
+ from typing import TYPE_CHECKING, Any
9
8
 
10
9
  from langchain_core.exceptions import OutputParserException
11
10
 
11
+ if TYPE_CHECKING:
12
+ from collections.abc import Callable
13
+
12
14
 
13
15
  def _replace_new_line(match: re.Match[str]) -> str:
14
16
  value = match.group(2)
@@ -374,15 +374,29 @@ def _get_key(
374
374
  if resolved_scope in (0, False):
375
375
  return resolved_scope
376
376
  # Move into the scope
377
- try:
378
- # Try subscripting (Normal dictionaries)
379
- resolved_scope = cast("dict[str, Any]", resolved_scope)[child]
380
- except (TypeError, AttributeError):
377
+ if isinstance(resolved_scope, dict):
381
378
  try:
382
- resolved_scope = getattr(resolved_scope, child)
383
- except (TypeError, AttributeError):
384
- # Try as a list
385
- resolved_scope = resolved_scope[int(child)] # type: ignore[index]
379
+ resolved_scope = resolved_scope[child]
380
+ except (KeyError, TypeError):
381
+ # Key not found - will be caught by outer try-except
382
+ msg = f"Key {child!r} not found in dict"
383
+ raise KeyError(msg) from None
384
+ elif isinstance(resolved_scope, (list, tuple)):
385
+ try:
386
+ resolved_scope = resolved_scope[int(child)]
387
+ except (ValueError, IndexError, TypeError):
388
+ # Invalid index - will be caught by outer try-except
389
+ msg = f"Invalid index {child!r} for list/tuple"
390
+ raise IndexError(msg) from None
391
+ else:
392
+ # Reject everything else for security
393
+ # This prevents traversing into arbitrary Python objects
394
+ msg = (
395
+ f"Cannot traverse into {type(resolved_scope).__name__}. "
396
+ "Mustache templates only support dict, list, and tuple. "
397
+ f"Got: {type(resolved_scope)}"
398
+ )
399
+ raise TypeError(msg) # noqa: TRY301
386
400
 
387
401
  try:
388
402
  # This allows for custom falsy data types
@@ -393,8 +407,9 @@ def _get_key(
393
407
  if resolved_scope in (0, False):
394
408
  return resolved_scope
395
409
  return resolved_scope or ""
396
- except (AttributeError, KeyError, IndexError, ValueError):
410
+ except (AttributeError, KeyError, IndexError, ValueError, TypeError):
397
411
  # We couldn't find the key in the current scope
412
+ # TypeError: Attempted to traverse into non-dict/list type
398
413
  # We'll try again on the next pass
399
414
  pass
400
415
 
@@ -5,7 +5,6 @@ from __future__ import annotations
5
5
  import inspect
6
6
  import textwrap
7
7
  import warnings
8
- from collections.abc import Callable
9
8
  from contextlib import nullcontext
10
9
  from functools import lru_cache, wraps
11
10
  from types import GenericAlias
@@ -41,10 +40,12 @@ from pydantic.json_schema import (
41
40
  )
42
41
  from pydantic.v1 import BaseModel as BaseModelV1
43
42
  from pydantic.v1 import create_model as create_model_v1
44
- from pydantic.v1.fields import ModelField
45
43
  from typing_extensions import deprecated, override
46
44
 
47
45
  if TYPE_CHECKING:
46
+ from collections.abc import Callable
47
+
48
+ from pydantic.v1.fields import ModelField
48
49
  from pydantic_core import core_schema
49
50
 
50
51
  PYDANTIC_VERSION = version.parse(pydantic.__version__)
@@ -11,7 +11,6 @@ import logging
11
11
  import math
12
12
  import warnings
13
13
  from abc import ABC, abstractmethod
14
- from collections.abc import Callable
15
14
  from itertools import cycle
16
15
  from typing import (
17
16
  TYPE_CHECKING,
@@ -29,7 +28,7 @@ from langchain_core.retrievers import BaseRetriever, LangSmithRetrieverParams
29
28
  from langchain_core.runnables.config import run_in_executor
30
29
 
31
30
  if TYPE_CHECKING:
32
- from collections.abc import Collection, Iterable, Iterator, Sequence
31
+ from collections.abc import Callable, Collection, Iterable, Iterator, Sequence
33
32
 
34
33
  from langchain_core.callbacks.manager import (
35
34
  AsyncCallbackManagerForRetrieverRun,
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
 
5
5
  import json
6
6
  import uuid
7
- from collections.abc import Callable
8
7
  from pathlib import Path
9
8
  from typing import (
10
9
  TYPE_CHECKING,
@@ -20,7 +19,7 @@ from langchain_core.vectorstores.utils import _cosine_similarity as cosine_simil
20
19
  from langchain_core.vectorstores.utils import maximal_marginal_relevance
21
20
 
22
21
  if TYPE_CHECKING:
23
- from collections.abc import Iterator, Sequence
22
+ from collections.abc import Callable, Iterator, Sequence
24
23
 
25
24
  from langchain_core.embeddings import Embeddings
26
25
 
langchain_core/version.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """langchain-core version information and utilities."""
2
2
 
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langchain-core
3
- Version: 1.0.4
3
+ Version: 1.0.7
4
4
  Summary: Building applications with LLMs through composability
5
5
  Project-URL: Homepage, https://docs.langchain.com/
6
6
  Project-URL: Documentation, https://reference.langchain.com/python/langchain_core/
@@ -56,7 +56,7 @@ The LangChain ecosystem is built on top of `langchain-core`. Some of the benefit
56
56
 
57
57
  ## 📖 Documentation
58
58
 
59
- For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/).
59
+ For full documentation, see the [API reference](https://reference.langchain.com/python/langchain_core/). For conceptual guides, tutorials, and examples on using LangChain, see the [LangChain Docs](https://docs.langchain.com/oss/python/langchain/overview).
60
60
 
61
61
  ## 📕 Releases & Versioning
62
62
 
@@ -15,16 +15,16 @@ langchain_core/retrievers.py,sha256=SXnCc_85rNcLeMa-SjvkijXpFw-I7SVTWYgV1gJQimg,
15
15
  langchain_core/stores.py,sha256=g8aa_VvXf93-Q25QMXX_sBoKC99nu3FtyC4INOUJ3WY,9181
16
16
  langchain_core/structured_query.py,sha256=mat7BKovKjckzMn3-I1El49yeGjg3cqk4ptpJHAPA-4,5123
17
17
  langchain_core/sys_info.py,sha256=SEFI7XL2qpx1lis6cB45o6ZKtRCZWVXwEngU3UGMgrE,3806
18
- langchain_core/version.py,sha256=jsSUK0COG4FbOhVVZciwojkcMijh4NASlpjwDN7HBpA,75
18
+ langchain_core/version.py,sha256=cFzsjswCa-CtIr7XINgrfnB5V6ZQT05GwZLHnpGKNV0,75
19
19
  langchain_core/_api/__init__.py,sha256=PYm_j7qRRKh5ca0TTra5UF-nko3ieZZZ5EeAFAinm3o,1973
20
20
  langchain_core/_api/beta_decorator.py,sha256=IJgG2_kRb2eBmvHfarDjanJY4k1jwoPJWSOHZ5SLB4U,8664
21
21
  langchain_core/_api/deprecation.py,sha256=nReAhxZ1dBwLhHdGAaqqRpf7aLQJ1dw4UtqmrRqeNLE,20296
22
22
  langchain_core/_api/internal.py,sha256=aOZkYANu747LyWzyAk-0KE4RjdTYj18Wtlh7F9_qyPM,683
23
23
  langchain_core/_api/path.py,sha256=y3dAvsG4JS0BuWErpJ5KhxCykJX2i03kYdeDU-Iup3Y,1349
24
24
  langchain_core/callbacks/__init__.py,sha256=8FK0gmkWnbDYWrShBQowg0OK06Hprdim3sxiOla80xk,4225
25
- langchain_core/callbacks/base.py,sha256=I0LBEFdUiFKxya1G4026Fp47Uz3qfcgg8pCr28-UQL0,34017
25
+ langchain_core/callbacks/base.py,sha256=a7xwSEi6tPM6ZMmZ438dBI4uyjgcB-KyyWEpIeMb4eU,34020
26
26
  langchain_core/callbacks/file.py,sha256=eD1TBPnEzms0amUV_GnNbfLOPF7Et7Z-sCv6fl-7h38,8332
27
- langchain_core/callbacks/manager.py,sha256=w5PuRBT9VwLmOSj-ZJ57ZXDGjxPtCCSOquWM2xUtlpY,85312
27
+ langchain_core/callbacks/manager.py,sha256=rCKzu8gjE-8wAIHme-vapr05eXaqNvAQV9Kconl-hrM,85316
28
28
  langchain_core/callbacks/stdout.py,sha256=dy7jTcYFVKpaYesJoakEcAraBLwhjFR5Efjw91EZY8c,3695
29
29
  langchain_core/callbacks/streaming_stdout.py,sha256=ylgpp4Bhs5Gv1aNeZWuuC2FU7C3IO7Q9CpEDxCgdFXY,4310
30
30
  langchain_core/callbacks/usage.py,sha256=NGtm_P287FAEGXd6Ci4ZGouywYtNwsoHKno6O9H_zg8,5073
@@ -44,24 +44,24 @@ langchain_core/example_selectors/base.py,sha256=4wRCERHak6Ci5JEKHeidQ_pbBgzQyc-v
44
44
  langchain_core/example_selectors/length_based.py,sha256=IcM89ho2xmFLan2-wL29YyUfRwSCg4z8hWLqerx-YSc,3366
45
45
  langchain_core/example_selectors/semantic_similarity.py,sha256=Rh_-8vZi58gwn7Qa3Tk30zsvx7RiPIjFWw2_sfwKHfQ,13577
46
46
  langchain_core/indexing/__init__.py,sha256=KD9ArRpfVccb1fyk2t1QWqrBv1dfyk_Zg9fuSt-BzLQ,1276
47
- langchain_core/indexing/api.py,sha256=ci6jS21Fxi63tszZR0EvRq8pHLedW1dIaL0srMgUIUE,38381
47
+ langchain_core/indexing/api.py,sha256=TvXGLTCj0Kp-FLZzowXjW5T4SFI8pPUndgDF2IKd3rE,38451
48
48
  langchain_core/indexing/base.py,sha256=rHZNecyskIjRR8L4B5Q-XQgeoVZFI1HUjfox_ExIebM,22449
49
49
  langchain_core/indexing/in_memory.py,sha256=eML8Wtg9m4nOI7RFdoyXWxgxSfrOCEUJn-ipoRbkJOc,3283
50
50
  langchain_core/language_models/__init__.py,sha256=vhD0sTo9w2VKoR63NojWywv8jfoJEcP6inIkNtY6qa0,3296
51
51
  langchain_core/language_models/_utils.py,sha256=6Xpqb0fO4KKnA6mX5XfHbmm2xs2TizcqVGfxaj42sOA,11045
52
- langchain_core/language_models/base.py,sha256=Srzk6Rp4XIAMXHYU2cSbbceFKytuXHU4Y9jgaVSIXJQ,11014
53
- langchain_core/language_models/chat_models.py,sha256=KuMG91oqZL3dMSf1qRBtY3R6WyI3WVqDF8PqFiJ8a0E,72405
52
+ langchain_core/language_models/base.py,sha256=8sHklgGdzKoc-VIVVZ46wMGO5mCbcYtRBARfu7Jh0E4,11598
53
+ langchain_core/language_models/chat_models.py,sha256=16dfuWqUN-gMO9Fw9jCQxVSf7Tz8SaOsLm-CyDH0Iow,72508
54
54
  langchain_core/language_models/fake.py,sha256=hb2yU3snYPTueZiJ-0KI0MKHYBNm6zdUw7xe8WqguEY,3732
55
55
  langchain_core/language_models/fake_chat_models.py,sha256=kzvrYAI6gVaY76PPTApMWTn8ZCgJymOPsUaPZLlali4,13509
56
56
  langchain_core/language_models/llms.py,sha256=7nCj0J38aFF--ATYab7e4GZNnlRjxBrLmFu6Rwa9dh4,54118
57
57
  langchain_core/load/__init__.py,sha256=m3_6Fk2gpYZO0xqyTnZzdQigvsYHjMariLq_L2KwJFk,1150
58
58
  langchain_core/load/dump.py,sha256=DEO-m_bBPyzFCIvxJND-p4iGuNISeWbl8jzcDICt3Bw,2616
59
- langchain_core/load/load.py,sha256=LQJqeERSO5mlqImCDMLXDwmtpvEssVJJi3Iau7qpY4M,9283
59
+ langchain_core/load/load.py,sha256=H11FDWivRXutaRpZpamkZAYGzPkXwOjP__TkCkNx4Vg,9295
60
60
  langchain_core/load/mapping.py,sha256=SqBaAWAM2aV_Wgy80DAlS-39tJkHLcCyM45bVVnN12w,29513
61
61
  langchain_core/load/serializable.py,sha256=pm0kA1HZ_wOp0TkJvTbj5bxu0hFWZ0OzQV1BKbVK4jM,11683
62
62
  langchain_core/messages/__init__.py,sha256=hrsxGO0wLEIr81gpu2cL89kV6PeiW1yY-G0rhqYYXms,5723
63
63
  langchain_core/messages/ai.py,sha256=vS4GXL0K_dganLZxo_RBVWaVbVKwU4lfey-6jSCqkYo,27458
64
- langchain_core/messages/base.py,sha256=j4_GZ6kn6n4ZczZE8O_-1mNNd2BrkaKBIX4pPnBNJKE,16447
64
+ langchain_core/messages/base.py,sha256=HasOOo3qcJQSH_Q6kl7S5AVF4ElZW55My3WJxPS9vTs,16456
65
65
  langchain_core/messages/chat.py,sha256=t9az-R1De2HdiEhhpGyIFonCqY03UAkqMdvttx11rhM,2204
66
66
  langchain_core/messages/content.py,sha256=M4icC9tEEVBORdcm_W0MqL6QFTFxnx1tpzh7JGvGNAo,41962
67
67
  langchain_core/messages/function.py,sha256=RlkcFREWGgAlnD0psOOWc2kQa7wVZ-kJBl-mi-UIcdw,2094
@@ -70,7 +70,7 @@ langchain_core/messages/modifier.py,sha256=8d3mhHnKMDU9Xkw_M3-uf5WBtqA4dZj81tD7A
70
70
  langchain_core/messages/system.py,sha256=x8OBdba68Nt3SiO7aNTaDREq3iDjDV4XyRoqb-ZOmgo,2140
71
71
  langchain_core/messages/tool.py,sha256=MMklOAPd2e0OAGxM3Iode_Bm3bC74_icN3HnL2FPCig,12584
72
72
  langchain_core/messages/utils.py,sha256=CXARduPzvNERth0wcqOUJt06RwFCNEGQPdVdfsfaG9A,68766
73
- langchain_core/messages/block_translators/__init__.py,sha256=_CxgFIR8hrxROFl1dzRNwkL4cgL-TxxpYQBn-26zP4A,4244
73
+ langchain_core/messages/block_translators/__init__.py,sha256=ow_94AoqdcAZieFlpjO75l-ZcnBwXznTMhrqruXv8gw,4249
74
74
  langchain_core/messages/block_translators/anthropic.py,sha256=eN304DgrEFTRl12f4PmU4P8ASTUngMkE7HC9-gpYUGk,19131
75
75
  langchain_core/messages/block_translators/bedrock.py,sha256=yLjYwtCsYGHBEj9CSXHCZYLmwsA4F6D6NTT5kE11Bww,3511
76
76
  langchain_core/messages/block_translators/bedrock_converse.py,sha256=YN7xfKPbxjVJujOzEuXbDx3QiDql1ldbLCYQ6bgH6FI,11994
@@ -78,7 +78,7 @@ langchain_core/messages/block_translators/google_genai.py,sha256=STcn7J0kZf25M8r
78
78
  langchain_core/messages/block_translators/google_vertexai.py,sha256=2RzpKFKi1991aWGK8osdkKq8bKadmy8q86kR3r0f6K4,632
79
79
  langchain_core/messages/block_translators/groq.py,sha256=s7xCVITYV2W3CqZpc3OO7hXQRICLqNi8hyPofT2OvqM,5444
80
80
  langchain_core/messages/block_translators/langchain_v0.py,sha256=WAoQGt1qZ5rVZD5n1A1z0dR-DpN6vgrn-gSII1CxhCA,11658
81
- langchain_core/messages/block_translators/openai.py,sha256=YAb6lgCJvFYZg5tjhQbN-VmHyBJSnJgFTE5JO2k9ht4,39261
81
+ langchain_core/messages/block_translators/openai.py,sha256=ffTd6O4H7OTA8Cx3jHmFRglbqmJU5aa63kx2SWcWKnw,39266
82
82
  langchain_core/output_parsers/__init__.py,sha256=g5MPrD8sJK8jeZRCICvWRp-dtAq1jqy-fF-wS5egr5Q,3487
83
83
  langchain_core/output_parsers/base.py,sha256=HeXUl8zdqaYG_KOPWmi-A4YWyDhPuGD78ZOLoH6XoLQ,11161
84
84
  langchain_core/output_parsers/format_instructions.py,sha256=HK-KjPfQfBNj0V_ato0_GN7PFsC-Wixt8V2Q515FdJk,1108
@@ -91,22 +91,22 @@ langchain_core/output_parsers/string.py,sha256=8XgjoeKSc39TN8HMXjMgxcE0vvP6b4kk9
91
91
  langchain_core/output_parsers/transform.py,sha256=FyYvkS1KnAHX9afF1qqdJbUBa_xUyDTvspPQBq8G5uM,5835
92
92
  langchain_core/output_parsers/xml.py,sha256=3OATmB5Ej_6FNCJwkKLX-tyBH1pA2PvdS3JyVKWn-Lc,10974
93
93
  langchain_core/outputs/__init__.py,sha256=CLL4IYb-N18gSXLscJVNWDL2LapGieXJF5EhG8uQSvE,2115
94
- langchain_core/outputs/chat_generation.py,sha256=sD-wCAFWuzADKM7swf9EEaNJmRsEAfZT6tLi00UfPDY,4733
94
+ langchain_core/outputs/chat_generation.py,sha256=SlQc73z7LN_eSCnB_2-deo0joNOvuJAqfTDJBPnnX1M,4771
95
95
  langchain_core/outputs/chat_result.py,sha256=ZXLGUtb5xqJdoCtAX1XeiJf20ELx6gui7DUHH0rKnv8,1324
96
96
  langchain_core/outputs/generation.py,sha256=q_TAIL0_NRkfCK6zsMVJ69G6iiDcJ0TTgoWRlcUtOf0,2564
97
97
  langchain_core/outputs/llm_result.py,sha256=srdoHk-Vk2Xh40XMYAgfsFwGFmvyk2NOkUkvb6U_xZ8,3894
98
98
  langchain_core/outputs/run_info.py,sha256=xCMWdsHfgnnodaf4OCMvZaWUfS836X7mV15JPkqvZjo,594
99
99
  langchain_core/prompts/__init__.py,sha256=gXRJkxl6z7AYTGyyQAF0DQYpbwCUvfCFwXFfhSekzDw,3033
100
- langchain_core/prompts/base.py,sha256=83WlSPJ3c23S5ctHtcThuiVFSuTOYV3aGFOliY8S5bQ,15772
100
+ langchain_core/prompts/base.py,sha256=sqJlloHcbumcoGJZx225Yyj_1irTPX8xsMlElxVr3nw,15804
101
101
  langchain_core/prompts/chat.py,sha256=hE9ZsoyfhN4CcapDsWLsj5e_3QmqWY_Th0bV2LVnMMI,50242
102
102
  langchain_core/prompts/dict.py,sha256=kSMonougSG-o7BZP1PG9L_Vxkf-Xwzjhn1dHJ9j4Cs8,4700
103
103
  langchain_core/prompts/few_shot.py,sha256=FaVMuen4eG0B-lnSr2-jGC_JMOhYoK1tfG-pJgYfcmg,15794
104
104
  langchain_core/prompts/few_shot_with_templates.py,sha256=aKDMxKFmmK8mzAP6I35vpxQUApLs-9AGKCgNcYK9GlA,7804
105
105
  langchain_core/prompts/image.py,sha256=L_5yGsI68Y0pwthA3AS0mQXFMXtvW_kBRItFS6Vpk14,4780
106
106
  langchain_core/prompts/loading.py,sha256=hvNsDvqLz5wJA1EywW2wCwKUhJgUzNcIKfp5VEVOEGc,6889
107
- langchain_core/prompts/message.py,sha256=lonlnWOjDYjmxltD_NA2Z24XiiracUj912nQIF47eQE,2632
107
+ langchain_core/prompts/message.py,sha256=3BdmchS6Y0DCo5edE-R3qcbSqfpbv_AGwE5UcYZ6gU8,2636
108
108
  langchain_core/prompts/prompt.py,sha256=TcQZNc-Y6c7CMJwY1HwMvRYU4NcbMdCw6YS37Tc3pWk,10948
109
- langchain_core/prompts/string.py,sha256=aXr9xhZo4WZqvsBqMWb6Nag5C5Ukqz2fMTRqDx8JaHc,10974
109
+ langchain_core/prompts/string.py,sha256=CAx6sPPXpbHVPe9hwDbmZPKIPxJf4nfvmtGw5xW1CYM,14047
110
110
  langchain_core/prompts/structured.py,sha256=Uzh1PBLXzGyZ-4m4W-cMHz8nqL1XmMri8OOkoSSJiq8,5790
111
111
  langchain_core/runnables/__init__.py,sha256=efTnFjwN_QSAv5ThLmKuWeu8P1BLARH-cWKZBuimfDM,3858
112
112
  langchain_core/runnables/base.py,sha256=vUR1HWB28OkWBWNm03qLCYaewCAWrNguqH9ob-7vJsY,216503
@@ -114,28 +114,28 @@ langchain_core/runnables/branch.py,sha256=Wviy59agVKhbwD_GlMZz-HP5pXZgw5oI5MJb1n
114
114
  langchain_core/runnables/config.py,sha256=w2f2BeYbiXIuXxYJCrmSDIh7LgwSyF-7p92W-sxrbKU,19103
115
115
  langchain_core/runnables/configurable.py,sha256=1FalcSplZ2EITuV-g-TxMoDiS3eZT32OF33ZLjxftd0,24053
116
116
  langchain_core/runnables/fallbacks.py,sha256=60WZ8RoIlE69HsYqAyLncbdh0OhcBxbwvV3NYZogdyk,24468
117
- langchain_core/runnables/graph.py,sha256=mLQcI0XbUDYDXHnDbsybdo1odqSlkitcBEfglY56ihA,22950
118
- langchain_core/runnables/graph_ascii.py,sha256=le9njNqnDYtu1znTWGIyZYstEaiYuxBk9Qx8r7yfoXc,10328
119
- langchain_core/runnables/graph_mermaid.py,sha256=k615r8Q641pb_rpjTlmVc5fTlMco-1IIxQI8t3kBceE,16725
117
+ langchain_core/runnables/graph.py,sha256=7u6LPc6Ih3f6REbyGrRE1R3lacHBTdrt1RPXBAXIdog,23094
118
+ langchain_core/runnables/graph_ascii.py,sha256=F6EzMEL7yWpZxox1fIMvt3v5-uCp6ISbAAkniin9jIc,10333
119
+ langchain_core/runnables/graph_mermaid.py,sha256=hUy4QLzrd3xPks5x9wAahd9TSbk-pHbrkV2zo8b0IfU,16950
120
120
  langchain_core/runnables/graph_png.py,sha256=pdt7_sRPJw38vkKixdb1yYB78kaxIA5ijnAdjJFt3l4,6473
121
121
  langchain_core/runnables/history.py,sha256=5vvSniD6rjPai3bnxp2WxyTMW2jSHxqN0cZflnjoJs4,24264
122
122
  langchain_core/runnables/passthrough.py,sha256=OwSGfJAz1uh54ORppmrQozMe5xDOpM2iB2HhjGkdnjo,26230
123
123
  langchain_core/runnables/retry.py,sha256=eG2LUH0cgIzH7Xe7aVbdYww-04f_o74GRd1VxTocjjU,13682
124
124
  langchain_core/runnables/router.py,sha256=oY_PZb3Mh5Z7j4eBVMO_sXP_f6EapxV0NHknhdQw2rA,7134
125
125
  langchain_core/runnables/schema.py,sha256=elc_pen9QvLkM2MoH7QqjRMqDS0yylwjvbl_gdeOD5Y,5719
126
- langchain_core/runnables/utils.py,sha256=p_QDnwJ7XcO7bl-QBdoSksNJixeMlYcr41ZAPmZTMiU,22176
126
+ langchain_core/runnables/utils.py,sha256=NLdqnRI8abuOrLZrSJZcJ1r0MQuVzn983q5EUQAlTmk,22188
127
127
  langchain_core/tools/__init__.py,sha256=qe2E9VwZ7hpdkToz96oSJ080a0de9oQwSO9FP1XnmM0,2518
128
- langchain_core/tools/base.py,sha256=ejOqr0b-gJC1keQ666HgJv0kl_Q-F2WLhFs5UXlk5ts,51395
128
+ langchain_core/tools/base.py,sha256=wkVdCPMFb1o5Vt2a0NL30KLOu59KLpleLa7vdVqHs-o,52537
129
129
  langchain_core/tools/convert.py,sha256=xuvdirFB3a3A_qPN14-msXAvVt0dSUPMzD9iQUZzX8E,16258
130
130
  langchain_core/tools/render.py,sha256=gD3pXYWjCaDKsYq_MZ-yCRXl1wUJbOh6dJobda9VjYM,1817
131
131
  langchain_core/tools/retriever.py,sha256=hPdBhK8QBK2bRpyNMtq7VtA1qnTRQurRMRjPbVDNG-k,3791
132
132
  langchain_core/tools/simple.py,sha256=U9R5jIUcZMXKMV5Ezu8G2MX_0ot2nrtvhjgaGHkA53o,6623
133
- langchain_core/tools/structured.py,sha256=KV9u6S33rI0VBPwpA6ZmPtt08j8LZjMDnEgX5EhiDaw,9205
133
+ langchain_core/tools/structured.py,sha256=jKvolVZCWcdjKCiCY92zyrRqST520T0VmmEnS-HqoEo,9602
134
134
  langchain_core/tracers/__init__.py,sha256=Yf0CQ-IcBa8f9lu0wMA_looT6Q8we3C0yd-xMP3c0Sc,1362
135
135
  langchain_core/tracers/_streaming.py,sha256=U9pWQDJNUDH4oOYF3zvUMUtgkCecJzXQvfo-wYARmhQ,982
136
136
  langchain_core/tracers/base.py,sha256=cywwNDlynmidmhOCQ8A1J0qhnvN_orWNB8z2UjvCEGs,25454
137
137
  langchain_core/tracers/context.py,sha256=-7pbOA3QR0OIeehpD9eMpqugGgwLc_XxMjVQRg8GAJI,6194
138
- langchain_core/tracers/core.py,sha256=doyEB6enQVeGYFbC5EmC_gVGq6tcZQpYXm4bXVaI11c,23306
138
+ langchain_core/tracers/core.py,sha256=RybGBQP_dfoKcsxcFuJNZa8Luuilgy1WADBdE7eq9uA,23330
139
139
  langchain_core/tracers/evaluation.py,sha256=XmoPqBNFg6H-9K46fWanABAEVUgbob9S7qU-DPcL4RM,8367
140
140
  langchain_core/tracers/event_stream.py,sha256=bzsu65tlXntEw2tfzSFDpbYVd638RkSBX59V4VoaZLQ,34966
141
141
  langchain_core/tracers/langchain.py,sha256=juy0i7aryBuqWuML9EiNrAI6SAv2qllt5hAE6mC_0HQ,10477
@@ -150,23 +150,23 @@ langchain_core/utils/_merge.py,sha256=9wTZdkuG45azGBze7OZFFIoCiidHi3roe6TQiQ5bcV
150
150
  langchain_core/utils/aiter.py,sha256=gfFyGWro42FB4R66_tWSyW8XrLLzV7EI9EmLvI8dFGI,10574
151
151
  langchain_core/utils/env.py,sha256=pQTqZLCjcueoxTd8epc3cr0lRn8njJf_A-bOQfHWPXw,2458
152
152
  langchain_core/utils/formatting.py,sha256=fkieArzKXxSsLcEa3B-MX60O4ZLeeLjiPtVtxCJPcOU,1480
153
- langchain_core/utils/function_calling.py,sha256=N_Fv9fpTTai1FffQQUZPfaW9qnpD-V9nkYy4_0v0xPw,27546
153
+ langchain_core/utils/function_calling.py,sha256=aZ21fe1uoxjcbMm-AzUBMkKSvWdu2uUGl3byMeSUbG4,27551
154
154
  langchain_core/utils/html.py,sha256=ReIdqTTC8r-AfsqynFjCIaFC9t9sI_vYnmz3DanpVqQ,3714
155
155
  langchain_core/utils/image.py,sha256=1MH8Lbg0f2HfhTC4zobKMvpVoHRfpsyvWHq9ae4xENo,532
156
156
  langchain_core/utils/input.py,sha256=PYuiFKHhygAkM5yp5vxHqJe5Qnz1oay7k5cwx7hGocs,1999
157
157
  langchain_core/utils/interactive_env.py,sha256=LBgNICNAwgwDMOdlVD12TtZfSboPOKXaBS2Jn-bsXQ8,289
158
158
  langchain_core/utils/iter.py,sha256=jqtyfA2129a5ftfuRovpUBEslCGaeuiiGr8bkT-iozI,7300
159
- langchain_core/utils/json.py,sha256=Jsa-EuPLj5sSYDOAIzM7g1-7gsgfXgCs8KLNQ3x1-O4,6533
159
+ langchain_core/utils/json.py,sha256=twJgPBf86nwZzZDt3LoLbO5YOutWMt49GxpmG_pAoDQ,6571
160
160
  langchain_core/utils/json_schema.py,sha256=d0yHW6D_IoM7sLGOLxSGcSpAnaYROaqbwmjk7XhvZZ4,9071
161
- langchain_core/utils/mustache.py,sha256=2LgatBIOa1bGU4EaL5xrS076NWqfQkB4Mtencmc3mtQ,21262
162
- langchain_core/utils/pydantic.py,sha256=XyzBLtf_5MhOvGCfHiIlMgb7-0PKUpx-aU3NQlS3Dxo,18465
161
+ langchain_core/utils/mustache.py,sha256=aSA8olMczoiVgqx7RUZBRdekJxkGdrQyPnstJMdIDQM,22139
162
+ langchain_core/utils/pydantic.py,sha256=-xFQM2DAFy9cPkUHCYP87buXdnIYofeYaqZEs-FbQg8,18474
163
163
  langchain_core/utils/strings.py,sha256=DGhj7CxgxcYIdvMu3Ug93BtayNFaRvyIecgIaxZOa1g,1721
164
164
  langchain_core/utils/usage.py,sha256=vB674Eu69xDGx6JBJlySp6cnePkxCD0Wz26mi502NAM,1211
165
165
  langchain_core/utils/utils.py,sha256=EqczXbgT_IqCkZOU1MJ33mrp2ZHUAeUkVXol4y-euc0,16192
166
166
  langchain_core/vectorstores/__init__.py,sha256=5P0eoeoH5LHab64JjmEeWa6SxX4eMy-etAP1MEHsETY,804
167
- langchain_core/vectorstores/base.py,sha256=fNFdTXoKeQ-ok8TBtpdueVtmkJAEjTH_eccvcdpCovE,40784
168
- langchain_core/vectorstores/in_memory.py,sha256=FCNG8w50qGS0ZCwIcTmaU5QFprkuLS7ntlgH3YUIkzc,15719
167
+ langchain_core/vectorstores/base.py,sha256=ZEY2EBnm5hZciYUTic_f-QoMGLU120jbolIbzZqQmjs,40757
168
+ langchain_core/vectorstores/in_memory.py,sha256=R71jJ5_RCyViyvndLJ6SSwRiiECl6KpVbcVVGPFyUVM,15692
169
169
  langchain_core/vectorstores/utils.py,sha256=XXpQ2mxado6vrLmZWVTstcxrurBtoHcBZEORITAHWw0,4931
170
- langchain_core-1.0.4.dist-info/METADATA,sha256=M9RKsUpIcOh8wjMvm6sX_x7pPMqprzhgVLp2X3_wOEk,3478
171
- langchain_core-1.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
172
- langchain_core-1.0.4.dist-info/RECORD,,
170
+ langchain_core-1.0.7.dist-info/METADATA,sha256=DLZXMp4BNz8rZKLE7EBBXoK36AccxNRcbbOqTgxTnwU,3629
171
+ langchain_core-1.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
172
+ langchain_core-1.0.7.dist-info/RECORD,,