Replies: 1 comment 4 replies
-
|
Hi @viquangly! I'm Dosu and I’m helping the trulens team. You can build a Feedback for a RunResponse object by customizing the selector to extract the content attribute, since TruLens feedback functions (like provider.relevance_with_cot) expect a string by default but are flexible with selectors. Here’s how you can do it: from trulens_eval import Feedback
# Assuming your RunResponse object has a .content attribute with the answer
f_relevance = Feedback(
provider.relevance_with_cot,
name="Answer Relevance"
).on(lambda record: record.output.content)This lambda tells TruLens to use the content attribute from your RunResponse object as the output for feedback evaluation. You can adapt this pattern for any custom output structure by changing the selector accordingly. This approach is supported by the modular design of TruLens feedback functions and selectors, which are intended to handle non-string outputs and custom agent frameworks like Agno. For more on this pattern, see the discussion and examples here and here. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am building Agents using the Agno package. The response from an agent object is in the form of a RunResponse object, with the answer being stored in the content attribute, instead of a str.
How do I build a Feedback for this using provider.relevance_with_cot as an example?
Beta Was this translation helpful? Give feedback.
All reactions