mirror of
https://github.com/NVIDIA-NeMo/DataDesigner
synced 2026-05-24 09:48:29 +00:00
Add support for capturing full conversation traces during LLM generation, enabling debugging and fine-tuning dataset creation. Changes: - Add `with_trace` field to LLMTextColumnConfig for per-column trace control - Add `debug_override_save_all_column_traces` to RunConfig for global trace - Introduce ChatMessage dataclass for structured message representation - Update ModelFacade.generate() to return full message trace - Rename trace column postfix from `__reasoning_trace` to `__trace` - Add comprehensive traces documentation Traces capture system/user/assistant messages in order, enabling visibility into the full generation conversation including correction retries.
23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
from data_designer.engine.models.utils import ChatMessage, prompt_to_messages
|
|
|
|
|
|
def test_prompt_to_messages() -> None:
|
|
stub_system_prompt = "some system prompt"
|
|
mult_modal_context = {"type": "image_url", "image_url": {"url": "http://example.com/image.png"}}
|
|
assert prompt_to_messages(user_prompt="hello") == [ChatMessage.as_user("hello")]
|
|
assert prompt_to_messages(user_prompt="hello", system_prompt=stub_system_prompt) == [
|
|
ChatMessage.as_system(stub_system_prompt),
|
|
ChatMessage.as_user("hello"),
|
|
]
|
|
assert prompt_to_messages(user_prompt="hello", multi_modal_context=[mult_modal_context]) == [
|
|
ChatMessage.as_user([mult_modal_context, {"type": "text", "text": "hello"}])
|
|
]
|
|
assert prompt_to_messages(
|
|
user_prompt="hello", system_prompt=stub_system_prompt, multi_modal_context=[mult_modal_context]
|
|
) == [
|
|
ChatMessage.as_system(stub_system_prompt),
|
|
ChatMessage.as_user([mult_modal_context, {"type": "text", "text": "hello"}]),
|
|
]
|