Heyshell Games Forum

Title: Metadata not deleting - using Node SDK [Print this page]

Author: Stevyamda    Time: 2025-4-7 21:53
Title: Metadata not deleting - using Node SDK
Hello, unsure if anyone else is experiencing this but I’m unable to delete metadata from assistants through the assistants API (using node sdk).
ADDING new metadata and UPDATING metadata still works. However, if I send a map without a existing pair(s), the metadata will not not be updated with the removed pairs. Is this expected behavior? If so, how do we explicitly remove metadata?
CODE

    [color=var(--hljs-variable)]console.[color=var(--hljs-title)]log([color=var(--hljs-string)]'>>>>>>>> metadata object', agentParams.metadata)    [color=var(--hljs-keyword)]const updateParams = {      [color=var(--hljs-attr)]name: agentParams.name,      [color=var(--hljs-attr)]description: agentParams.description,      [color=var(--hljs-attr)]instructions: agentParams.instructions,      [color=var(--hljs-attr)]model: agentParams.model,      [color=var(--hljs-attr)]metadata: agentParams.metadata,    }    [color=var(--hljs-keyword)]const openai = [color=var(--hljs-keyword)]await [color=var(--hljs-title)]getOpenAI(c)    [color=var(--hljs-keyword)]const assistant = [color=var(--hljs-keyword)]await openai.beta.assistants.[color=var(--hljs-title)]update(agentParams.id, updateParams)    [color=var(--hljs-variable)]console.[color=var(--hljs-title)]log([color=var(--hljs-string)]'UPDATE PARAMS', updateParams)
LOGS

>>>>>>>> metadata object Object {                                                                                                                                                                                                                                                                                                                                                                     }                                                                                                                                                                                                  UPDATE PARAMS Object {                                                                                                                                                                               name: English Tutor,                                                                                                                                                                               description: Take care of English stuffs,                                                                                                                                                          instructions: You are a personal english tutor. Write and run code to answer english questions.,  model: gpt-4-1106-preview,  metadata: Object}
What I receive from the backend:

{  [color=var(--hljs-attr)]created_at: [color=var(--hljs-number)]1699777427,  [color=var(--hljs-attr)]description: [color=var(--hljs-string)]"Take care of English stuffs",  [color=var(--hljs-attr)]file_ids: [],  [color=var(--hljs-attr)]id: [color=var(--hljs-string)]"asst_zZ0Td78363rsvRq2Pe7usNB5",  [color=var(--hljs-attr)]instructions: [color=var(--hljs-string)]"You are a personal english tutor. Write and run code to answer english questions.",  [color=var(--hljs-attr)]metadata: {    [color=var(--hljs-attr)]test: [color=var(--hljs-string)]"123123"  },  [color=var(--hljs-attr)]model: [color=var(--hljs-string)]"gpt-4-1106-preview",  [color=var(--hljs-attr)]name: [color=var(--hljs-string)]"English Tutor",  [color=var(--hljs-attr)]object: [color=var(--hljs-string)]"assistant",  [color=var(--hljs-attr)]tools: []}
As you can see, despite sending an empty object (also tried with map), the API still sends me metadata back.
Steps to reproduce:


Author: JasmineHart    Time: 2025-4-7 21:55
If deleting metadata isn't working as expected, it might be worth checking if there's any caching issue or if the metadata is still associated with another object. Also, make sure you're passing the correct parameters in the API call. I've had similar issues when integrating metadata management into a dam workflow, and rechecking the payload structure helped. If you're updating instead of fully deleting, a null value might be needed.




Welcome to Heyshell Games Forum (https://bbs.heyshell.com/) Powered by Discuz! X2.5