Repository: meta-llama/llama-stack
File: tests/unit/providers/agents/meta_reference/test_openai_responses.py (Python)

Code before:
    )

    # Collect all chunks
    chunks = [chunk async for chunk in result]

    # Verify top_p is in the created event
    created_event = chunks[0]
    assert created_event.type == "response.created"
    assert created_event.response.top_p == top_p_value

    # Verify top_p is in the completed event
    completed_event = chunks[-1]
    assert completed_event.type == "response.completed"
    assert completed_event.response.top_p == top_p_value

    # Verify the top_p was passed to inference API
    mock_inference_api.openai_chat_completion.assert_called()
    call_args = mock_inference_api.openai_chat_completion.call_args
    params = call_args.args[0]
    assert params.top_p == top_p_value

    # Verify the top_p was stored
    mock_responses_store.upsert_response_object.assert_called()
    store_call_args = mock_responses_store.upsert_response_object.call_args
    stored_response = store_call_args.kwargs["response_object"]
    assert stored_response.top_p == top_p_value


Review comment (suggestion):
@EleanorWho I think you may want to update `test_params_passed_through_full_chain_to_backend_service` by adding `top_p`? Check https://github.com/llamastack/llama-stack/pull/4850/changes  

Code after:

    # Mock inference response
    mock_inference_api.openai_chat_completion.return_value = fake_stream()

    # Execute with function tool that has strict=False
    await openai_responses_impl.create_openai_response(
        input=input_text,
        model=model,
        stream=False,
        tools=[
            OpenAIResponseInputToolFunction(
                type="function",
                name="get_weather",
                description="Get weather information",
                parameters={"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]},
                strict=False,  # Explicitly set to False
            )
        ],
    )

    # Verify the call was made
    assert mock_inference_api.openai_chat_completion.call_count == 1
    params = mock_inference_api.openai_chat_completion.call_args[0][0]

    # Verify 'strict' field IS present and set to False
    tool_function = params.tools[0]["function"]
    assert "strict" in tool_function, "strict field should be included when explicitly set to False"
    assert tool_function["strict"] is False, "strict field should be False"


async def test_create_openai_response_with_truncation_disabled_streaming(
    openai_responses_impl, mock_inference_api, mock_responses_store
):
    """Test that truncation='disabled' is properly handled in streaming responses."""
    input_text = "Explain machine learning comprehensively."
    model = "meta-llama/Llama-3.1-8B-Instruct"

    mock_inference_api.openai_chat_completion.return_value = fake_stream()

    # Execute
    result = await openai_responses_impl.create_openai_response(
        input=input_text,
        model=model,
        truncation=ResponseTruncation.disabled,
        stream=True,
        store=True,
    )

    # Collect all chunks
    chunks = [chunk async for chunk in result]