Skip to content

Commit 526acf3

Browse files
committed
fix langchain on_llm_start
1 parent 0473c7f commit 526acf3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sentry_sdk/integrations/langchain.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import sentry_sdk
66
from sentry_sdk.ai.monitoring import set_ai_pipeline_name
77
from sentry_sdk.ai.utils import (
8+
GEN_AI_ALLOWED_MESSAGE_ROLES,
89
normalize_message_roles,
910
set_data_normalized,
1011
get_start_span_function,
@@ -213,7 +214,13 @@ def on_llm_start(
213214
_set_tools_on_span(span, all_params.get("tools"))
214215

215216
if should_send_default_pii() and self.include_prompts:
216-
normalized_messages = normalize_message_roles(prompts)
217+
normalized_messages = [
218+
{
219+
"role": GEN_AI_ALLOWED_MESSAGE_ROLES.USER,
220+
"content": {"type": "text", "text": prompt},
221+
}
222+
for prompt in prompts
223+
]
217224
set_data_normalized(
218225
span,
219226
SPANDATA.GEN_AI_REQUEST_MESSAGES,

0 commit comments

Comments
 (0)