Skip to content
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

[功能请求] 支持Claude3的API #232

Closed
Arthur-WWW opened this issue Mar 14, 2024 · 13 comments
Closed

[功能请求] 支持Claude3的API #232

Arthur-WWW opened this issue Mar 14, 2024 · 13 comments
Labels
enhancement New feature or request

Comments

@Arthur-WWW
Copy link

最近Claude3的API出来了,价格比chatgpt便宜,速度也快,用来代替chatgpt3.5不错,能否支持一下,谢谢

@alissonryan
Copy link

I have been using Claude 3 a lot in my applications and I would be very happy to have it to translate my books. Would it be possible to insert it into the plugin?

@bookfere bookfere added the enhancement New feature or request label Mar 17, 2024
@bookfere
Copy link
Owner

@Arthur-WWW 谢谢建议。现已根据文档添加了 Claude 为翻译引擎,但是目前我没条件测试。请从插件主页 https://translator.bookfere.com 下载安装最新的 Rolling Release 版本测试并提供反馈。

@alissonryan Claude has been added as a translation engine; however, I am unable to test it currently. Please download and install the Rolling Release version from https://translator.bookfere.com and provide further feedback.

@Arthur-WWW
Copy link
Author

I select model "claude-3-haiku-20240307" and test engine, got below log:
Traceback (most recent call last):

File "calibre_plugins.ebook_translator.components.engine", line 70, in translate_text

File "calibre_plugins.ebook_translator.engines.anthropic", line 117, in _parse_stream

AttributeError: 'NoneType' object has no attribute 'get'

@bookfere
Copy link
Owner

@Arthur-WWW I have fixed the bug. Please try the latest version.

@Arthur-WWW
Copy link
Author

Arthur-WWW commented Mar 18, 2024

最新版可以翻译了,但速度却很慢,还经常断线,同样的环境用Gemini就没有这个问题,不确定是Claude服务器的问题,还是实现的问题。
update:
将线程数从10降到5后断线的情况没有了,速度也正常了。
新版本合并翻译后生成的epub文件里有大段的英文,之前的2.2没有这个问题,我退回2.2用同一个epub再对比一下

@bookfere
Copy link
Owner

如果是大段原文后面有大段译文,这可能是因为原文译文行数没对齐导致的,是预期行为,是根据 #208 做的改动。

@Arthur-WWW
Copy link
Author

确实是这个问题,所以是因为合并翻译才产生的问题?这个问题之后会解决吗?现在取消合并翻译是否能避免这个问题?

@bookfere
Copy link
Owner

bookfere commented Mar 18, 2024

对,只有合并翻译会出现这个问题。如果行数不一致,错乱着匹配就没有意义了。解决这个问题,需要在高级模式手动对齐行数。不过 #241 提出了一个不错的想法,当行数不一致时,可以将其拆开重新翻译一次,应该就能自动解决这个问题了。

@Arthur-WWW
Copy link
Author

合并翻译我的理解是合并几个段落一起翻译,所以译文只要段落数跟原文一样就能对上,这是否可以在prompt里要求返回的译文格式保持跟原文一样的分段格式就能解决这个问题?
没了解之前的讨论,不太理解行数不一致是什么意思

@bookfere
Copy link
Owner

原文是通过换行符将多个段落合并起来的,因此需要返回的译文也保持同样的格式,但 AI 可能会删减行数。

不太确定通过提示词约束是否可靠,你可以在设置中修改提示词试试看。

@Arthur-WWW
Copy link
Author

好的,AI翻译时还会改变段落数,我改一下prompt试试,之前写语法检查的prompt也加了类似的约束,效果还可以,至少可以很大程度上缓解这个问题

@Baiyssy
Copy link

Baiyssy commented Mar 29, 2024

我试过很多版提示词,都不能完全避免Gemini输出错行的问题。
另外,我发现在提示词里面加上书的简介,翻译效果可能会好一点。

@Arthur-WWW
Copy link
Author

确实,我也测试过了,并不能通过prompt避免这个问题,还没有测试的是自己给原文加上一个特殊的段落号标记,要求译文返回时保留这个标记,并在prompt里给一个example。不合并翻译有时遇到单行人名这种段落,Gemini就开始胡扯,可能由于免费的原因Gemini的稳定性越来越差

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants