Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions sentry_sdk/integrations/litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
)
from sentry_sdk.consts import SPANDATA
from sentry_sdk.integrations import DidNotEnable, Integration, _check_minimum_version
from sentry_sdk.scope import should_send_default_pii
from sentry_sdk.utils import (
event_from_exception,
has_data_collection_enabled,
package_version,
)

Expand Down Expand Up @@ -113,14 +111,7 @@ def _input_callback(kwargs: "Dict[str, Any]") -> None:
set_data_normalized(span, SPANDATA.GEN_AI_PROVIDER_NAME, provider)
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, operation)

# Record input/messages if allowed
record_inputs = False
if has_data_collection_enabled(client.options):
record_inputs = client.options["data_collection"]["gen_ai"]["inputs"]
elif should_send_default_pii():
record_inputs = True

if record_inputs:
if client.options["data_collection"]["gen_ai"]["inputs"]:
if operation == "embeddings":
# For embeddings, look for the 'input' parameter
embedding_input = kwargs.get("input")
Expand Down Expand Up @@ -194,14 +185,7 @@ def _success_callback(
span, SPANDATA.GEN_AI_RESPONSE_MODEL, completion_response.model
)

# Record response content if allowed
record_outputs = False
if has_data_collection_enabled(client.options):
record_outputs = client.options["data_collection"]["gen_ai"]["outputs"]
elif should_send_default_pii():
record_outputs = True

if record_outputs:
if client.options["data_collection"]["gen_ai"]["outputs"]:
if hasattr(completion_response, "choices"):
response_messages = []
for choice in completion_response.choices:
Expand Down
Loading
Loading