humanify icon indicating copy to clipboard operation
humanify copied to clipboard

Unexpected model output

Open xy3xy3 opened this issue 10 months ago • 2 comments

I met some error when using this tool. It seems that the large model does not strictly follow the JSON output, but uses natural language. When I use gpt-4o-mini

Processing file 1/15
Processing file 2/15
Processing: 100%
Processing file 3/15
Processing file 4/15
undefined:1
```javascript
^

SyntaxError: Unexpected token '`', "```javascr"... is not valid JSON
    at JSON.parse (<anonymous>)
    at file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55223:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async visitAllIdentifiers (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55082:21)
    at async file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55210:12     
    at async unminify (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:172:27)
    at async Command.<anonymous> (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55292:3)

Node.js v20.16.0

When I use gpt-4o

Processing file 1/15
Processing file 2/15
Processing: 100%
Processing file 3/15
Processing file 4/15
undefined:1
To give the variable `t` a more descriptive name based on its usage, we need to understand its function in the code. In this snippet, `t` seems to be a function that is invoked with the parameters `this`, `"small"`, `""`, and `""`. It is likely a handler or function that processes these parameters.
^

SyntaxError: Unexpected token 'T', "To give th"... is not valid JSON
    at JSON.parse (<anonymous>)
    at file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55223:30
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async visitAllIdentifiers (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55082:21)
    at async file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55210:12     
    at async unminify (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:172:27)
    at async Command.<anonymous> (file:///C:/Users/12018/AppData/Local/pnpm/global/5/.pnpm/[email protected]/node_modules/humanifyjs/dist/index.mjs:55292:3)

Node.js v20.16.0

xy3xy3 avatar Feb 19 '25 13:02 xy3xy3

It may be caused by the reverse openai interface used by the third-party transit API I use. Now I have changed one, which seems to be normal.

xy3xy3 avatar Feb 19 '25 13:02 xy3xy3

It may be caused by the reverse openai interface used by the third-party transit API I use

Might make sense. A proxy is fine as long as it supports the json_schema mode output that forces a json specific output, but it might be that yours does not.

jehna avatar Feb 19 '25 13:02 jehna