Skip to content

Llm feedback #1036

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

Merged
merged 12 commits into from
Apr 14, 2025
Merged

Llm feedback #1036

merged 12 commits into from
Apr 14, 2025

Conversation

jakedahn
Copy link
Contributor

@jakedahn jakedahn commented Apr 14, 2025

This PR contains all of the API and UI plumbing to handle user feedback submissions for a specific opentelemetry span id (which points to a llm request)

NOTE: This is currently a work-in-progress. We need to figure out how to get the actual llm telemetry span id from the active charm, and I'm not sure how to do this part.

the ui is that we have a feedback button, when you click it, it pops open a thumbs-up and thumbs-down button

image

when you click a thumbs button, it gives you a text field to fill out some feedback, which we then send to phoenix
image

this shows up in phoenix as an annotation
image


// FIXME(jake): This is for demo purposes... ideally we could just get the llm
// span from the persisted blobby blob of the charm recipe, but none of that is hooked up yet.
const CURRENT_SPAN_ID = "48fc49c695cdc4f3";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make this all real, we need to somehow grab the llm span id from the active charm-- I have no idea how to wire this up.

Comment on lines 29 to +36
spanFilter: (span) => {
return isOpenInferenceSpan(span);
// console.log("SPAN", span);
const includeSpanCriteria = [
isOpenInferenceSpan(span),
span.attributes["http.route"] == "/api/ai/llm", // Include the root span, which is in the hono app
span.instrumentationLibrary.name.includes("@vercel/otel"), // Include the actual LLM API fetch span
];
return includeSpanCriteria.some((c) => c);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filter update makes all requests appear as a child of a root span, which is a quality of life improvement in phoenix.

Copy link
Contributor

@anotherjesse anotherjesse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome - a great first pass

@anotherjesse anotherjesse merged commit abd6b22 into main Apr 14, 2025
5 checks passed
@anotherjesse anotherjesse deleted the llm-feedback branch April 14, 2025 23:29
anotherjesse pushed a commit that referenced this pull request Apr 15, 2025
User Feedback UI
 - Implemented FeedbackActions and FeedbackDialog components in Jumble to allow users to submit positive or negative feedback on generated content.
 - Added interactive thumbs-up/down buttons with feedback form submission workflow.

Trace Span ID Management
 - Added functions (setLastTraceSpanID, getLastTraceSpanID) to manage trace IDs in the builder environment.
 - Updated builder exports to expose new trace ID functions.

Integration of Trace ID in LLM Client
 - Modified LLMClient to capture x-ct-llm-trace-id from response headers and store it via setLastTraceSpanID.

Backend Feedback Handling
 - Extended toolshed API (/api/ai/llm/feedback) to accept user feedback and relay it to Phoenix observability backend.

Instrumentation and Span Filtering
 - Enhanced OpenTelemetry instrumentation to include specific spans relevant to LLM inference requests for better observability.
ubik2 added a commit that referenced this pull request Apr 20, 2025
* chore: commit wip with working serverside traverse overhaul

* chore: finished updating tests

* chore: commit wip while debugging lack of schema

* fix: wrong charm title (#1023)

* add gemini-flash-lite (#1035)

support flash-lite

* chore: Do not attempt to serve static directories (#1037)

* Only re-render CharmList when connection status actually changes (#1038)

* Only re-render CharmList when connection status actually changes

* Update types

* track loads differently based on their schema
import as FactModule instead of Fact to avoid collision
expose the schema associated with the facts from QueryView
make schemaContext optional in SchemaPathSelector, since I don't want to traverse commit logs
Change default storage to cached

* Llm feedback (#1036)

User Feedback UI
 - Implemented FeedbackActions and FeedbackDialog components in Jumble to allow users to submit positive or negative feedback on generated content.
 - Added interactive thumbs-up/down buttons with feedback form submission workflow.

Trace Span ID Management
 - Added functions (setLastTraceSpanID, getLastTraceSpanID) to manage trace IDs in the builder environment.
 - Updated builder exports to expose new trace ID functions.

Integration of Trace ID in LLM Client
 - Modified LLMClient to capture x-ct-llm-trace-id from response headers and store it via setLastTraceSpanID.

Backend Feedback Handling
 - Extended toolshed API (/api/ai/llm/feedback) to accept user feedback and relay it to Phoenix observability backend.

Instrumentation and Span Filtering
 - Enhanced OpenTelemetry instrumentation to include specific spans relevant to LLM inference requests for better observability.

* fix schema query with commit+json

* chore: commit wip

* chore: env variable to toggle schema sub

* changed to have subscribing queries not delete themselves with the task/return
changed so the server sends each response to each subscriber, even though there may be duplicates. a schema subscription on the client needs to know its updated list of entities
added lots of debugging to try to track down this stall issue

* we should be able to inspect both the graph/query and the subscribe for the combo

* reverted incomplete change to docIsSyncing that caused me to stall on load

* fix blunder with pulling value from fact
cleaned up logging and comments

* change todo comment for linter

* remove incorrect comment in test

* fix the other half of the value blunder

* Remove unused import

* Added start-ci task for running integration tests that makes BroadcastChannel available.

* Change cache to only use the BroadcastChannel if it's available.

* better import of isObj

* just inline the isObj test

* Remove the BroadcastChannel, since we're not really using it.

---------

Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
Co-authored-by: Jesse Andrews <anotherjesse@gmail.com>
Co-authored-by: Jordan Santell <jsantell@users.noreply.github.com>
Co-authored-by: Ben Follington <5009316+bfollington@users.noreply.github.com>
Co-authored-by: Jake Dahn <jake@common.tools>
ubik2 added a commit that referenced this pull request Apr 23, 2025
* chore: commit wip with working serverside traverse overhaul

* chore: finished updating tests

* chore: commit wip while debugging lack of schema

* fix: wrong charm title (#1023)

* add gemini-flash-lite (#1035)

support flash-lite

* chore: Do not attempt to serve static directories (#1037)

* Only re-render CharmList when connection status actually changes (#1038)

* Only re-render CharmList when connection status actually changes

* Update types

* track loads differently based on their schema
import as FactModule instead of Fact to avoid collision
expose the schema associated with the facts from QueryView
make schemaContext optional in SchemaPathSelector, since I don't want to traverse commit logs
Change default storage to cached

* Llm feedback (#1036)

User Feedback UI
 - Implemented FeedbackActions and FeedbackDialog components in Jumble to allow users to submit positive or negative feedback on generated content.
 - Added interactive thumbs-up/down buttons with feedback form submission workflow.

Trace Span ID Management
 - Added functions (setLastTraceSpanID, getLastTraceSpanID) to manage trace IDs in the builder environment.
 - Updated builder exports to expose new trace ID functions.

Integration of Trace ID in LLM Client
 - Modified LLMClient to capture x-ct-llm-trace-id from response headers and store it via setLastTraceSpanID.

Backend Feedback Handling
 - Extended toolshed API (/api/ai/llm/feedback) to accept user feedback and relay it to Phoenix observability backend.

Instrumentation and Span Filtering
 - Enhanced OpenTelemetry instrumentation to include specific spans relevant to LLM inference requests for better observability.

* fix schema query with commit+json

* chore: commit wip

* chore: env variable to toggle schema sub

* changed to have subscribing queries not delete themselves with the task/return
changed so the server sends each response to each subscriber, even though there may be duplicates. a schema subscription on the client needs to know its updated list of entities
added lots of debugging to try to track down this stall issue

* we should be able to inspect both the graph/query and the subscribe for the combo

* reverted incomplete change to docIsSyncing that caused me to stall on load

* fix blunder with pulling value from fact
cleaned up logging and comments

* change todo comment for linter

* remove incorrect comment in test

* fix the other half of the value blunder

* Remove unused import

* Added start-ci task for running integration tests that makes BroadcastChannel available.

* Change cache to only use the BroadcastChannel if it's available.

* better import of isObj

* just inline the isObj test

* Remove the BroadcastChannel, since we're not really using it.

* Remove remote provider
Needs more work, since we fail tests which try to use indexdb in deno.

* correct merge error

---------

Co-authored-by: Irakli Gozalishvili <contact@gozala.io>
Co-authored-by: Jesse Andrews <anotherjesse@gmail.com>
Co-authored-by: Jordan Santell <jsantell@users.noreply.github.com>
Co-authored-by: Ben Follington <5009316+bfollington@users.noreply.github.com>
Co-authored-by: Jake Dahn <jake@common.tools>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants