joaomdmoura / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
17k stars 2.3k forks source link

Multilingual support #532

Open abdalladorrah opened 2 months ago

abdalladorrah commented 2 months ago

Hello, i tried to use crewAI to generate Arabic content , although the llm understand and generate Arabic text, but the core of crewAI does not support that, and it leads to nothing response.

I need an arabian version how can I get that? I can help in translation and supporting Arabic if it in my range of knowledge Thanks

atb29 commented 2 months ago

Hello, i tried to use crewAI to generate Arabic content , although the llm understand and generate Arabic text, but the core of crewAI does not support that, and it leads to nothing response.

I need an arabian version how can I get that? I can help in translation and supporting Arabic if it in my range of knowledge Thanks

I have the same problem as you... Is there any way to get around that with crewai??

abdalladorrah commented 1 month ago

Hello, i tried to use crewAI to generate Arabic content , although the llm understand and generate Arabic text, but the core of crewAI does not support that, and it leads to nothing response. I need an arabian version how can I get that? I can help in translation and supporting Arabic if it in my range of knowledge Thanks

I have the same problem as you... Is there any way to get around that with crewai??

there is update in crewAI website about language, but i am still in search for how to use it

joaomdmoura commented 1 month ago

We are shipping in this new version I'm writing new docs for it, but you will be bale to provide your own translations now! I'll make sure to add the link to the docs here once it's done

abdalladorrah commented 1 month ago

you

Is it the file of en.json located in translation folder?

cbarkinozer commented 3 days ago

There is an "en.json" file inside "C:\myproject\crew\venv\Lib\site-packages\crewai\translations", I copied that file into the same folder and changed its name to "tr.json" and translated the values to Turkish. Later changed the below part in the i18n.py file by adding "utf-8" encoding so it does not throw an exception when it sees a special character:

 try:
            if self.language_file:
                with open(self.language_file, "r", encoding='utf-8') as f:
                    self._translations = json.load(f)
            else:
                dir_path = os.path.dirname(os.path.realpath(__file__))
                prompts_path = os.path.join(
                    dir_path, f"../translations/{self.language}.json"
                )

                with open(prompts_path, "r", encoding='utf-8') as f:
                    self._translations = json.load(f)

Even though the project started without a problem, it failed when using a tool. This approach might work with other languages, other translations or other crew.ai implementations. In my opinion, because these translation JSONs include crew.ai's inner working prompts, they should be tested thoroughly and later added by crew.ai. I prefer using English prompts with "answer in " sentences in all agent and task prompts for now because it works without a problem and LLMs perform better with English prompts.