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

improve openai inference history storage #209

Merged

Conversation

jairad26
Copy link
Member

@jairad26 jairad26 commented May 30, 2024

sample stored now

{
                "id": "inf-018fca58-4291-75c8-921c-0118edec35ab",
                "modelHash": "46df2e17973a794cca48d0312743c0374ecaf3b1fb80b33c60f2135f676244fb",
                "input": "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"a word that rhymes with food\"}, {\"role\": \"user\", \"content\": \"a word that rhymes with food\"}], \"response_format\": {\"type\": \"text\"}}",
                "output": "{\"error\": {\"code\": \"\", \"type\": \"\", \"param\": \"\", \"message\": \"\"}, \"choices\": [{\"message\": {\"role\": \"assistant\", \"content\": \"mood\"}}]}",
                "startedAt": "2024-05-30T09:32:12.063-07:00",
                "duration": 633
            },
            {
                "id": "inf-018fca58-5626-7280-a6c5-c4c43e7666e5",
                "modelHash": "46df2e17973a794cca48d0312743c0374ecaf3b1fb80b33c60f2135f676244fb",
                "input": "{\"model\": \"gpt-3.5-turbo\", \"messages\": [{\"role\": \"system\", \"content\": \"Only respond with valid JSON object in this format:\\n{\\\"id\\\":\\\"123\\\",\\\"name\\\":\\\"Shoes\\\",\\\"price\\\":50.0,\\\"description\\\":\\\"Great shoes for walking.\\\"}\\nGenerate a product for the category provided.\"}, {\"role\": \"user\", \"content\": \"food\"}], \"response_format\": {\"type\": \"json_object\"}}",
                "output": "{\"error\": {\"code\": \"\", \"type\": \"\", \"param\": \"\", \"message\": \"\"}, \"choices\": [{\"message\": {\"role\": \"assistant\", \"content\": \"{\\\"id\\\":\\\"456\\\",\\\"name\\\":\\\"Banana\\\",\\\"price\\\":0.50,\\\"description\\\":\\\"Fresh and delicious ripe banana.\\\"}\"}}]}",
                "startedAt": "2024-05-30T09:32:12.064-07:00",
                "duration": 1017
            }

Copy link

linear bot commented May 30, 2024

HYP-1271 Inference history output JSON are escaped twice

"{\"Data\":{\"choices\":[{\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"list\\\":[\\n    {\\\"target\\\":\\\"somevalue\\\",\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"EQUALS\\\",\\\"property\\\":\\\"$.test\\\"},\\n    {\\\"target\\\":\\\"success\\\",\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"EQUALS\\\",\\\"property\\\":\\\"$.result\\\"},\\n    {\\\"target\\\":20,\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"EQUALS\\\",\\\"property\\\":\\\"$.score\\\"},\\n    {\\\"target\\\":100,\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"EQUALS\\\",\\\"property\\\":\\\"$.riskLevel\\\"},\\n    {\\\"target\\\":30,\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"GREATER THAN\\\",\\\"property\\\":\\\"$.score\\\"},\\n    {\\\"target\\\":80,\\\"source\\\":\\\"JSON_BODY\\\",\\\"comparison\\\":\\\"LESS THAN\\\",\\\"property\\\":\\\"$.riskLevel\\\"}\\n]}\"}}],\"error\":{\"message\":\"\",\"type\":\"\",\"param\":\"\",\"code\":\"\"}},\"StartTime\":\"2024-05-29T21:25:20.905982971Z\",\"EndTime\":\"2024-05-29T21:25:23.759415349Z\"}"

Should only be escaped once

@jairad26 jairad26 enabled auto-merge (squash) May 30, 2024 16:55
@jairad26 jairad26 merged commit 9c6e935 into main May 30, 2024
4 checks passed
@jairad26 jairad26 deleted the jai/hyp-1271-inference-history-output-json-are-escaped-twice branch May 30, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants