Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

fix: prevent Chinese examples from being converted to Unicode encoding (#1787)

coolmian793530c65a0e
diff --git a/dspy/adapters/chat_adapter.py b/dspy/adapters/chat_adapter.py
index 0b1740542..edb5e1870 100644
--- a/dspy/adapters/chat_adapter.py
+++ b/dspy/adapters/chat_adapter.py
@@ -388,7 +388,7 @@ def prepare_instructions(signature: SignatureMeta):
desc = f"must be one of: {'; '.join([str(x) for x in type_.__args__])}"
else:
desc = "must be pareseable according to the following JSON schema: "
- desc += json.dumps(prepare_schema(type_))
+ desc += json.dumps(prepare_schema(type_), ensure_ascii=False)
desc = (" " * 8) + f"# note: the value you produce {desc}" if desc else ""
return f"{{{field_name}}}{desc}"