langchain 1.0.0a8__py3-none-any.whl → 1.0.0a9__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 might be problematic. Click here for more details.

langchain/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  from typing import Any
4
4
 
5
- __version__ = "1.0.0a6"
5
+ __version__ = "1.0.0a8"
6
6
 
7
7
 
8
8
  def __getattr__(name: str) -> Any: # noqa: ANN401
@@ -1,6 +1,6 @@
1
1
  """Anthropic prompt caching middleware."""
2
2
 
3
- from typing import Literal
3
+ from typing import Any, Literal
4
4
  from warnings import warn
5
5
 
6
6
  from langchain.agents.middleware.types import AgentMiddleware, ModelRequest
@@ -42,6 +42,7 @@ class AnthropicPromptCachingMiddleware(AgentMiddleware):
42
42
  def modify_model_request( # type: ignore[override]
43
43
  self,
44
44
  request: ModelRequest,
45
+ state: dict[str, Any], # noqa: ARG002
45
46
  ) -> ModelRequest:
46
47
  """Modify the model request to add cache control blocks."""
47
48
  try:
@@ -45,7 +45,7 @@ __all__ = [
45
45
  "PublicAgentState",
46
46
  ]
47
47
 
48
- JumpTo = Literal["tools", "model", "__end__"]
48
+ JumpTo = Literal["tools", "model", "end"]
49
49
  """Destination to jump to when a middleware node returns."""
50
50
 
51
51
  ResponseT = TypeVar("ResponseT")
