Add feature to include an "acceptions" list to be added to the prompt #34
Replies: 4 comments
-
@meaghanfitzgerald An idea that just popped into my head is to replace the words you don't want to translate with specific symbols before throwing them into GPT. Then, from the translation results, replace the symbol with the original word. By the way, the prompts can be changed within workflow inputs without having to bother editing the code. |
Beta Was this translation helpful? Give feedback.
-
@3ru Thanks for getting back to me :) The biggest issue with changing the prompt is that it adds more tokens and makes the requests more expensive. Tbh it's not a big issue for gpt3.5-turbo, but is expensive for gpt4. I've tried this already by forking your project, editing the prompt and inserting a text file with the words I'd like to exclude from the translation. For context, I am trying to make a bot that can help me translate all the .md files in this repo's docs folder. This is a fork of my company's developer documentation Docusaurus, which is served at docs.avax.network. This doesn't work super well because both gpt 3.5 and gpt 4 don't respond well to the prompt. I've worded it a million different ways and it'll still translate "Fuji" to "富士" in Japanese no matter how I ask. This might just be a limitation of these LLMs; Might look into other models but would require a rework of this bot that I am already very impressed with. The symbols Idea is definitely not a bad idea: but our dev docs repo is nearly 400,000 words and 150+ files large. To crawl through the entire directory once to convert the symbols, crawl through again to translate, and crawl through a third time to change the symbols back would be pretty computationally expensive, and pretty manual in order to avoid being rate limited. What you've already accomplished here is an immense step forward, and I am extremely appreciative of the open-sourcedness as well as the excellent documentation! |
Beta Was this translation helpful? Give feedback.
-
Did some prompt engineering and found that the following prompt structure works well:
how can I alter the gpt.ts to enable the text to be inserted in the middle of the prompt, like the |
Beta Was this translation helpful? Give feedback.
-
You can achieve this by modifying export const askGPT = async (
text: string,
targetLanguage: string, // changed
): Promise<string> => {
const {
data: {
choices: [{ message: { content: content } = { content: '' } }],
},
} = await openAIApi
.createChatCompletion({
model: MODEL,
messages: [
{
role: ChatCompletionRequestMessageRoleEnum.System,
content: `Use the following step-by-step instructions to respond to user inputs.
Step 1 - The user will provide you with text from a markdown file. Identify any mention of the key words in the following list: ["keyword0", "keywork1", "keywork2", ...]. After that, follow Step 2. Here is the text:
${text}
Step 2 - After the key words have been identified, leave all mentions of those words in English, and translate the text
from Step 1 into ${targetLanguage}`,
},
], |
Beta Was this translation helpful? Give feedback.
-
Goals
Looking for help krafting a prompt that will help better accomplish the above goal.
Non-Goals
Nice to have Make the list editable in the github actions so others don't need to fork the repo and create their own config
Background
I used this tool and loved it already, this is truly the only last feature that would make this perfect.
Proposal
Any advice or willingness to collaborate would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions