def _span_name_from_attributes()

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


def _span_name_from_attributes(attributes: Attributes) -> str:
    request_model = attributes.get(GEN_AI_REQUEST_MODEL)
    return (
        f"{attributes[GEN_AI_OPERATION_NAME]} {request_model}"
        if request_model
        else f"{attributes[GEN_AI_OPERATION_NAME]}"
    )