Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPT sometimes makes a response with ```json inside when you ask it to provide a json #3174

Open
kof opened this issue Apr 15, 2024 · 0 comments
Labels
area:ai Everything AI related prio:1 The most important thing to work on type:bug Something isn't working

Comments

@kof
Copy link
Member

kof commented Apr 15, 2024

This doesn't happen every single time, but if you try 2-3 times its likely going to be reproducible with any of the example prompts

Response from /detect route has "json\n[\"generate-template-prompt\"]\n" instead of ["generate-template-prompt"].

We probably will get rid of these problems if we switch to the new JSON Mode

{
    "id": "command-detect",
    "type": "json",
    "success": false,
    "tokens": {
        "prompt": -1,
        "completion": -1
    },
    "data": {
        "status": 500,
        "error": "ai.command-detect.parseError",
        "message": "Unexpected token ` in JSON at position 0",
        "debug": "Failed to parse the completion Unexpected token ` in JSON at position 0"
    },
    "llmMessages": [
        [
            "system",
            "Given a prompt where a user requests you to perform a task, you should determine what's the task type.\n\nAvaliable tasks are provided below as an object with task_name:task_description pairs:\n\n```json\n{\"copywriter\":\"rewrites, rephrases, shortens, increases length or translates text\",\"edit-styles\":\"edits styles\",\"generate-template-prompt\":\"handles a user interface generation request\",\"delete-instance\":\"deletes elements\"}\n```\n\nThe task description can help you infer the task name to pick. For example if the user is asking to translate you should respond with [\"copywrite\"]\n\nRespond with a valid JSON array of task names that are relevant for the user request. Start with [\n"
        ],
        [
            "user",
            "User request:\n\n```\nCreate a hero section with a heading, subheading in white, CTA button and an image of a mountain in the background,  add light blur to the image\n```\n"
        ],
        [
            "assistant",
            "```json\n[\"generate-template-prompt\"]\n```"
        ]
    ]
}
@kof kof added type:bug Something isn't working prio:1 The most important thing to work on area:ai Everything AI related labels Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ai Everything AI related prio:1 The most important thing to work on type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant