当前位置: 首页 > news >正文

langgraph-reflection

langgraph-reflection

https://github.com/fanqingsong/langgraph-reflection

DescriptionArchitecture
This reflection agent uses two subagents:
- A "main" agent, which is the agent attempting to solve the users task
- A "critique" agent, which checks the main agents work and offers any critiques

The reflection agent has the following architecture:

1. First, the main agent is called
2. Once the main agent is finished, the critique agent is called
3. Based on the result of the critique agent:
- If the critique agent finds something to critique, then the main agent is called again
- If there is nothing to critique, then the overall reflection agent finishes
4. Repeat until the overall reflection agent finishes
Reflection Agent Architecture

We make some assumptions about the graphs:

    • The main agent should take as input a list of messages
    • The reflection agent should return a user message if there is any critiques, otherwise it should return no messages.

 

https://python.langchain.ac.cn/docs/how_to/tool_calling/#typeddict-class

LangChain 工具

LangChain 还实现了一个 `@tool` 装饰器,允许进一步控制工具模式,例如工具名称和参数描述。有关详细信息,请参阅 此处的 操作指南。

Pydantic 类

您可以使用 Pydantic,无需附带函数即可等效地定义模式。

请注意,除非提供默认值,否则所有字段都是 `required`(必需的)。

from pydantic import BaseModel, Field


class add(BaseModel):
"""Add two integers."""

a: int = Field(..., description="First integer")
b: int = Field(..., description="Second integer")


class multiply(BaseModel):
"""Multiply two integers."""

a: int = Field(..., description="First integer")
b: int = Field(..., description="Second integer")
 

TypedDict 类

 
需要 `langchain-core>=0.2.25`

或者使用 TypedDicts 和注解

from typing_extensions import Annotated, TypedDict


class add(TypedDict):
"""Add two integers."""

# Annotations must have the type and can optionally include a default value and description (in that order).
a: Annotated[int, ..., "First integer"]
b: Annotated[int, ..., "Second integer"]


class multiply(TypedDict):
"""Multiply two integers."""

a: Annotated[int, ..., "First integer"]
b: Annotated[int, ..., "Second integer"]


tools = [add, multiply]
 

要将这些模式实际绑定到聊天模型,我们将使用 `.bind_tools()` 方法。这会处理将 `add` 和 `multiply` 模式转换为模型所需的正确格式。每次调用模型时,都会传入工具模式。

 

 

https://github.com/langchain-ai/openevals

Much like tests in traditional software, evals are an important part of bringing LLM applications to production. The goal of this package is to help provide a starting point for you to write evals for your LLM applications, from which you can write more custom evals specific to your application.

If you are looking for evals specific to evaluating LLM agents, please check out agentevals.

 

 

https://github.com/langchain-ai/agentevals

Agentic applications give an LLM freedom over control flow in order to solve problems. While this freedom can be extremely powerful, the black box nature of LLMs can make it difficult to understand how changes in one part of your agent will affect others downstream. This makes evaluating your agents especially important.

This package contains a collection of evaluators and utilities for evaluating the performance of your agents, with a focus on agent trajectory, or the intermediate steps an agent takes as it runs. It is intended to provide a good conceptual starting point for your agent's evals.

If you are looking for more general evaluation tools, please check out the companion package openevals.

 

https://zhuanlan.zhihu.com/p/26791319223

随着大型语言模型(LLM)在各类应用中的广泛使用,如何科学、系统地评估这些模型的表现成为一个重要课题OpenEvals 是一个由 LangChain

团队推出的开源项目,专为 LLM 应用程序提供全面的评估工具,帮助开发者快速验证模型效果、优化输出质量。这一工具库不仅功能强大,还具备高度灵活性,适合多种场景。

