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 (#1774)

coolmian4822d4767d9e
diff --git a/dspy/adapters/chat_adapter.py b/dspy/adapters/chat_adapter.py
index f8be79241..0b1740542 100644
--- a/dspy/adapters/chat_adapter.py
+++ b/dspy/adapters/chat_adapter.py
@@ -165,7 +165,7 @@ def _format_field_value(field_info: FieldInfo, value: Any, assume_text=True) ->
# If the field has no special type requirements, format it as a nice numbered list for the LM.
string_value = format_input_list_field_value(value)
elif isinstance(value, pydantic.BaseModel) or isinstance(value, dict) or isinstance(value, list):
- string_value = json.dumps(_serialize_for_json(value))
+ string_value = json.dumps(_serialize_for_json(value), ensure_ascii=False)
else:
string_value = str(value)