@@ -237,7 +237,7 @@ def before_model(
237
237
  AgentState schema.
238
238
  tools: Optional list of additional tools to register with this middleware.
239
239
  jump_to: Optional list of valid jump destinations for conditional edges.
240
- Valid values are: "tools", "model", "__end__"
240
+ Valid values are: "tools", "model", "end"
241
241
  name: Optional name for the generated middleware class. If not provided,
242
242
  uses the decorated function's name.
243
243
 
@@ -260,10 +260,10 @@ def before_model(
260
260
 
261
261
  Advanced usage with runtime and conditional jumping:
262
262
  ```python
263
- @before_model(jump_to=["__end__"])
263
+ @before_model(jump_to=["end"])
264
264
  def conditional_before_model(state: AgentState, runtime: Runtime) -> dict[str, Any] | None:
265
265
  if some_condition(state):
266
- return {"jump_to": "__end__"}
266
+ return {"jump_to": "end"}
267
267
  return None
268
268
  ```
269
269
 
@@ -474,7 +474,7 @@ def after_model(
474
474
  AgentState schema.
475
475
  tools: Optional list of additional tools to register with this middleware.
476
476
  jump_to: Optional list of valid jump destinations for conditional edges.
477
- Valid values are: "tools", "model", "__end__"
477
+ Valid values are: "tools", "model", "end"
478
478
  name: Optional name for the generated middleware class. If not provided,
479
479
  uses the decorated function's name.
480
480
 
@@ -505,8 +505,10 @@ def create_agent( # noqa: PLR0915
505
505
  def _resolve_jump(jump_to: JumpTo | None, first_node: str) -> str | None:
506
506
  if jump_to == "model":
507
507
  return first_node
508
- if jump_to:
509
- return jump_to
508
+ if jump_to == "end":
509
+ return "__end__"
510
+ if jump_to == "tools":
511
+ return "tools"
510
512
  return None
511
513
 
512
514
 
@@ -602,7 +604,7 @@ def _add_middleware_edge(
602
604
 
603
605
  destinations = [default_destination]
604
606
 
605
- if "__end__" in jump_to:
607
+ if "end" in jump_to:
606
608
  destinations.append(END)
607
609
  if "tools" in jump_to:
608
610
  destinations.append("tools")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain
3
- Version: 1.0.0a8
3
+ Version: 1.0.0a9
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/langchain
@@ -1,8 +1,8 @@
1
- langchain-1.0.0a8.dist-info/METADATA,sha256=slSRaiJXGZdoNrLCLCYpJqqaPdM0keHqtv2aCBHLC7w,6259
2
- langchain-1.0.0a8.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- langchain-1.0.0a8.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- langchain-1.0.0a8.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
5
- langchain/__init__.py,sha256=Z6r4MjNaC6DSyiMgFSRmi8EhizelVIOb_CVJJRAVjDc,604
1
+ langchain-1.0.0a9.dist-info/METADATA,sha256=ltmza7WBqx_F4qgWi8Rt1kdgcOn7bydQJ7rcdaNybV8,6259
2
+ langchain-1.0.0a9.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ langchain-1.0.0a9.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ langchain-1.0.0a9.dist-info/licenses/LICENSE,sha256=TsZ-TKbmch26hJssqCJhWXyGph7iFLvyFBYAa3stBHg,1067
5
+ langchain/__init__.py,sha256=-zDqR8Eu2W6wpPWSl3zvJO4WHUV9YKANkCYDtLjyvDg,604
6
6
  langchain/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  langchain/_internal/_documents.py,sha256=z9wAPukoASOMw4WTFFBKCCZYsvsKbo-Cq6CeHjdq9eE,1045
8
8
  langchain/_internal/_lazy_import.py,sha256=S_iSAxGvW7lVcUQYgi45KG8XhWZzkORsZ_olPMZPlqU,1258
@@ -14,10 +14,10 @@ langchain/agents/_internal/__init__.py,sha256=5nNBeaeQIvv9IOQjY4_aNW8pffWzMXQgi0
14
14
  langchain/agents/_internal/_typing.py,sha256=JoWa-KL5uLNeq6yrm56wnIvhDeFnCt2fTzgUcj5zWy4,270
15
15
  langchain/agents/middleware/__init__.py,sha256=-NzMTmD5ogpzlsqHGjv6SnTrfXqU3vTahGUoGDk299U,511
16
16
  langchain/agents/middleware/human_in_the_loop.py,sha256=_6THKNzp1dvYBwBLdnZ9PXsHJP3uedn4A60ZON4xlvI,10301
17
- langchain/agents/middleware/prompt_caching.py,sha256=QLoWdd9jUiXAytGqbXW0I_Mg8WgrgTBO8gOZ-s8Bx8g,3081
17
+ langchain/agents/middleware/prompt_caching.py,sha256=AwcsTUSIE0Ur2TeovfX-KTznv7GJdwbYFnIfSE60Wds,3133
18
18
  langchain/agents/middleware/summarization.py,sha256=qqEqAuJXQ5rfewhFHftHLnrX8jhdMu9dPfz0akhzfuc,10281
19
- langchain/agents/middleware/types.py,sha256=a9B6Ihx12mNTroopL1SqHxsO51ZfSkxdtkPeZXw8EJc,18606
20
- langchain/agents/middleware_agent.py,sha256=fncjAFNsqZqEkDYSsBfq-goxN4GqNlQixirWRBguXhs,23847
19
+ langchain/agents/middleware/types.py,sha256=68VmyBQ5294Yi6SwOC9-LqdkdRLg8q3gP1FYs5XCpV0,18586
20
+ langchain/agents/middleware_agent.py,sha256=70JCC8_miJsL934RQh5Kbml81qeX8gDin2YRnrO5pMY,23904
21
21
  langchain/agents/react_agent.py,sha256=6ZNI2dp0hTL7hTm7ao-HkQ3hmVvBQuFu9pJz0PSK_eg,49712
22
22
  langchain/agents/structured_output.py,sha256=QWNafJx7au_jJawJgIfovnDoP8Z9mLxDZNvDX_1RRJ0,13327
23
23
  langchain/agents/tool_node.py,sha256=QabTfIi8nGrwfzaSOeWfyHos6sgXjFTdRXexQG7u2HE,46596
@@ -35,4 +35,4 @@ langchain/storage/exceptions.py,sha256=Fl_8tON3KmByBKwXtno5WSj0-c2RiZxnhw3gv5aS2
35
35
  langchain/storage/in_memory.py,sha256=ozrmu0EtaJJVSAzK_u7nzxWpr9OOscWkANHSg-qIVYQ,369
36
36
  langchain/text_splitter.py,sha256=yxWs4secpnkfK6VZDiNJNdlYOrRZ18RQZj1S3xNQ73A,1554
37
37
  langchain/tools/__init__.py,sha256=NYQzLxW2iI5Twu3voefVC-dJEI4Wgh7jC311CQEpvZs,252
38
- langchain-1.0.0a8.dist-info/RECORD,,
38
+ langchain-1.0.0a9.dist-info/RECORD,,