mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-26 09:32:25 +02:00
Add test for node decorated with traceable decorator
This commit is contained in:
Generated
+3
-3
@@ -1752,13 +1752,13 @@ types-requests = ">=2.31.0.2,<3.0.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "langsmith"
|
||||
version = "0.1.50"
|
||||
version = "0.1.65"
|
||||
description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform."
|
||||
optional = false
|
||||
python-versions = "<4.0,>=3.8.1"
|
||||
files = [
|
||||
{file = "langsmith-0.1.50-py3-none-any.whl", hash = "sha256:a81e9809fcaa277bfb314d729e58116554f186d1478fcfdf553b1c2ccce54b85"},
|
||||
{file = "langsmith-0.1.50.tar.gz", hash = "sha256:9fd22df8c689c044058536ea5af66f5302067e7551b60d7a335fede8d479572b"},
|
||||
{file = "langsmith-0.1.65-py3-none-any.whl", hash = "sha256:ab4487029240e69cca30da1065f1e9138e5a7ca2bbe8c697f0bd7d5839f71cf7"},
|
||||
{file = "langsmith-0.1.65.tar.gz", hash = "sha256:d3c2eb2391478bd79989f02652cf66e29a7959d677614b6993a47cef43f7f43b"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
||||
@@ -17,6 +17,7 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from langsmith import traceable
|
||||
import pytest
|
||||
from langchain_core.runnables import (
|
||||
RunnableConfig,
|
||||
@@ -6598,10 +6599,11 @@ def test_checkpoint_metadata() -> None:
|
||||
]
|
||||
)
|
||||
|
||||
def agent(state: BaseState, config: RunnableConfig) -> BaseState:
|
||||
@traceable(run_type="llm")
|
||||
def agent(state: BaseState) -> BaseState:
|
||||
formatted = prompt.invoke(state)
|
||||
response = model.invoke(formatted)
|
||||
return {"messages": response}
|
||||
return {"messages": response, "usage_metadata": {"total_tokens": 123}}
|
||||
|
||||
def should_continue(data: BaseState) -> str:
|
||||
# Logic to decide whether to continue in the loop or exit
|
||||
|
||||
Reference in New Issue
Block a user