核心亮点与功能:

  1. LLM 作为评判员 OpenEvals 提供了一个创新思路:利用另一个 LLM 对模型输出进行评分。
    1. 支持多维度评估:如正确性、简洁性、虚构性等。
    2. 极高的灵活性:开发者可以自定义提示模板、选择不同的模型以及评分标准。
  2. 结构化输出评估 对于需要生成结构化数据(如工具调用、文本提取等)的任务,OpenEvals 提供了精准的评估方式:
    1. 支持 精确匹配LLM 评判,确保输出符合预期。
  3. 多样化评估指标 除了 LLM 评判,OpenEvals 还内置了常用的评估方法:
    1. 精确匹配:适用于对严格一致性要求的任务。
    2. 编辑距离:衡量生成文本与目标文本的相似程度。
    3. 嵌入相似度:通过向量化方法评估语义相似性。
  4. 异步支持 所有评估器均支持 Python 的异步模式,大幅提升评估效率,适合处理大量任务的场景。
  5. 与 LangSmith 集成 OpenEvals 无缝对接 LangSmith 平台,支持记录评估结果,用于实验跟踪与性能分析。
  6. 测试集成 开发者可以直接将 OpenEvals 的评估功能集成到常见的测试框架中(如 pytest、Vitest、Jest),实现自动化测试。

 

 

https://github.com/microsoft/pyright

Static Type Checker for Python

Pyright is a full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.

Pyright includes both a command-line tool and an extension for Visual Studio Code.

 

 

 

 

 

https://github.com/microsoft/pyright

Static Type Checker for Python

Pyright is a full-featured, standards-based static type checker for Python. It is designed for high performance and can be used with large Python source bases.

Pyright includes both a command-line tool and an extension for Visual Studio Code.

 

http://www.jsqmd.com/news/28697/

相关文章:

  • 学习日报11.2
  • 2025CSP-S游记
  • 获取网页logo图标(ico文件)
  • 题解:P6811 「MCOI-02」Build Battle 建筑大师
  • [KaibaMath]1017 关于收敛数列与其子数列之间的关系定理的证明
  • Day9综合案例一
  • 以数据为中心的计算机视觉模型性能分析工具-FiftyOne -1
  • [Linux] Linux创建用户流程
  • Zabbix 数据库 history_uint 表损坏修复
  • Azure MCP Server 1.0 正式发布
  • dify+LLM+echarts打造智能可视化数据分析AI助手
  • 操作系统软考复习总结
  • 2025 年 11 月防静电地板厂家推荐排行榜,全钢/全钢陶瓷/硫酸钙/铝合金/pvc架空/防静电地板,OA网络地板,机房防静电地板,办公室网络架空地板公司精选
  • 11.1阅读笔记
  • 2025 年 11 月 Pogopin 弹簧针厂家推荐排行榜,精密测试针,医疗传感器,手机连接器,声学弹簧,仪表锁具,座椅检测优质公司推荐!
  • 2025 年 11 月真空炉厂家推荐排行榜,真空热处理炉,真空回火炉,真空退火炉,真空时效炉,气淬炉,烧结炉,铜钨合金真空焊接炉公司推荐
  • 2025CSP游记
  • Redis单机和集群搭建
  • 2025 年 11 月铣刀厂家推荐排行榜,雕刻机铣刀,金刚石铣刀,木工铣刀,绝缘材料铣刀,碳纤维铣刀,亚克力铣刀,金属加工铣刀公司推荐
  • 电子丨LDO与DC-DC电源管理器件
  • 2025 年 11 月不锈钢厂家推荐排行榜,301不锈钢,316L不锈钢,304不锈钢,420不锈钢,201不锈钢,不锈钢材料公司精选
  • CSP NOIP 2025 游记
  • 2025年10月文章一览
  • 2025 CSP 游记
  • 市面上常见显示屏接口与对应的引脚 - 详解
  • SPF Pro 初学者教程 – 移动取证(分步指南)
  • 002 vue3-admin项目的目录及文件说明
  • Unreal:中文设置小技巧
  • 2025 年 11 月阿里巴巴代运营厂家推荐排行榜,1688代运营,国际站代运营,淘宝代运营,天猫代运营,店铺代运营公司精选
  • PPT 中如何使得水平线水平,垂直线垂直,不要倾斜