log_feedback#
- langsmith.testing._internal.log_feedback(feedback: dict | list[dict] | None = None, /, *, key: str, score: int | bool | float | None = None, value: str | int | float | bool | None = None, **kwargs: Any) None [源代码]#
从 pytest 测试运行中记录运行反馈。
警告
此 API 处于 beta 阶段,未来版本可能会更改。
仅应在用 @pytest.mark.langsmith 装饰的 pytest 测试中使用。
- 参数:
key (str) – 反馈名称。
score (int | bool | float | None) – 数值反馈值。
value (str | int | float | bool | None) – 分类反馈值
kwargs (Any) – 任何其他 Client.create_feedback 参数。
feedback (dict | list[dict] | None)
- 返回类型:
None
示例
import pytest from langsmith import testing as t @pytest.mark.langsmith def test_foo() -> None: x = 0 y = 1 expected = 2 result = foo(x, y) t.log_feedback(key="right_type", score=isinstance(result, int)) assert result == expected