-
Notifications
You must be signed in to change notification settings - Fork 17
Add langfuse instrumentation #14
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,12 +14,15 @@ | |||||||||||||||
|
|
||||||||||||||||
| from anthropic import APIStatusError, AsyncAnthropic, RateLimitError | ||||||||||||||||
| from anthropic.types import CacheControlEphemeralParam, MessageParam | ||||||||||||||||
| from app_utils import load_dotenv | ||||||||||||||||
| from htmltools import Tag | ||||||||||||||||
| from local_types import MessageParam2 | ||||||||||||||||
| from langfuse import get_client | ||||||||||||||||
| from opentelemetry.instrumentation.anthropic import AnthropicInstrumentor | ||||||||||||||||
| from shiny import App, Inputs, Outputs, Session, reactive, render, ui | ||||||||||||||||
| from shiny.ui._card import CardItem | ||||||||||||||||
|
|
||||||||||||||||
| from app_utils import load_dotenv | ||||||||||||||||
| from local_types import MessageParam2 | ||||||||||||||||
|
|
||||||||||||||||
| # from signature import validate_email_server, validate_email_ui | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -36,6 +39,16 @@ | |||||||||||||||
|
|
||||||||||||||||
| # email_sig_key = os.environ.get("EMAIL_SIGNATURE_KEY", None) | ||||||||||||||||
|
|
||||||||||||||||
| langfuse = get_client() | ||||||||||||||||
|
|
||||||||||||||||
| # Verify connection | ||||||||||||||||
| if langfuse.auth_check(): | ||||||||||||||||
| print("Langfuse client is authenticated and ready!") | ||||||||||||||||
| else: | ||||||||||||||||
| print("Authentication failed. Please check your credentials and host.") | ||||||||||||||||
|
|
||||||||||||||||
| AnthropicInstrumentor().instrument() | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+47
to
+51
|
||||||||||||||||
| else: | |
| print("Authentication failed. Please check your credentials and host.") | |
| AnthropicInstrumentor().instrument() | |
| AnthropicInstrumentor().instrument() | |
| else: | |
| print("Authentication failed. Please check your credentials and host.") |
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.
The error message for authentication failure is not helpful for debugging. Consider providing more specific guidance about checking the LANGFUSE_SECRET_KEY, LANGFUSE_PUBLIC_KEY, and LANGFUSE_HOST environment variables mentioned in the PR description.