prompt brackets issue

#4
by googcheng - opened

[INST] <>You are a helpful assistant<>how to parse data [{device_name:1654308465760251904,product_id:3N7I5CXSHW}] with cJSON in C [/INST] To parse data in C using cJSON, you can use the cjson function to parse a JSON string and retrieve the values of interest.

Here's an example of how you can parse the provided JSON data:

#include <stdio.h>
#include <string.h>
#include <cjson/cJSON.h>

int main() {
    char json_data[] = "{\"device_name\":\"1654308465760251904\",\"product_id\":\"3N7I5CXSHW\"}";
    cJSON *json;
    cJSON *device_name;
    cJSON *product_id;

    // Parse the JSON data
    json = cJSON_Parse(json_data);
    if (!json) {
        printf("Failed to parse JSON data\n");
        return 1;
    }

    // Retrieve the values of interest
    device_name = cJSON_GetObjectItem(json, "device_name");
    product_id = cJSON_GetObjectItem(json, "product_id");

    // Print the values
    printf("Device name: %s\n", device_name->valuestring);
    printf("Product ID: %s\n", product_id->valuestring);

    // Clean up
    cJSON_Delete(json);

    return 0;
}

the [] in prompt will be ignored?

googcheng changed discussion title from prompt format issue to prompt brackets issue

Hmm yeah, I'm not sure why this happens exactly. But there may be issues with tokenisation in GGML at the moment. Please see this Github issue for more details: https://github.com/ggerganov/llama.cpp/issues/2310#issue-1816191955

Sign up or log in to comment