和顺 / 衡律 返回所属 Agent
20.2

自然语言意图与请求草稿

原能力

将自然语言整理为可核对的请求草稿,明确主体、账户、金额、用途和歧义。(合同附件 R7 20.2)

首选项目

LangGraph(MIT,限仓库相关代码)。 LangGraph

匹配范围

从结构化输出提案、Schema 验证请求字段。

源码

LangGraph · class StateGraph(

libs/langgraph/langgraph/graph/state.py · 132–145 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
class StateGraph(Generic[StateT, ContextT, InputT, OutputT]):
    """A graph whose nodes communicate by reading and writing to a shared state.

    The signature of each node is `State -> Partial<State>`.

    Each state key can optionally be annotated with a reducer function that
    will be used to aggregate the values of that key received from multiple nodes.
    The signature of a reducer function is `(Value, Value) -> Value`.

    !!! warning

        `StateGraph` is a builder class and cannot be used directly for execution.
        You must first call `.compile()` to create an executable graph that supports
        methods like `invoke()`, `stream()`, `astream()`, and `ainvoke()`. See the

python-jsonschema · def iter_errors(self, instance

jsonschema/validators.py · 352–365 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
        def iter_errors(self, instance, _schema=None):
            if _schema is not None:
                warnings.warn(
                    (
                        "Passing a schema to Validator.iter_errors "
                        "is deprecated and will be removed in a future "
                        "release. Call validator.evolve(schema=new_schema)."
                        "iter_errors(...) instead."
                    ),
                    DeprecationWarning,
                    stacklevel=2,
                )
                validators = [
                    (self.VALIDATORS[k], k, v)

实现与验收要点

按权限区分草稿/执行,意图查证、确认与歧义处理。