DSPy: The framework for programming—not prompting—language models
Python
update deduplicate (#8623)
Grégory Salvana949aa946826
diff --git a/dspy/dsp/utils/utils.py b/dspy/dsp/utils/utils.pyindex 19ab4dd59..7960ab049 100644--- a/dspy/dsp/utils/utils.py+++ b/dspy/dsp/utils/utils.py@@ -50,12 +50,12 @@ def create_directory(path):def deduplicate(seq: list[str]) -> list[str]:"""- Source: https://stackoverflow.com/a/480227/1493011+ From Raymond Hettinger+ https://twitter.com/raymondh/status/944125570534621185+ Since Python 3.6 Dict are ordered+ Benchmark: https://gist.github.com/peterbe/67b9e40af60a1d5bcb1cfb4b2937b088"""-- seen = set()- return [x for x in seq if not (x in seen or seen.add(x))]-+ return list(dict.fromkeys(seq))def batch(group, bsize, provide_offset=False):offset = 0