Skip to content
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

Fix: Populate the node assistant's trace service with the existing callback #1091

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

SmittieC
Copy link
Collaborator

@SmittieC SmittieC commented Jan 28, 2025

resolves #1088

Description

The issue was that the trace_service gets initialized here, but only callback is being passed in as config to the runnable. When we initialize the AssistantAdapter for the pipeline (see here), we fetch a fresh instance of the tracing service, but uninitialized.

The idea behind the PR is to essentially initialize the tracing service with the existing callback that already has a trace that we can piggyback on.

We don't have to do this for the LLMResponseWithPrompt node, because it's not trying to update the trace with extra metadata as the assistant node is doing.

User Impact

Users would be able to use langfuse tracing services with pipeline assistants.

Demo

N/A

Docs

N/A

@SmittieC SmittieC requested a review from snopoke January 28, 2025 11:30
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 46.66667% with 8 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/service_providers/tracing/service.py 37.50% 5 Missing ⚠️
apps/pipelines/nodes/nodes.py 25.00% 3 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

snopoke
snopoke previously approved these changes Jan 28, 2025
@@ -29,6 +30,9 @@ def update_trace(self, metadata: dict):
def get_current_trace_info(self) -> TraceInfo | None:
return None

def from_callback_manager(self, callback_manager: CallbackManager):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: rename

Suggested change
def from_callback_manager(self, callback_manager: CallbackManager):
def initialize_from_callback_manager(self, callback_manager: CallbackManager):

@SmittieC SmittieC merged commit 2be8885 into main Jan 28, 2025
6 checks passed
@SmittieC SmittieC deleted the cs/fix_callback_issue branch January 28, 2025 14:45
Copy link

sentry-io bot commented Jan 29, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AttributeError: 'NoneType' object has no attribute 'initialize_from_callback_manager' apps.experiments.tasks.get_response_for_webchat... View Issue

Did you find this useful? React with a 👍 or 👎

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.

ServiceNotInitializedException: Service not initialized.
3 participants