Skip to content

Commit 828abac

Browse files
committed
do not send experiments i/o and metadata as strings so they can be searchable
1 parent c669a7d commit 828abac

File tree

3 files changed

+8
-17
lines changed

3 files changed

+8
-17
lines changed

ddtrace/llmobs/_experiment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,11 @@ def _process_record(self, idx_record: Tuple[int, DatasetRecord], run: _Experimen
457457
except Exception:
458458
span.set_exc_info(*sys.exc_info())
459459
self._llmobs_instance.annotate(span, input_data=input_data, output_data=output_data, tags=tags)
460-
span._set_ctx_item(EXPERIMENT_EXPECTED_OUTPUT, safe_json(record["expected_output"]))
460+
461+
span._set_ctx_item(EXPERIMENT_EXPECTED_OUTPUT, record["expected_output"])
461462
if "metadata" in record:
462463
span._set_ctx_item(EXPERIMENT_RECORD_METADATA, record["metadata"])
464+
463465
return {
464466
"idx": idx,
465467
"span_id": span_id,

ddtrace/llmobs/_llmobs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,9 +1609,9 @@ def _tag_freeform_io(cls, span, input_value=None, output_value=None):
16091609
arbitrary structured or non structured IO values in its spans
16101610
"""
16111611
if input_value is not None:
1612-
span._set_ctx_item(EXPERIMENTS_INPUT, safe_json(input_value))
1612+
span._set_ctx_item(EXPERIMENTS_INPUT, input_value)
16131613
if output_value is not None:
1614-
span._set_ctx_item(EXPERIMENTS_OUTPUT, safe_json(output_value))
1614+
span._set_ctx_item(EXPERIMENTS_OUTPUT, output_value)
16151615

16161616
@staticmethod
16171617
def _set_dict_attribute(span: Span, key, value: Dict[str, Any]) -> None:

setup.cfg

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
1+
[bdist_wheel]
2+
universal=1
3+
14
[codespell]
25
skip = *.json,*.h,*.cpp,*.c,.riot,.tox,.mypy_cache,.git,*ddtrace/vendor,tests/contrib/openai/cassettes/*,tests/contrib/langchain/cassettes/*,ddtrace/appsec/_iast/_taint_tracking/_vendor/*
36
exclude-file = .codespellignorelines
47
ignore-words-list = asend,dne,fo,medias,ment,nin,ot,setttings,statics,ba,spawnve,doas
58

6-
# DEV: We use `conftest.py` as a local pytest plugin to configure hooks for collection
7-
[tool:pytest]
8-
# --cov-report is intentionally empty else pytest-cov will default to generating a report
9-
addopts =
10-
--cov=ddtrace/
11-
--cov=tests/
12-
--cov-append
13-
--cov-report=
14-
--durations=10
15-
--junitxml=test-results/junit.xml
16-
# DEV: The default is `test_*\.py` which will miss `test.py` files
17-
python_files = test*\.py
18-
asyncio_mode = auto
19-
209
[flake8]
2110
max-line-length = 120

0 commit comments

Comments
 (0)