override fun testLLMCallToolCallLLMCallGetExpectedInitialLLMCallSpanAttributes()

in agents/agents-features/agents-features-opentelemetry/src/jvmTest/kotlin/ai/koog/agents/features/opentelemetry/integration/weave/WeaveTraceStructureTest.kt [20:73]


    override fun testLLMCallToolCallLLMCallGetExpectedInitialLLMCallSpanAttributes(
        model: LLModel,
        temperature: Double,
        systemPrompt: String,
        userPrompt: String,
        runId: String,
        toolCallId: String
    ): Map<String, Any> {
        val inputMessages = OpenTelemetryTestAPI.getMessagesString(
            listOf(
                Message.System(systemPrompt, RequestMetaInfo(OpenTelemetryTestAPI.testClock.now())),
                Message.User(userPrompt, RequestMetaInfo(OpenTelemetryTestAPI.testClock.now())),
            )
        )
        val outputMessages = OpenTelemetryTestAPI.getMessagesString(
            listOf(
                OpenTelemetryTestAPI.toolCallMessage(
                    toolCallId,
                    TestGetWeatherTool.name,
                    "{\"location\":\"Paris\"}"
                )
            )
        )
        val systemInstructions = OpenTelemetryTestAPI.getSystemInstructionsString(listOf(systemPrompt))
        val toolDefinitions = OpenTelemetryTestAPI.getToolDefinitionsString(listOf(TestGetWeatherTool.descriptor))

        return mapOf(
            "gen_ai.provider.name" to model.provider.id,
            "gen_ai.conversation.id" to runId,
            "gen_ai.output.type" to "text",
            "gen_ai.operation.name" to "chat",
            "gen_ai.request.temperature" to temperature,
            "gen_ai.request.model" to model.id,
            "gen_ai.response.model" to model.id,
            "gen_ai.usage.input_tokens" to 0L,
            "gen_ai.usage.output_tokens" to 0L,
            "gen_ai.input.messages" to inputMessages,
            "system_instructions" to systemInstructions,
            "gen_ai.output.messages" to outputMessages,
            "gen_ai.tool.definitions" to toolDefinitions,
            "gen_ai.response.finish_reasons" to listOf(SpanAttributes.Response.FinishReasonType.ToolCalls.id),

            "gen_ai.prompt.0.role" to Message.Role.System.name.lowercase(),
            "gen_ai.prompt.0.content" to systemPrompt,
            "gen_ai.prompt.1.role" to Message.Role.User.name.lowercase(),
            "gen_ai.prompt.1.content" to userPrompt,
            "gen_ai.completion.0.role" to Message.Role.Assistant.name.lowercase(),
            "gen_ai.completion.0.finish_reason" to SpanAttributes.Response.FinishReasonType.ToolCalls.id,
            // Weave-specific: tool_calls attributes without content for initial LLM call
            "gen_ai.completion.0.tool_calls.0.id" to toolCallId,
            "gen_ai.completion.0.tool_calls.0.type" to "function",
            "gen_ai.completion.0.tool_calls.0.function" to "{\"name\":\"${TestGetWeatherTool.name}\",\"arguments\":\"{\\\"location\\\":\\\"Paris\\\"}\"}",
        )
    }