|
52 | 52 | } |
53 | 53 |
|
54 | 54 | COLLECTED_CHAT_RESP_ATTRS = { |
55 | | - "generation_id": "ai.generation_id", |
56 | | - "is_search_required": "ai.is_search_required", |
57 | | - "finish_reason": "ai.finish_reason", |
| 55 | + "generation_id": SPANDATA.AI_GENERATION_ID, |
| 56 | + "is_search_required": SPANDATA.AI_SEARCH_REQUIRED, |
| 57 | + "finish_reason": SPANDATA.AI_FINISH_REASON, |
58 | 58 | } |
59 | 59 |
|
60 | 60 | COLLECTED_PII_CHAT_RESP_ATTRS = { |
61 | | - "citations": "ai.citations", |
62 | | - "documents": "ai.documents", |
63 | | - "search_queries": "ai.search_queries", |
64 | | - "search_results": "ai.search_results", |
65 | | - "tool_calls": "ai.tool_calls", |
| 61 | + "citations": SPANDATA.AI_CITATIONS, |
| 62 | + "documents": SPANDATA.AI_DOCUMENTS, |
| 63 | + "search_queries": SPANDATA.AI_SEARCH_QUERIES, |
| 64 | + "search_results": SPANDATA.AI_SEARCH_RESULTS, |
| 65 | + "tool_calls": SPANDATA.AI_TOOL_CALLS, |
66 | 66 | } |
67 | 67 |
|
68 | 68 |
|
@@ -127,7 +127,7 @@ def collect_chat_response_fields(span, res, include_pii): |
127 | 127 | ) |
128 | 128 |
|
129 | 129 | if hasattr(res.meta, "warnings"): |
130 | | - set_data_normalized(span, "ai.warnings", res.meta.warnings) |
| 130 | + set_data_normalized(span, SPANDATA.AI_WARNINGS, res.meta.warnings) |
131 | 131 |
|
132 | 132 | @wraps(f) |
133 | 133 | def new_chat(*args, **kwargs): |
@@ -238,7 +238,7 @@ def new_embed(*args, **kwargs): |
238 | 238 | should_send_default_pii() and integration.include_prompts |
239 | 239 | ): |
240 | 240 | if isinstance(kwargs["texts"], str): |
241 | | - set_data_normalized(span, "ai.texts", [kwargs["texts"]]) |
| 241 | + set_data_normalized(span, SPANDATA.AI_TEXTS, [kwargs["texts"]]) |
242 | 242 | elif ( |
243 | 243 | isinstance(kwargs["texts"], list) |
244 | 244 | and len(kwargs["texts"]) > 0 |
|
0 commit comments