Skip to content

Commit c2fb069

Browse files
authored
chore(llmobs): add experiment url (#14134)
Add a url property so users can easily hop into the product after an experiment is run.
1 parent 2abe298 commit c2fb069

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ddtrace/llmobs/_experiment.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,12 @@ def run(
297297
)
298298
return experiment_results
299299

300+
@property
301+
def url(self) -> str:
302+
# FIXME: need to use the user's site
303+
# also will not work for subdomain orgs
304+
return f"https://app.datadoghq.com/llm/experiments/{self._id}"
305+
300306
def _process_record(self, idx_record: Tuple[int, DatasetRecord]) -> Optional[TaskResult]:
301307
if not self._llmobs_instance or not self._llmobs_instance.enabled:
302308
return None

tests/llmobs/test_experiments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_dataset_one_record(llmobs):
8282
def test_dataset_create_delete(llmobs):
8383
dataset = llmobs.create_dataset(name="test-dataset-2", description="A second test dataset")
8484
assert dataset._id is not None
85+
assert dataset.url == f"https://app.datadoghq.com/llm/datasets/{dataset._id}"
8586

8687
llmobs._delete_dataset(dataset_id=dataset._id)
8788

@@ -723,6 +724,7 @@ def test_experiment_run(llmobs, test_dataset_one_record):
723724
assert exp_result["input"] == {"prompt": "What is the capital of France?"}
724725
assert exp_result["output"] == {"prompt": "What is the capital of France?"}
725726
assert exp_result["expected_output"] == {"answer": "Paris"}
727+
assert exp.url == f"https://app.datadoghq.com/llm/experiments/{exp._id}"
726728

727729

728730
def test_experiment_span_written_to_experiment_scope(llmobs, llmobs_events, test_dataset_one_record):

0 commit comments

Comments
 (0)