MetaGPT
MetaGPT copied to clipboard
the action_node example do not support chinese
trafficstars
Bug description file: metagpt/actions/action_node.py line 189
def compile_to(self, i: Dict, schema, kv_sep) -> str:
if schema == "json":
return json.dumps(i, indent=4)
elif schema == "markdown":
return dict_to_markdown(i, kv_sep=kv_sep)
else:
return str(i)
json schema will compile the action_node example Chinese str to unicode, if the input is unicode, LLM has a good chance to output unicode,
Bug solved method i think maybe it could add a parameter “ensure_ascii=False”, just like:
def compile_to(self, i: Dict, schema, kv_sep) -> str:
if schema == "json":
return json.dumps(i, indent=4, ensure_ascii=False)
elif schema == "markdown":
return dict_to_markdown(i, kv_sep=kv_sep)
else:
return str(i)
Environment information
- LLM type and model name: OpenAi gpt-4-1106-preview
- System version:
- Python version: 3.10.13
- packages version: 0.6.6
- installation method: pip
Screenshots or logs
https://github.com/geekan/MetaGPT/pull/1065 I added this by the way