trulens.feedback.v2.feedback¶
trulens.feedback.v2.feedback
¶
Classes¶
Relevance
¶
Bases: Semantics
This evaluates the relevance of the LLM response to the given text by LLM prompting.
Relevance is available for any LLM provider.
Sentiment
¶
Bases: Semantics
, WithPrompt
This evaluates the positive sentiment of either the prompt or response.
Sentiment is currently available to use with OpenAI, HuggingFace or Cohere as the model provider.
- The OpenAI sentiment feedback function prompts a Chat Completion model to rate the sentiment from 0 to 10, and then scales the response down to 0-1.
- The HuggingFace sentiment feedback function returns a raw score from 0 to 1.
- The Cohere sentiment feedback function uses the classification endpoint and a
small set of examples stored in
feedback_prompts.py
to return either a 0 or a 1.
Harmfulness
¶
Bases: Moderation
, WithPrompt
Examples of Harmfulness:
Insensitivity
¶
Bases: Semantics
, WithPrompt
Examples and categorization of racial insensitivity: https://sph.umn.edu/site/docs/hewg/microaggressions.pdf .
Maliciousness
¶
Bases: Moderation
, WithPrompt
Examples of maliciousness:
Hate
¶
Bases: Moderation
Examples of (not) Hate metrics:
openai
package:openai.moderation
categoryhate
.
HateThreatening
¶
Bases: Hate
Examples of (not) Threatening Hate metrics:
openai
package:openai.moderation
categoryhate/threatening
.
SelfHarm
¶
Bases: Moderation
Examples of (not) Self Harm metrics:
openai
package:openai.moderation
categoryself-harm
.
Sexual
¶
Bases: Moderation
Examples of (not) Sexual metrics:
openai
package:openai.moderation
categorysexual
.
SexualMinors
¶
Bases: Sexual
Examples of (not) Sexual Minors metrics:
openai
package:openai.moderation
categorysexual/minors
.
Violence
¶
Bases: Moderation
Examples of (not) Violence metrics:
openai
package:openai.moderation
categoryviolence
.
GraphicViolence
¶
Bases: Violence
Examples of (not) Graphic Violence:
openai
package:openai.moderation
categoryviolence/graphic
.