I’ve encountered an issue with the Chat API Tools where the “translated” property is correctly added to each value of chunks, but the Korean translation of “content” does not appear as expected.
For example, according to the system message specifications, each chunk should include a “translated” property with the Korean direct reading of “content”. An example provided demonstrates how this should be structured.
However, when submitting a user message through the tools, specifically targeting the translation of sentence chunks into Korean, the translated values are missing. The “translated” property is present but the value is empty, which contradicts the expected behavior.
Notably, when using the GPT-3.5-turbo model, the translated values are returned as expected. The issue arises specifically with GPT-4 related models, where the translated data is returned as an empty string (“”).
Could you provide insight into why this discrepancy occurs with GPT-4 models and how it can be resolved to ensure Korean translation values are correctly returned?
- System Message
Add the "translated" property to each value of chunks and enter the Korean direct reading of "content" as the value.
ex)
{
"sentence_type": "ComplexSentence",
"clauses": [
{
"content": "When I thought about it,",
"clause_type": "DependentClause",
"index": 1,
"chunks": [
{
"content": "When I thought about it,",
"chunk_type": "SentenceModifier",
"index": 1,
"translated": "그것에 대해 생각했을 때,"
}
],
},
{
"content": "I had a happy dream.",
"clause_type": "MainClause",
"index": 2,
"chunks": [
{
"content": "I",
"chunk_type": "Subject",
"index": 1,
"translated": "나는"
},
{
"content": "had",
"chunk_type": "Verb",
"index": 2,
"translated": "가지고 있었다"
},
{
"content": "a dream",
"chunk_type": "Object",
"index": 3,
"translated": "꿈을"
},
{
"content": "happy",
"chunk_type": "ObjectModifier",
"index": 4,
"translated": "행복한"
}
],
}
]
}
- User Message
{
"sentence_type": "SimpleSentence",
"clauses": [
{
"clause_type": "MainClause",
"content": "I have been a bird-watcher since childhood.",
"index": 1,
"chunks": [
{
"content": "I",
"chunk_type": "Subject",
"index": 1
},
{
"content": "have been a bird-watcher",
"chunk_type": "Verb",
"index": 2
},
{
"content": "since childhood",
"chunk_type": "VerbModifier",
"index": 3
}
]
}
]
}
- Tools code
response = self.client.chat.completions.create(
model=request.model or self.model,
messages=[
{"role": "system", "content": request.system_message},
{"role": "user", "content": request.user_message}
],
temperature=0.0,
tool_choice="auto",
tools=[
{
"type": "function",
"function": {
"name": "translate_sentence_chunk",
"parameters": {
"type": "object",
"properties": {
"chunks": {
"type": "object",
"properties": {
"content": {
"type": "string",
},
"chunk_type": {
"type": "string",
"enum": [
"Subject",
"SubjectModifier",
"Verb",
"VerbModifier",
"Object",
"ObjectModifier",
"Object",
"ObjectModifier",
"Complement",
"ComplementModifier",
"Conjunction",
"SentenceModifier"
]
},
"index": {
"type": "number",
},
"translated": {
"type": "string",
},
},
"required": ["content", "chunk_type", "index", "translated"],
},
},
"required": ["chunks"],
},
},
}
]
)