crewAIInc / crewAI-examples

2.63k stars 972 forks source link

How to change the correct language name #156

Open Beck221 opened 2 weeks ago

Beck221 commented 2 weeks ago

In Class Crew, I can see there is a parameter named langague. And it's default value is 'en'. So if I want to change to support Chinese, what's the correct value for Chinese to define here? language: str = Field( default="en", description="Language used for the crew, defaults to English.", ) I tried to change it to 'zh' but it failed with below error. Could someone help look into this issue? crew = Crew( agents=[ city_selector_agent, local_expert_agent, travel_concierge_agent ], tasks=[identify_task, gather_task, plan_task], language='zh', verbose=True ) ERROR: 2024-08-28 16:12:22.267 Uncaught app exception Traceback (most recent call last): File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/crewai/utilities/i18n.py", line 24, in load_translation with open(prompts_path, "r") as f: ^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/crewai/utilities/../translations/zh.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 85, in exec_func_with_error_handling result = func() ^^^^^^ File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 576, in code_to_exec exec(code, module.dict) File "/home/beck_z/crewAI-examples/trip_planner/trip_planner_chn.py", line 126, in main() File "/home/beck_z/crewAI-examples/trip_planner/trip_planner_chn.py", line 117, in main result = trip_crew.run() ^^^^^^^^^^^^^^^ File "/home/beck_z/crewAI-examples/trip_planner/trip_planner_chn.py", line 56, in run result = crew.kickoff() ^^^^^^^^^^^^^^ File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/crewai/crew.py", line 182, in kickoff agent.i18n = I18N(language=self.language) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/pydantic/main.py", line 171, in init self.__pydantic_validator__.validate_python(data, self_instance=self) File "/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/crewai/utilities/i18n.py", line 27, in load_translation raise ValidationError( ^^^^^^^^^^^^^^^^ TypeError: No constructor defined

theCyberTech commented 1 week ago

FileNotFoundError: [Errno 2] No such file or directory: '/home/beck_z/.conda/envs/beck_zb/lib/python3.11/site-packages/crewai/utilities/../translations/zh.json

This file is missing