Runnable: ... ``` **参数** - `builder`: 可选的 `RunnableBuilder` 对象。 **返回值** - 返回一个 `Runnable` 对象。 #### langgraph.graph.Node ```python class Node: def __init__(self, func: Callable, name: str, input: Type[BaseModel] = None, output: Type[BaseModel] = None): ... ``` **参数** - `func`: 节点执行的函数。 - `name`: 节点名称。 - `input`: 输入模型,继承自 `BaseModel`。 - `output`: 输出模型,继承自 `BaseModel`。 #### langgraph.graph.Runner ```python class Runner: def __init__(self, graph: StateGraph): ... ``` **参数** - `graph`: 状态图实例。 ##### run ```python def run(self, input: Any) -> Any: ... ``` **参数** - `input`: 输入数据。 **返回值** - 返回运行结果。 #### langgraph.graph.Runnable ```python class Runnable: def __init__(self, graph: StateGraph): ... ``` **参数** - `graph`: 状态图实例。 ##### invoke ```python def invoke(self, input: Any) -> Any: ... ``` **参数** - `input`: 输入数据。 **返回值** - 返回调用结果。 ##### stream ```python def stream(self, input: Any) -> Iterator[Any]: ... ``` **参数** - `input`: 输入数据。 **返回值** - 返回一个生成器,用于流式处理结果。 #### langgraph.graph.BaseModel ```python class BaseModel: def __init__(self, **kwargs): ... ``` **参数** - `**kwargs`: 初始化模型的键值对参数。 #### langgraph.graph.TypedDict ```python class TypedDict: def __init__(self, **kwargs): ... ``` **参数** - `**kwargs`: 初始化类型字典的键值对参数。 #### langgraph.graph.RunnableBuilder ```python class RunnableBuilder: def __init__(self): ... ``` ##### build ```python def build(self, graph: StateGraph) -> Runnable: ... ``` **参数** - `graph`: 状态图实例。 **返回值** - 返回一个 `Runnable` 对象。 #### langgraph.graph.utils ##### get_state ```python def get_state(state: State) -> Dict[str, Any]: ... ``` **参数** - `state`: 状态对象。 **返回值** - 返回表示状态的字典。 ##### set_state ```python def set_state(state: State, values: Dict[str, Any]): ... ``` **参数** - `state`: 状态对象。 - `values`: 键值对字典,用于更新状态。 #### langgraph.graph.exceptions ##### StateError ```python class StateError(Exception): ... ``` ##### NodeError ```python class NodeError(Exception): ... ``` ##### GraphError ```python class GraphError(Exception): ... ``` ##### RunnerError ```python class RunnerError(Exception): ... ``` ##### RunnableError ```python class RunnableError(Exception): ... ``` __IMG_PLACEHOLDER_2__"> 参考
Skip to content

参考资料

欢迎查阅 LangGraph 的参考文档!这些页面详细介绍了在使用 LangGraph 构建应用时您将使用的核心接口。每个部分涵盖了生态系统中不同的部分。

Tip

如果您刚开始接触,请参阅 LangGraph 基础 以了解主要概念和使用模式的介绍。

LangGraph

LangGraph 开源库的核心 API。

预构建组件

常见工作流程、代理和其他模式的高级抽象。

LangGraph 平台

用于部署和连接到 LangGraph 平台的工具。

  • CLI: 用于构建和部署 LangGraph 平台应用程序的命令行界面。
  • Server API: LangGraph 服务器的 REST API。
  • SDK (Python): 用于与 LangGraph 服务器实例进行交互的 Python SDK。
  • SDK (JS/TS): 用于与 LangGraph 服务器实例进行交互的 JavaScript/TypeScript SDK。
  • RemoteGraph: 用于连接 LangGraph 服务器实例的 Pregel 抽象。
  • Environment variables: 使用 LangGraph 平台部署时支持的配置变量。