-
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete overhaul of the chatgpt
script
#848
Conversation
- Single class named `OpenAITranslator` - Uses key to set desired OpenAI model (`OPENAI_MODEL`) - Made child of `ConfigGPT` - Function to check for common refusal terms (`_cannot_assist`) - Revised `Translator` class to map `openai` and `gpt`* to `chatgpt` - Example `gpt_config` file - Utilization of `chat_sample`
Remove superfluous import
- Use `VALID_LANGUAGES` as language codes - Fix oversight, made ChatSample is optional
@SamuelWN VALID_LANGUAGES is not aligned with _CHAT_SAMPLE in config_gpt.py "CHS" map to "Chinese (Simplified)" in VALID_LANGUAGES while "Simplified Chinese" was used in _CHAT_SAMPLE |
NO. Partial responses do occur, and they are very common. The OpenAI class is not limited to OpenAI's own models; it also applies to all models that are compatible with OpenAI API endpoints. Almost all models can be converted into OpenAI-style APIs through the 2api project. Therefore, it is unreasonable to only test OpenAI's models. I mean you can get the right translation if you keep retry. |
@IwfWcf Thank you for the notice, I will submit a patch soon. @popcion I think you may have misunderstood the line:
That's referring to the user-provided value "translator"within the config-example.json file. It has no relation to the
it will be assumed that they meant ChatGPT. (Since the relevant API key is named "OPENAI_API_KEY", I felt it was a reasonable assumption for the user to make.) The function that checks for refusals ( I have not encountered any instance of partial refusals. With my test samples:
If you know of any ChatGPT model + input combinations that provide a partial response, that would be very helpful for testing. |
@popcion I admittedly did overlook that batching logic - it seemed like some bizarre error-handling, but with that context, I understand the logic now.
I've personally viewed that as something to adjust in the System Prompt. There's cases where a single phrase on the page makes sense, other times where it is nonsense - best to try to encourage the AI to handle it properly. I would appreciate your feedback on my fork: https://github.com/SamuelWN/manga-image-translator/tree/JSON As mentioned in the initial commit message: Submitting the requests as JSON using the
|
@SamuelWN [edit] The following error occurs frequently.
The JSON mode itself is quite good, but it needs to prompt for the return content list to be displayed on separate lines; otherwise, the command line output appears all in one line, which is not very aesthetically pleasing. The prefix issue is currently not very important; as the model becomes smarter, the problem with incorrect prefixes occurs less frequently. However, if necessary, an additional JSON mode should be added, while retaining the existing translation and retry logic, only addressing the prefix handling. And don't forget reasoning model handling. I know it's not very reasonable, but there is now a demand for using reasoning models for translation. Some reasoning content is at the same level as the content, while some are within the content itself. |
Are you sure that Claude supports the Have you tried it with any ChatGPT models? I know I named it poorly, but the I have not encountered any refusals or errors with:
Might be worthwhile forking the class itself - one
Yeah, I've tested some ways to attempt to handle that within the logger. I tested
I actually added
(Worth noting, however, that deepseek-r1 does not include any PS: If able to run models locally: I have also implemented and tested JSON-formatting into the |
In fact, many experienced users who frequently use AI now integrate various different models together, using OpenAI's format as an intermediary for seamless transition. Due to the emergence of these two main projects, a large number of 2api projects have continuously appeared, all aimed at being fully compatible with the OpenAI format. As a result, all models can use it. It's possible to reference the classification from this project: |
OpenAITranslator
OPENAI_MODEL
)ConfigGPT
_cannot_assist
)Translator
class to mapopenai
andgpt
* tochatgpt
gpt_config
filechat_sample
Tested with
OPENAI_MODEL='gpt-4o-mini'
PS: I am also currently working on implementing
request_format
, though more dev work is needed. (Updating theopenai
version would be required, though initial testing with1.63.0
seems not to break anything.)