ChatGPT Translation
Use ChatGPT as a translation provider into directive @strTranslate
, to translate a field value to your desired language.
Description
Make ChatGPT's API available as a translation provider in directive @strTranslate
.
Add directive @strTranslate
to any field of type String
, to translate it to the desired language.
For instance, this query translates the post's title
and content
fields from English to French using the ChatGPT API:
OpenAI Authorization
In order to use ChatGPT, it is mandatory to provide your OpenAI API key, via tab "Plugin Management => ChatGPT Translation" on the Settings page.
Create the API key in your OpenAI's account.
Then follow one of the methods below to input the value.
By Settings
Input the API key in the corresponding inputs in the Settings page, and click on "Save Changes (All)":
wp-config.php
In
Add constant GATOGRAPHQL_CHATGPT_TRANSLATION_SERVICES_OPENAI_API_KEY
in wp-config.php
:
By environment variable
Define environment variable CHATGPT_TRANSLATION_SERVICES_OPENAI_API_KEY
.
ChatGPT model
You can customize which OpenAI model to use to execute the translation.
The following models are supported:
gpt-40
gpt-40-mini
Follow one of the methods below to input the value.
By Settings
Input the model in the corresponding input in the Settings page, and click on "Save Changes (All)":
wp-config.php
In
Add constant GATOGRAPHQL_CHATGPT_TRANSLATION_SERVICES_MODEL
in wp-config.php
:
By environment variable
Define environment variable CHATGPT_TRANSLATION_SERVICES_MODEL
.
Translation prompt
You can customize the prompt to pass ChatGPT to execute the translation.
Follow one of the methods below to input the value.
By Settings
Input the "System message" and "Prompt template" in the corresponding inputs in the Settings page, and click on "Save Changes (All)":
wp-config.php
In
Add constants GATOGRAPHQL_CHATGPT_TRANSLATION_SERVICES_SYSTEM_MESSAGE
and GATOGRAPHQL_CHATGPT_TRANSLATION_SERVICES_PROMPT_TEMPLATE
in wp-config.php
:
By environment variable
Define environment variables CHATGPT_TRANSLATION_SERVICES_SYSTEM_MESSAGE
and CHATGPT_TRANSLATION_SERVICES_PROMPT_TEMPLATE
.