Use additional context in LLM prompt, update OpenAI dep#4040
Use additional context in LLM prompt, update OpenAI dep#4040flodolo merged 6 commits intomozilla:mainfrom
Conversation
pontoon/machinery/openai_service.py
Outdated
| f"ENGLISH SOURCE:\n{english_text}\n\n" | ||
| f"MACHINE TRANSLATION TO REFINE:\n{translated_text}" | ||
| ) | ||
| # TODO: remove before merge. |
There was a problem hiding this comment.
This is here to help with testing, needs to be removed before merge.
|
|
||
| class Command(BaseCommand): | ||
| help = "Refines machine translations using OpenAI's GPT-4 API with specified characteristics" | ||
| help = "Refines machine translations using OpenAI's GPT API with specified characteristics" |
There was a problem hiding this comment.
At some point we're going to move away from GPT-4, not sure there is a benefit in having references to GTP-4 in the code.
5a56d9c to
ada5db9
Compare
- Update OpenAI package to latest version (2.29.0) - Improve prompt formulation - Pass string ID, comment, terminology matches when available - Move OpenAI GPT version to settings
ada5db9 to
aa2327a
Compare
mathjazz
left a comment
There was a problem hiding this comment.
Nice work!
Why are we passing all this data from frontend to backend, instead of just passing entity ID and then retrieving all the data from the DB?
The front-end already has all the data. Are we OK with extra queries to do this on the backend? I believe we'd need:
Is this off? |
The frontend already having the data is not a strong reason to make the client the source of truth. Also:
|
|
Makes sense. I'll look into moving this to the back-end (next week at this point). |
fab834f to
cc5f4fc
Compare
mathjazz
left a comment
There was a problem hiding this comment.
Nice job! Deployed to DEV. Works fine!
Left one more note.
pontoon/machinery/openai_service.py
Outdated
| translated_text, | ||
| characteristic, | ||
| locale, | ||
| entity_id=None, |
There was a problem hiding this comment.
No reason, in my head it's always ID 🤷🏼
I'll update and remove the debug print.
Fixes #4030