-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(llm-observability): llm metrics and feedback #27785
Conversation
…ervability-scores
…ervability-scores
Size Change: -24 B (0%) Total Size: 1.16 MB ℹ️ View Unchanged
|
…ervability-scores
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
The UI changes overlap a bit with my #27841, but we'll figure it out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go. Leaving a few comments about the UX of capturing and displaying metrics/feedback, but do with this as you will
<br /> | ||
<br /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why two new lines and not some margin?
export function MetricTag({ properties }: MetricTagProps): JSX.Element { | ||
const { $ai_metric_name: metricName, $ai_metric_value: metricValue } = properties | ||
const strValue = String(metricValue) | ||
const isValueLong = strValue.length > 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 feels super short honestly!
properties: Record<string, any> | ||
} | ||
|
||
export function MetricTag({ properties }: MetricTagProps): JSX.Element { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree with you. I'd also add a general overview of a trace with its metrics and feedback, which would be much easier to read. These short tags were supposed to help you if you want to find metrics or feedback quickly, for example, inside a generation.
posthog.capture('$ai_feedback', { | ||
$ai_feedback_text: feedback, | ||
$ai_trace_id: traceId, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must add a posthog-js
method for this – users should never have to type dollar-prefixed properties, because they're the features we offer out of the box. This way we ensure the SDKs and the product's UI all work together neatly, and the user has a smooth time implementing. Let's do this as a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. If we keep adding functionality, the bundle size will concern me, but the plugins probably have already solved this.
Problem
LLM Observability should provide functionality to gather quantitative and non-quantitative feedback from users. We've agreed on two events:
$ai_metric
allows you to create your own custom metrics.$ai_metric_name
- optional metric name.$ai_metric_value
- required metric value.$ai_feedback
allows you to capture user-written feedback.$ai_feedback_text
- required text.Screenshot
Changes
Add metrics and feedback to the traces sceneI've decided to do that in a separate PR.Does this work well for both Cloud and self-hosted?
Yes
How did you test this code?
Unit & manual testing.