Hey everyone, I am planning to building something bigger but before that i created a simple script that explains word from a json file and explains it with the exact object structure I tell him to.
What have I successfully done?
✅ API uploads the file every run.
✅ Creating a thread with file.id as attachment.
✅ Run the thread with the Assistant i've created already.
What i'm struggling with?
❌ Make sure the Assistant will always get the word from the json file and explain that, as a result the API returns an object with random words.
Here's how my Assistant is configured:
- gpt-4o
- File Search
- Code Interpeter
- "Response" function:
{ "name": "response", "description": null, "parameters": { "type": "object", "properties": { "Results": { "type": "array", "items": { "type": "object", "properties": { "word": { "type": "string", "description": "Word title" }, "explanation": { "type": "string", "description": "Short word description" } } } } }, "required": [ "word", "explanation" ] } }
I have to note that once every couple of runs it might detect the word from the JSON file.
Here's how my JSON file looks:
{ "word": "Bottle" }
I have attached my JSON file.
an example response I got:
'Results': [{'word': 'Luminous', 'explanation': 'Luminous means emitting or reflecting light, glowing; illuminating. In a figurative sense, it can be used to describe something that is clear or easy to understand.'}]}