def _serialize_tool_calls_for_event()

in instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py [0:0]


def _serialize_tool_calls_for_event(tool_calls):
    return [
        {
            "id": _key_or_property(tool_call, "id"),
            "type": _key_or_property(tool_call, "type"),
            "function": {
                "name": _key_or_property(_key_or_property(tool_call, "function"), "name"),
                "arguments": _key_or_property(_key_or_property(tool_call, "function"), "arguments"),
            },
        }
        for tool_call in tool_calls
    ]