I believe I have used OpenAI's paid API correctly, but there is no response in the translation interface.

I believe I have used OpenAI's paid API correctly, but there is no response in the translation interface.

I have attached the content of the last request log.

-------------------------------

OpenAITranslator.API.OpenAIProvider: 2023-10-02 10:46:33.5584 Info Method: "GetTranslationResponse", Request Payload: {"Model":"gpt-4", "Temperature":0.75, "MaxTokens":414, "Prompt":"Translate this text from en-US into zh-CN, with a explanation of the translation without newline characters after 'EXPLN:' : However, if these tears are left untreated, ongoing pain and accelerated cartilage degeneration may ensue.\n1.", "Context":{"SourceLanguage":"en-US", "TargetLanguage":"zh-CN", "PromptLanguage":"en-US", "PromptText":"Translate this text from {0} into {1}, with a explanation of the translation without newline characters after 'EXPLN:' : {2}", "IncludeExplanation":true, "SearchText":"However, if these tears are left untreated, ongoing pain and accelerated cartilage degeneration may ensue.", "SegmentId":"a9f5767e-8de9-4b89-8185-bbb97cf634f8_13"}, "SegmentId":"a9f5767e-8de9-4b89-8185-bbb97cf634f8_13"} OpenAITranslator.API.OpenAIProvider: 2023-10-02 10:46:46.9014 Info Method: "GetTranslationResponse", Response Status: OK, Payload: "{\n \"id\": \"chatcmpl-853F0FYknuL6fmX523mN4QDehRanv\",\n \"object\": \"chat.completion\",\n \"created\": 1696214790,\n \"model\": \"gpt-4-0613\",\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"Ȼ Щ˺ δ ܻ ʹ ˻ \\nEXPLN: 仰 ķ ǣ Ȼ Щ˺ δ ܻ ʹ ˻ ' Щ˺ 'ָ ᵽ ij ˻ µ ˺ ѣ 'δ ' ʾ Щ˺ û еõ ʵ ҽ ƴ ' ܻ ʹ ˻ ' ʾ Щδ ˺ ѿ ܻᵼ ³ ʹ ʹ ǵ ˻ ̼ ١ \"\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 56,\n \"completion_tokens\": 221,\n \"total_tokens\": 277\n }\n}\n"

-------------------------------

Please confirm whether this is an issue with the Trados software or a problem with my settings? Thank you very much for the response.

