Fevol/obsidian-translate

OpenAI Translator

Opened this issue · 3 comments

Fevol commented

With beta release 1.4.5 (accessible using BRAT), the OpenAI service has been added to the plugin, by recommendation of @ckt1031 and inspired by the OpenAI Translator Application.

I will be releasing this update by the end of the week. However, I am eagerly looking for any feedback for this service.

Specifically:

  • How will you be using the service? Does it work decently?
  • Why do you prefer to translate with OpenAI over the other services (thus, should I be focusing more on GPT's capabilities?)

Some implementation details:

  • The service works by simply passing along following prompts for a given input:
    • Detect language: Identify the language of the input, please ONLY output its ISO639-1 code:\n INPUT
    • Translate (auto detect language): Translate following text to 'TARGET' without explanation, include ISO639-1 locale of the input in the first line:\n INPUT
    • Translate (source language given): Translate following text from 'SOURCE' to 'TARGET' without explanation:\n INPUT
  • Currently, I haven't considered the token limit at all. I made the assumption that people wouldn't translate entire notes using this service (current limit for GPT3.5 is at ~10.000 characters or ~1.000 words, or double that with GPT4)
  • The plugin tries to focus on only one thing, being translating text. I realise that GPT can be used in many more tasks (such as pronunciation, sentence dissection, word-by-word explanations, however, I personally feel that this is outside of the scope of the plugin, and would be tricky to implement)
  • If you use any proxy GPT services, please do let me know. Currently, only the official API is implemented and tested.

Failed to use private GPT endpoints, and also NOT every custom API endpoints have v1/engines available.

image

Fevol commented

Can you give me an idea of what your API looks like?
I can substitute the v1/engines endpoint to something else, but I need something that would work on most services (or otherwise, allow the user to specify what their API looks like and what it returns, but that seems a bit cumbersome).

Also, it seems like you're getting another error, if it doesn't show any sensitive information, can you share a picture of what error is being given in the devtools?

There are no error messages in the background.

I have also reviewed your code regarding OpenAI services, The custom URL/domain will be treated as normal translation endpoint instead of OpenAI endpoint

You can figure this out safely, only $0.1 credit is available.

P.S., this plugin should allow us to config the model for custom endpoints, such as GPT-3.5, GPT-3.5-16K, and GPT-4.

Endpoint: https://one-api.ckt1031.xyz, https://one-api.ckt1031.xyz/v1, https://one-api.ckt1031.xyz/v1/chat/completions
API Key: sk-cSakOOAB5cVI0uLw2c5eAe4e71814dF298Cb47EbB3B1FcEc

image