def _key_or_property()

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


def _key_or_property(obj, name):
    if isinstance(obj, Mapping):
        return obj[name]
    return getattr(obj, name)