Trados version: Trados Studio 2022 SR1 - 17.1.8.17828

  • Hi  , sorry to  hear this, can you confirm with me the version of OpenAI Translator that is installed on your system & if there are any errors, exceptions mentioned in the same log report?

  • Thank you for your prompt reply. My OpenAI Translator version is 1.1.3.0. I believe the installation is not an issue, as everything runs smoothly; it's just that there is no response.

    For easy reference, I had ChatGPT analyze the log, and its response is as follows:"

    ----------------------------

    It seems like you've provided content related to two log entries regarding the use of an OpenAI API, presumably for translation using a GPT-4 model. The first part discusses information about a translation request, while the second is information about the API's response.

    Summary of the Request Info:

    • Method Invoked: GetTranslationResponse
    • Request Payload: Includes the model to be used (GPT-4), temperature (0.75), max tokens (414), prompt text, and context among others.
    • Context: Involves source language (en-US), target language (zh-CN), prompt language (en-US), prompt text, etc. The request appears to seek translation of a text from English to Simplified Chinese and wishes the translated content to include an explanatory part, indicated by "EXPLN:".

    Summary of the Response Info:

    • Method: GetTranslationResponse
    • Response Status: OK
    • Response Payload: Contains ID, created timestamp, model (gpt-4-0613), choices of output, etc.
    • Content: The content of the response (the translated text) seems to be in Chinese but is not in standard UTF-8 encoded Chinese characters. This might be some form of encoding or display issue as you may have copied and pasted the text, or the tool/viewer used does not support the encoding format of the API response.

    Analysis

    • Regarding the Translated Content: If we disregard the encoding issue and try to interpret the translated content, it talks about "However, if these tears are left untreated, ongoing pain and accelerated cartilage degeneration may ensue". The explanation part seems to commence explaining some choices in vocabulary and translation decision, but we cannot fully comprehend it due to the encoding issue.
    • Regarding Encoding: You might want to check the tools or methods you’re using to handle the response payload to ensure it correctly decodes the UTF-8 text from the API.

    ------------------------------------

    Thank you once again for your response. I am hopeful to resolve the issue, so I will endeavor to provide any necessary information you need. Thank you.

  • Hi  , I have run some tests here and can't locate where the problem lies as the http response is already parsed as UTF-8; what I do see is that there is an issue with the log service not saving the esults in UTF-8.

    I will work on a new beta release to resolve this issue with the log service to save the data with the correct encoding, but doesn't explain why the results are not presented in the plugin view.  I would like to make a few changes to force reading the response as bytes and then convert the bytes to UTF-8 directly from the http content response to see if this changes anything from your system. 

    1. Would you be available for a short meeting to test this new beta release that I'm working on, and demo the issue from your system?
      1. If you are available, then please contact me directly at: phartnett@rws.com so that we can setup a meeting.
    2. What is the language of your OS?

    Note: when I perform a search with the same language & content, the result is represented in the log file correctly, as follows:


    OpenAITranslator.API.OpenAIProvider: 2023-10-03 16:31:13.9351 Info Method: "GetTranslationResponse", Request Payload: {"Model":"gpt-4", "Temperature":0.75, "MaxTokens":414, "Prompt":"Translate this text from en-US into zh-CN, with a explanation of the translation without newline characters after 'EXPLN:' : However, if these tears are left untreated, ongoing pain and accelerated cartilage degeneration may ensue.\n1.", "Context":{"SourceLanguage":"en-US", "TargetLanguage":"zh-CN", "PromptLanguage":"en-US", "PromptText":"Translate this text from {0} into {1}, with a explanation of the translation without newline characters after 'EXPLN:' : {2}", "IncludeExplanation":true, "SearchText":"However, if these tears are left untreated, ongoing pain and accelerated cartilage degeneration may ensue.", "SegmentId":"a52c788f-f46c-4692-b056-d5054c538aec_9"}, "SegmentId":"a52c788f-f46c-4692-b056-d5054c538aec_9"}  
    OpenAITranslator.API.OpenAIProvider: 2023-10-03 16:31:33.6522 Info Method: "GetTranslationResponse", Response Status: OK, Payload: "{\n  \"id\": \"chatcmpl-85aiYlvH3eoQfBfCAx2A89joMOVT6\",\n  \"object\": \"chat.completion\",\n  \"created\": 1696343474,\n  \"model\": \"gpt-4-0613\",\n  \"choices\": [\n    {\n      \"index\": 0,\n      \"message\": {\n        \"role\": \"assistant\",\n        \"content\": \"然而,如果这些撕裂不予治疗,可能会导致持续的疼痛和加速的软骨退化。\\nEXPLN: 这句话的主要含义是,如果这些撕裂(往往指肌腱或韧带等损伤)不进行治疗,可能会导致持续的疼痛和软骨退化的加速。\\\"然而\\\"是转折词,表示对前面的内容进行对比或转折。\\\"如果这些撕裂不予治疗\\\"是一个条件状语从句,描述的是一个假设的情况。\\\"可能会导致持续的疼痛和加速的软骨退化\\\"是主句,描述的是如果不进行治疗可能会发生的后果。\"\n      },\n      \"finish_reason\": \"stop\"\n    }\n  ],\n  \"usage\": {\n    \"prompt_tokens\": 56,\n    \"completion_tokens\": 236,\n    \"total_tokens\": 292\n  }\n}"

  • Hi , I'm wondering if this is an issue related to the time it takes to complete a roundtrip communicating with the OpenAI API when using the gpt-4 model, which is also v. slow from my system.  It would also help if you can provide the log file, so that I can interpret the actions that occur after the response.

    1. Is the same problem occurring if you select the model gpt-3.5-turbo? 
    2. Can you please provide me with the log file?  possibly upload it to dropbox, onedrive etc... and share the download link with me: phartnett@rws.com
  • Thanks so much for all your help! I think the issue might have been with my language settings. I’ve set it to support UTF-8 now and it seems like the garbled text is gone. Thanks again!