Skip to content

Commit b54b8dc

Browse files
committed
Add available tools
1 parent ac4f406 commit b54b8dc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sentry_sdk/integrations/openai.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ def _set_request_data(span, kwargs, operation, integration):
191191
span, SPANDATA.GEN_AI_REQUEST_PRESENCE_PENALTY, presence_penalty
192192
)
193193

194+
frequency_penalty = kwargs.get("frequency_penalty")
195+
if frequency_penalty is not None:
196+
set_data_normalized(
197+
span, SPANDATA.GEN_AI_REQUEST_FREQUENCY_PENALTY, frequency_penalty
198+
)
199+
194200
temperature = kwargs.get("temperature")
195201
if temperature is not None:
196202
set_data_normalized(span, SPANDATA.GEN_AI_REQUEST_TEMPERATURE, temperature)
@@ -199,6 +205,13 @@ def _set_request_data(span, kwargs, operation, integration):
199205
if top_p is not None:
200206
set_data_normalized(span, SPANDATA.GEN_AI_REQUEST_TOP_P, top_p)
201207

208+
# Tools
209+
tools = kwargs.get("tools", [])
210+
if tools is not None and len(tools) > 0:
211+
set_data_normalized(
212+
span, SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools)
213+
)
214+
202215

203216
def _set_response_data(span, response, kwargs, integration):
204217
# type: (Span, Any, dict[str, Any], Integration) -> None

0 commit comments

Comments
 (0)