cequence-io / openai-scala-client

Scala client for OpenAI API
MIT License
191 stars 20 forks source link

Can't get top_logprobs to work with anything else than Some(1) as value #54

Closed antonio-veezoo closed 6 months ago

antonio-veezoo commented 7 months ago

When setting top_logprobs higher than Some(1) I get a parsing issue from the response.

I'm using the init below for CreateChatCompletionSettings, it works just fine with top_logprobs = Some(1) or top_logprobs = None. Any idea of what might be the issue? Running version 1.0.0.RC.1

Thanks for any help!

CreateChatCompletionSettings(
          model = completionModel,
          logprobs = Some(true),
          top_logprobs = Some(2)
        )
    at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)
    at scala.util.Failure.recover(Try.scala:234)
    at scala.concurrent.Future.$anonfun$recover$1(Future.scala:395)
    at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
    at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
    at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:63)
    at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:100)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:85)
    at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:100)
    at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:49)
    at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: io.cequence.openaiscala.OpenAIScalaClientException: Error thrown while processing a JSON '{
  "id" : "chatcmpl-9CnQkPTm2p2NALgEJhLCiMgq1xA5s",
  "object" : "chat.completion",
  "created" : 1712836974,
  "model" : "ft:gpt-3.5-turbo-1106:veezoo:2024-03-08-b:91031Lw7",
  "choices" : [ {
    "index" : 0,
    "message" : {
      "role" : "assistant",
      "content" : "\nvar posts: kb.Posts\nvar commentsCount = posts.Comments_Count\nvar createdDate = posts.Created_At\ndate_in(createdDate, date(\"2020\"))\nvar posts2: kb.Posts = top(5, posts, commentsCount)\nselect(posts2, commentsCount, createdDate)"
    },
    "logprobs" : {
      "content" : [ {
        "token" : "\n",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\r\n",
          "logprob" : -16.147455,
          "bytes" : [ 13, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : 0,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : 0,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : " var",
          "logprob" : -20.700026,
          "bytes" : [ 32, 118, 97, 114 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -9.0883464E-7,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -9.0883464E-7,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " Posts",
          "logprob" : -14.891788,
          "bytes" : [ 32, 80, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : ":",
        "logprob" : -0.014350008,
        "bytes" : [ 58 ],
        "top_logprobs" : [ {
          "token" : ":",
          "logprob" : -0.014350008,
          "bytes" : [ 58 ]
        }, {
          "token" : "2",
          "logprob" : -4.2529936,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " kb",
        "logprob" : 0,
        "bytes" : [ 32, 107, 98 ],
        "top_logprobs" : [ {
          "token" : " kb",
          "logprob" : 0,
          "bytes" : [ 32, 107, 98 ]
        }, {
          "token" : " ",
          "logprob" : -18.633654,
          "bytes" : [ 32 ]
        } ]
      }, {
        "token" : ".Post",
        "logprob" : 0,
        "bytes" : [ 46, 80, 111, 115, 116 ],
        "top_logprobs" : [ {
          "token" : ".Post",
          "logprob" : 0,
          "bytes" : [ 46, 80, 111, 115, 116 ]
        }, {
          "token" : ".",
          "logprob" : -17.619019,
          "bytes" : [ 46 ]
        } ]
      }, {
        "token" : "s",
        "logprob" : -0.000001147242,
        "bytes" : [ 115 ],
        "top_logprobs" : [ {
          "token" : "s",
          "logprob" : -0.000001147242,
          "bytes" : [ 115 ]
        }, {
          "token" : "\n",
          "logprob" : -14.159575,
          "bytes" : [ 10 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -1.9361265E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -1.9361265E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\n\n",
          "logprob" : -16.430397,
          "bytes" : [ 10, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.6360221,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.6360221,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "date",
          "logprob" : -0.75415564,
          "bytes" : [ 100, 97, 116, 101 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.1471244,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.1471244,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -2.120267,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -0.0000054385737,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -0.0000054385737,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : " =",
          "logprob" : -12.332743,
          "bytes" : [ 32, 61 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000055623317,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000055623317,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : "2",
          "logprob" : -9.825792,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.00001867018,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.00001867018,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " sum",
          "logprob" : -11.29122,
          "bytes" : [ 32, 115, 117, 109 ]
        } ]
      }, {
        "token" : ".Com",
        "logprob" : -0.00007088138,
        "bytes" : [ 46, 67, 111, 109 ],
        "top_logprobs" : [ {
          "token" : ".Com",
          "logprob" : -0.00007088138,
          "bytes" : [ 46, 67, 111, 109 ]
        }, {
          "token" : ".V",
          "logprob" : -10.323801,
          "bytes" : [ 46, 86 ]
        } ]
      }, {
        "token" : "ments",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : "ments",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 109, 101, 110, 116, 115 ]
        }, {
          "token" : "mits",
          "logprob" : -15.498211,
          "bytes" : [ 109, 105, 116, 115 ]
        } ]
      }, {
        "token" : "_Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 95, 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "_Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 95, 67, 111, 117, 110, 116 ]
        }, {
          "token" : "_C",
          "logprob" : -16.500587,
          "bytes" : [ 95, 67 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : " \n",
          "logprob" : -16.700268,
          "bytes" : [ 32, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.17760774,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.17760774,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "date",
          "logprob" : -1.8198102,
          "bytes" : [ 100, 97, 116, 101 ]
        } ]
      }, {
        "token" : " created",
        "logprob" : -0.6464282,
        "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : " created",
          "logprob" : -0.6464282,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : " featured",
          "logprob" : -0.7630931,
          "bytes" : [ 32, 102, 101, 97, 116, 117, 114, 101, 100 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : -0.48778638,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : -0.48778638,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "at",
          "logprob" : -1.6523448,
          "bytes" : [ 97, 116 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000037981175,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000037981175,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : ":",
          "logprob" : -10.378033,
          "bytes" : [ 58 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.000006749814,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.000006749814,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " comments",
          "logprob" : -12.456477,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        } ]
      }, {
        "token" : ".Created",
        "logprob" : -0.003415936,
        "bytes" : [ 46, 67, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : ".Created",
          "logprob" : -0.003415936,
          "bytes" : [ 46, 67, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : ".Feature",
          "logprob" : -5.691717,
          "bytes" : [ 46, 70, 101, 97, 116, 117, 114, 101 ]
        } ]
      }, {
        "token" : "_At",
        "logprob" : -0.000044894987,
        "bytes" : [ 95, 65, 116 ],
        "top_logprobs" : [ {
          "token" : "_At",
          "logprob" : -0.000044894987,
          "bytes" : [ 95, 65, 116 ]
        }, {
          "token" : "_Date",
          "logprob" : -10.066714,
          "bytes" : [ 95, 68, 97, 116, 101 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -4.3202E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -4.3202E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\n\n",
          "logprob" : -15.096754,
          "bytes" : [ 10, 10 ]
        } ]
      }, {
        "token" : "date",
        "logprob" : -0.00035739198,
        "bytes" : [ 100, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "date",
          "logprob" : -0.00035739198,
          "bytes" : [ 100, 97, 116, 101 ]
        }, {
          "token" : "top",
          "logprob" : -8.090163,
          "bytes" : [ 116, 111, 112 ]
        } ]
      }, {
        "token" : "_in",
        "logprob" : -0.0000037697225,
        "bytes" : [ 95, 105, 110 ],
        "top_logprobs" : [ {
          "token" : "_in",
          "logprob" : -0.0000037697225,
          "bytes" : [ 95, 105, 110 ]
        }, {
          "token" : "(\"",
          "logprob" : -12.53977,
          "bytes" : [ 40, 34 ]
        } ]
      }, {
        "token" : "(created",
        "logprob" : -0.000039054008,
        "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : "(created",
          "logprob" : -0.000039054008,
          "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : "(",
          "logprob" : -10.811795,
          "bytes" : [ 40 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : 0,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : 0,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "At",
          "logprob" : -18.957987,
          "bytes" : [ 65, 116 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : 0,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : 0,
          "bytes" : [ 44 ]
        }, {
          "token" : "<|end|>",
          "logprob" : -17.942543,
          "bytes" : null
        } ]
      }, {
        "token" : " date",
        "logprob" : -0.000013306016,
        "bytes" : [ 32, 100, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : " date",
          "logprob" : -0.000013306016,
          "bytes" : [ 32, 100, 97, 116, 101 ]
        }, {
          "token" : " dynamic",
          "logprob" : -11.833565,
          "bytes" : [ 32, 100, 121, 110, 97, 109, 105, 99 ]
        } ]
      }, {
        "token" : "(\"",
        "logprob" : -0.00006086828,
        "bytes" : [ 40, 34 ],
        "top_logprobs" : [ {
          "token" : "(\"",
          "logprob" : -0.00006086828,
          "bytes" : [ 40, 34 ]
        }, {
          "token" : "(\"#",
          "logprob" : -9.809294,
          "bytes" : [ 40, 34, 35 ]
        } ]
      }, {
        "token" : "202",
        "logprob" : -0.000056815352,
        "bytes" : [ 50, 48, 50 ],
        "top_logprobs" : [ {
          "token" : "202",
          "logprob" : -0.000056815352,
          "bytes" : [ 50, 48, 50 ]
        }, {
          "token" : "this",
          "logprob" : -10.227154,
          "bytes" : [ 116, 104, 105, 115 ]
        } ]
      }, {
        "token" : "0",
        "logprob" : -0.000016524515,
        "bytes" : [ 48 ],
        "top_logprobs" : [ {
          "token" : "0",
          "logprob" : -0.000016524515,
          "bytes" : [ 48 ]
        }, {
          "token" : "1",
          "logprob" : -11.2979,
          "bytes" : [ 49 ]
        } ]
      }, {
        "token" : "\"))\n",
        "logprob" : -0.000010087517,
        "bytes" : [ 34, 41, 41, 10 ],
        "top_logprobs" : [ {
          "token" : "\"))\n",
          "logprob" : -0.000010087517,
          "bytes" : [ 34, 41, 41, 10 ]
        }, {
          "token" : "\"))",
          "logprob" : -11.887898,
          "bytes" : [ 34, 41, 41 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.000001147242,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.000001147242,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "posts",
          "logprob" : -14.104598,
          "bytes" : [ 112, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.0000032929079,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.0000032929079,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " top",
          "logprob" : -14.160865,
          "bytes" : [ 32, 116, 111, 112 ]
        } ]
      }, {
        "token" : "2",
        "logprob" : -0.000008299462,
        "bytes" : [ 50 ],
        "top_logprobs" : [ {
          "token" : "2",
          "logprob" : -0.000008299462,
          "bytes" : [ 50 ]
        }, {
          "token" : "3",
          "logprob" : -11.836551,
          "bytes" : [ 51 ]
        } ]
      }, {
        "token" : ":",
        "logprob" : 0,
        "bytes" : [ 58 ],
        "top_logprobs" : [ {
          "token" : ":",
          "logprob" : 0,
          "bytes" : [ 58 ]
        }, {
          "token" : " =",
          "logprob" : -17.05417,
          "bytes" : [ 32, 61 ]
        } ]
      }, {
        "token" : " kb",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 32, 107, 98 ],
        "top_logprobs" : [ {
          "token" : " kb",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 32, 107, 98 ]
        }, {
          "token" : "kb",
          "logprob" : -16.423883,
          "bytes" : [ 107, 98 ]
        } ]
      }, {
        "token" : ".Post",
        "logprob" : -0.000004365741,
        "bytes" : [ 46, 80, 111, 115, 116 ],
        "top_logprobs" : [ {
          "token" : ".Post",
          "logprob" : -0.000004365741,
          "bytes" : [ 46, 80, 111, 115, 116 ]
        }, {
          "token" : ".Top",
          "logprob" : -12.827346,
          "bytes" : [ 46, 84, 111, 112 ]
        } ]
      }, {
        "token" : "s",
        "logprob" : -0.000004604148,
        "bytes" : [ 115 ],
        "top_logprobs" : [ {
          "token" : "s",
          "logprob" : -0.000004604148,
          "bytes" : [ 115 ]
        }, {
          "token" : "_Text",
          "logprob" : -13.248609,
          "bytes" : [ 95, 84, 101, 120, 116 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000007703444,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000007703444,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : "\n",
          "logprob" : -11.931782,
          "bytes" : [ 10 ]
        } ]
      }, {
        "token" : " top",
        "logprob" : -4.3202E-7,
        "bytes" : [ 32, 116, 111, 112 ],
        "top_logprobs" : [ {
          "token" : " top",
          "logprob" : -4.3202E-7,
          "bytes" : [ 32, 116, 111, 112 ]
        }, {
          "token" : " last",
          "logprob" : -15.284983,
          "bytes" : [ 32, 108, 97, 115, 116 ]
        } ]
      }, {
        "token" : "(",
        "logprob" : 0,
        "bytes" : [ 40 ],
        "top_logprobs" : [ {
          "token" : "(",
          "logprob" : 0,
          "bytes" : [ 40 ]
        }, {
          "token" : " (",
          "logprob" : -18.596891,
          "bytes" : [ 32, 40 ]
        } ]
      }, {
        "token" : "5",
        "logprob" : -0.000015928495,
        "bytes" : [ 53 ],
        "top_logprobs" : [ {
          "token" : "5",
          "logprob" : -0.000015928495,
          "bytes" : [ 53 ]
        }, {
          "token" : "10",
          "logprob" : -11.754298,
          "bytes" : [ 49, 48 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : 0,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : 0,
          "bytes" : [ 44 ]
        }, {
          "token" : " ,",
          "logprob" : -21.244328,
          "bytes" : [ 32, 44 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.000010325924,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.000010325924,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : "posts",
          "logprob" : -12.279683,
          "bytes" : [ 112, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -4.3202E-7,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -4.3202E-7,
          "bytes" : [ 44 ]
        }, {
          "token" : "2",
          "logprob" : -14.919138,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.000015213274,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.000015213274,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -11.589474,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : "Counts",
          "logprob" : -16.396397,
          "bytes" : [ 67, 111, 117, 110, 116, 115 ]
        } ]
      }, {
        "token" : ")\n",
        "logprob" : -0.000011398757,
        "bytes" : [ 41, 10 ],
        "top_logprobs" : [ {
          "token" : ")\n",
          "logprob" : -0.000011398757,
          "bytes" : [ 41, 10 ]
        }, {
          "token" : ",",
          "logprob" : -11.702631,
          "bytes" : [ 44 ]
        } ]
      }, {
        "token" : "select",
        "logprob" : -0.00009829823,
        "bytes" : [ 115, 101, 108, 101, 99, 116 ],
        "top_logprobs" : [ {
          "token" : "select",
          "logprob" : -0.00009829823,
          "bytes" : [ 115, 101, 108, 101, 99, 116 ]
        }, {
          "token" : "var",
          "logprob" : -9.268296,
          "bytes" : [ 118, 97, 114 ]
        } ]
      }, {
        "token" : "(posts",
        "logprob" : -0.015471344,
        "bytes" : [ 40, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : "(posts",
          "logprob" : -0.015471344,
          "bytes" : [ 40, 112, 111, 115, 116, 115 ]
        }, {
          "token" : "(created",
          "logprob" : -4.4029245,
          "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "2",
        "logprob" : -0.000031186566,
        "bytes" : [ 50 ],
        "top_logprobs" : [ {
          "token" : "2",
          "logprob" : -0.000031186566,
          "bytes" : [ 50 ]
        }, {
          "token" : ",",
          "logprob" : -10.409997,
          "bytes" : [ 44 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 44 ]
        }, {
          "token" : ")",
          "logprob" : -15.440119,
          "bytes" : [ 41 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.5384392,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.5384392,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -0.8778481,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : "C",
          "logprob" : -16.357834,
          "bytes" : [ 67 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -0.00060378783,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -0.00060378783,
          "bytes" : [ 44 ]
        }, {
          "token" : ")",
          "logprob" : -7.413224,
          "bytes" : [ 41 ]
        } ]
      }, {
        "token" : " created",
        "logprob" : -0.0000019816675,
        "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : " created",
          "logprob" : -0.0000019816675,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : "created",
          "logprob" : -13.686159,
          "bytes" : [ 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : 0,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : 0,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "Dat",
          "logprob" : -19.755175,
          "bytes" : [ 68, 97, 116 ]
        } ]
      }, {
        "token" : ")",
        "logprob" : -0.00017386234,
        "bytes" : [ 41 ],
        "top_logprobs" : [ {
          "token" : ")",
          "logprob" : -0.00017386234,
          "bytes" : [ 41 ]
        }, {
          "token" : ")\n",
          "logprob" : -8.665922,
          "bytes" : [ 41, 10 ]
        } ]
      } ]
    },
    "finish_reason" : "stop"
  } ],
  "usage" : {
    "prompt_tokens" : 1121,
    "completion_tokens" : 62,
    "total_tokens" : 1183
  },
  "system_fingerprint" : "fp_811d5fcad5"
}'. Cause: Unexpected JSON:
'{
  "id" : "chatcmpl-9CnQkPTm2p2NALgEJhLCiMgq1xA5s",
  "object" : "chat.completion",
  "created" : 1712836974,
  "model" : "ft:gpt-3.5-turbo-1106:veezoo:2024-03-08-b:91031Lw7",
  "choices" : [ {
    "index" : 0,
    "message" : {
      "role" : "assistant",
      "content" : "\nvar posts: kb.Posts\nvar commentsCount = posts.Comments_Count\nvar createdDate = posts.Created_At\ndate_in(createdDate, date(\"2020\"))\nvar posts2: kb.Posts = top(5, posts, commentsCount)\nselect(posts2, commentsCount, createdDate)"
    },
    "logprobs" : {
      "content" : [ {
        "token" : "\n",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\r\n",
          "logprob" : -16.147455,
          "bytes" : [ 13, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : 0,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : 0,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : " var",
          "logprob" : -20.700026,
          "bytes" : [ 32, 118, 97, 114 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -9.0883464E-7,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -9.0883464E-7,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " Posts",
          "logprob" : -14.891788,
          "bytes" : [ 32, 80, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : ":",
        "logprob" : -0.014350008,
        "bytes" : [ 58 ],
        "top_logprobs" : [ {
          "token" : ":",
          "logprob" : -0.014350008,
          "bytes" : [ 58 ]
        }, {
          "token" : "2",
          "logprob" : -4.2529936,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " kb",
        "logprob" : 0,
        "bytes" : [ 32, 107, 98 ],
        "top_logprobs" : [ {
          "token" : " kb",
          "logprob" : 0,
          "bytes" : [ 32, 107, 98 ]
        }, {
          "token" : " ",
          "logprob" : -18.633654,
          "bytes" : [ 32 ]
        } ]
      }, {
        "token" : ".Post",
        "logprob" : 0,
        "bytes" : [ 46, 80, 111, 115, 116 ],
        "top_logprobs" : [ {
          "token" : ".Post",
          "logprob" : 0,
          "bytes" : [ 46, 80, 111, 115, 116 ]
        }, {
          "token" : ".",
          "logprob" : -17.619019,
          "bytes" : [ 46 ]
        } ]
      }, {
        "token" : "s",
        "logprob" : -0.000001147242,
        "bytes" : [ 115 ],
        "top_logprobs" : [ {
          "token" : "s",
          "logprob" : -0.000001147242,
          "bytes" : [ 115 ]
        }, {
          "token" : "\n",
          "logprob" : -14.159575,
          "bytes" : [ 10 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -1.9361265E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -1.9361265E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\n\n",
          "logprob" : -16.430397,
          "bytes" : [ 10, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.6360221,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.6360221,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "date",
          "logprob" : -0.75415564,
          "bytes" : [ 100, 97, 116, 101 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.1471244,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.1471244,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -2.120267,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -0.0000054385737,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -0.0000054385737,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : " =",
          "logprob" : -12.332743,
          "bytes" : [ 32, 61 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000055623317,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000055623317,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : "2",
          "logprob" : -9.825792,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.00001867018,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.00001867018,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " sum",
          "logprob" : -11.29122,
          "bytes" : [ 32, 115, 117, 109 ]
        } ]
      }, {
        "token" : ".Com",
        "logprob" : -0.00007088138,
        "bytes" : [ 46, 67, 111, 109 ],
        "top_logprobs" : [ {
          "token" : ".Com",
          "logprob" : -0.00007088138,
          "bytes" : [ 46, 67, 111, 109 ]
        }, {
          "token" : ".V",
          "logprob" : -10.323801,
          "bytes" : [ 46, 86 ]
        } ]
      }, {
        "token" : "ments",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : "ments",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 109, 101, 110, 116, 115 ]
        }, {
          "token" : "mits",
          "logprob" : -15.498211,
          "bytes" : [ 109, 105, 116, 115 ]
        } ]
      }, {
        "token" : "_Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 95, 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "_Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 95, 67, 111, 117, 110, 116 ]
        }, {
          "token" : "_C",
          "logprob" : -16.500587,
          "bytes" : [ 95, 67 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : " \n",
          "logprob" : -16.700268,
          "bytes" : [ 32, 10 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.17760774,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.17760774,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "date",
          "logprob" : -1.8198102,
          "bytes" : [ 100, 97, 116, 101 ]
        } ]
      }, {
        "token" : " created",
        "logprob" : -0.6464282,
        "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : " created",
          "logprob" : -0.6464282,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : " featured",
          "logprob" : -0.7630931,
          "bytes" : [ 32, 102, 101, 97, 116, 117, 114, 101, 100 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : -0.48778638,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : -0.48778638,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "at",
          "logprob" : -1.6523448,
          "bytes" : [ 97, 116 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000037981175,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000037981175,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : ":",
          "logprob" : -10.378033,
          "bytes" : [ 58 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.000006749814,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.000006749814,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " comments",
          "logprob" : -12.456477,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        } ]
      }, {
        "token" : ".Created",
        "logprob" : -0.003415936,
        "bytes" : [ 46, 67, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : ".Created",
          "logprob" : -0.003415936,
          "bytes" : [ 46, 67, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : ".Feature",
          "logprob" : -5.691717,
          "bytes" : [ 46, 70, 101, 97, 116, 117, 114, 101 ]
        } ]
      }, {
        "token" : "_At",
        "logprob" : -0.000044894987,
        "bytes" : [ 95, 65, 116 ],
        "top_logprobs" : [ {
          "token" : "_At",
          "logprob" : -0.000044894987,
          "bytes" : [ 95, 65, 116 ]
        }, {
          "token" : "_Date",
          "logprob" : -10.066714,
          "bytes" : [ 95, 68, 97, 116, 101 ]
        } ]
      }, {
        "token" : "\n",
        "logprob" : -4.3202E-7,
        "bytes" : [ 10 ],
        "top_logprobs" : [ {
          "token" : "\n",
          "logprob" : -4.3202E-7,
          "bytes" : [ 10 ]
        }, {
          "token" : "\n\n",
          "logprob" : -15.096754,
          "bytes" : [ 10, 10 ]
        } ]
      }, {
        "token" : "date",
        "logprob" : -0.00035739198,
        "bytes" : [ 100, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "date",
          "logprob" : -0.00035739198,
          "bytes" : [ 100, 97, 116, 101 ]
        }, {
          "token" : "top",
          "logprob" : -8.090163,
          "bytes" : [ 116, 111, 112 ]
        } ]
      }, {
        "token" : "_in",
        "logprob" : -0.0000037697225,
        "bytes" : [ 95, 105, 110 ],
        "top_logprobs" : [ {
          "token" : "_in",
          "logprob" : -0.0000037697225,
          "bytes" : [ 95, 105, 110 ]
        }, {
          "token" : "(\"",
          "logprob" : -12.53977,
          "bytes" : [ 40, 34 ]
        } ]
      }, {
        "token" : "(created",
        "logprob" : -0.000039054008,
        "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : "(created",
          "logprob" : -0.000039054008,
          "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : "(",
          "logprob" : -10.811795,
          "bytes" : [ 40 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : 0,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : 0,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "At",
          "logprob" : -18.957987,
          "bytes" : [ 65, 116 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : 0,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : 0,
          "bytes" : [ 44 ]
        }, {
          "token" : "<|end|>",
          "logprob" : -17.942543,
          "bytes" : null
        } ]
      }, {
        "token" : " date",
        "logprob" : -0.000013306016,
        "bytes" : [ 32, 100, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : " date",
          "logprob" : -0.000013306016,
          "bytes" : [ 32, 100, 97, 116, 101 ]
        }, {
          "token" : " dynamic",
          "logprob" : -11.833565,
          "bytes" : [ 32, 100, 121, 110, 97, 109, 105, 99 ]
        } ]
      }, {
        "token" : "(\"",
        "logprob" : -0.00006086828,
        "bytes" : [ 40, 34 ],
        "top_logprobs" : [ {
          "token" : "(\"",
          "logprob" : -0.00006086828,
          "bytes" : [ 40, 34 ]
        }, {
          "token" : "(\"#",
          "logprob" : -9.809294,
          "bytes" : [ 40, 34, 35 ]
        } ]
      }, {
        "token" : "202",
        "logprob" : -0.000056815352,
        "bytes" : [ 50, 48, 50 ],
        "top_logprobs" : [ {
          "token" : "202",
          "logprob" : -0.000056815352,
          "bytes" : [ 50, 48, 50 ]
        }, {
          "token" : "this",
          "logprob" : -10.227154,
          "bytes" : [ 116, 104, 105, 115 ]
        } ]
      }, {
        "token" : "0",
        "logprob" : -0.000016524515,
        "bytes" : [ 48 ],
        "top_logprobs" : [ {
          "token" : "0",
          "logprob" : -0.000016524515,
          "bytes" : [ 48 ]
        }, {
          "token" : "1",
          "logprob" : -11.2979,
          "bytes" : [ 49 ]
        } ]
      }, {
        "token" : "\"))\n",
        "logprob" : -0.000010087517,
        "bytes" : [ 34, 41, 41, 10 ],
        "top_logprobs" : [ {
          "token" : "\"))\n",
          "logprob" : -0.000010087517,
          "bytes" : [ 34, 41, 41, 10 ]
        }, {
          "token" : "\"))",
          "logprob" : -11.887898,
          "bytes" : [ 34, 41, 41 ]
        } ]
      }, {
        "token" : "var",
        "logprob" : -0.000001147242,
        "bytes" : [ 118, 97, 114 ],
        "top_logprobs" : [ {
          "token" : "var",
          "logprob" : -0.000001147242,
          "bytes" : [ 118, 97, 114 ]
        }, {
          "token" : "posts",
          "logprob" : -14.104598,
          "bytes" : [ 112, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.0000032929079,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.0000032929079,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : " top",
          "logprob" : -14.160865,
          "bytes" : [ 32, 116, 111, 112 ]
        } ]
      }, {
        "token" : "2",
        "logprob" : -0.000008299462,
        "bytes" : [ 50 ],
        "top_logprobs" : [ {
          "token" : "2",
          "logprob" : -0.000008299462,
          "bytes" : [ 50 ]
        }, {
          "token" : "3",
          "logprob" : -11.836551,
          "bytes" : [ 51 ]
        } ]
      }, {
        "token" : ":",
        "logprob" : 0,
        "bytes" : [ 58 ],
        "top_logprobs" : [ {
          "token" : ":",
          "logprob" : 0,
          "bytes" : [ 58 ]
        }, {
          "token" : " =",
          "logprob" : -17.05417,
          "bytes" : [ 32, 61 ]
        } ]
      }, {
        "token" : " kb",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 32, 107, 98 ],
        "top_logprobs" : [ {
          "token" : " kb",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 32, 107, 98 ]
        }, {
          "token" : "kb",
          "logprob" : -16.423883,
          "bytes" : [ 107, 98 ]
        } ]
      }, {
        "token" : ".Post",
        "logprob" : -0.000004365741,
        "bytes" : [ 46, 80, 111, 115, 116 ],
        "top_logprobs" : [ {
          "token" : ".Post",
          "logprob" : -0.000004365741,
          "bytes" : [ 46, 80, 111, 115, 116 ]
        }, {
          "token" : ".Top",
          "logprob" : -12.827346,
          "bytes" : [ 46, 84, 111, 112 ]
        } ]
      }, {
        "token" : "s",
        "logprob" : -0.000004604148,
        "bytes" : [ 115 ],
        "top_logprobs" : [ {
          "token" : "s",
          "logprob" : -0.000004604148,
          "bytes" : [ 115 ]
        }, {
          "token" : "_Text",
          "logprob" : -13.248609,
          "bytes" : [ 95, 84, 101, 120, 116 ]
        } ]
      }, {
        "token" : " =",
        "logprob" : -0.000007703444,
        "bytes" : [ 32, 61 ],
        "top_logprobs" : [ {
          "token" : " =",
          "logprob" : -0.000007703444,
          "bytes" : [ 32, 61 ]
        }, {
          "token" : "\n",
          "logprob" : -11.931782,
          "bytes" : [ 10 ]
        } ]
      }, {
        "token" : " top",
        "logprob" : -4.3202E-7,
        "bytes" : [ 32, 116, 111, 112 ],
        "top_logprobs" : [ {
          "token" : " top",
          "logprob" : -4.3202E-7,
          "bytes" : [ 32, 116, 111, 112 ]
        }, {
          "token" : " last",
          "logprob" : -15.284983,
          "bytes" : [ 32, 108, 97, 115, 116 ]
        } ]
      }, {
        "token" : "(",
        "logprob" : 0,
        "bytes" : [ 40 ],
        "top_logprobs" : [ {
          "token" : "(",
          "logprob" : 0,
          "bytes" : [ 40 ]
        }, {
          "token" : " (",
          "logprob" : -18.596891,
          "bytes" : [ 32, 40 ]
        } ]
      }, {
        "token" : "5",
        "logprob" : -0.000015928495,
        "bytes" : [ 53 ],
        "top_logprobs" : [ {
          "token" : "5",
          "logprob" : -0.000015928495,
          "bytes" : [ 53 ]
        }, {
          "token" : "10",
          "logprob" : -11.754298,
          "bytes" : [ 49, 48 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : 0,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : 0,
          "bytes" : [ 44 ]
        }, {
          "token" : " ,",
          "logprob" : -21.244328,
          "bytes" : [ 32, 44 ]
        } ]
      }, {
        "token" : " posts",
        "logprob" : -0.000010325924,
        "bytes" : [ 32, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " posts",
          "logprob" : -0.000010325924,
          "bytes" : [ 32, 112, 111, 115, 116, 115 ]
        }, {
          "token" : "posts",
          "logprob" : -12.279683,
          "bytes" : [ 112, 111, 115, 116, 115 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -4.3202E-7,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -4.3202E-7,
          "bytes" : [ 44 ]
        }, {
          "token" : "2",
          "logprob" : -14.919138,
          "bytes" : [ 50 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.000015213274,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.000015213274,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -11.589474,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : "Counts",
          "logprob" : -16.396397,
          "bytes" : [ 67, 111, 117, 110, 116, 115 ]
        } ]
      }, {
        "token" : ")\n",
        "logprob" : -0.000011398757,
        "bytes" : [ 41, 10 ],
        "top_logprobs" : [ {
          "token" : ")\n",
          "logprob" : -0.000011398757,
          "bytes" : [ 41, 10 ]
        }, {
          "token" : ",",
          "logprob" : -11.702631,
          "bytes" : [ 44 ]
        } ]
      }, {
        "token" : "select",
        "logprob" : -0.00009829823,
        "bytes" : [ 115, 101, 108, 101, 99, 116 ],
        "top_logprobs" : [ {
          "token" : "select",
          "logprob" : -0.00009829823,
          "bytes" : [ 115, 101, 108, 101, 99, 116 ]
        }, {
          "token" : "var",
          "logprob" : -9.268296,
          "bytes" : [ 118, 97, 114 ]
        } ]
      }, {
        "token" : "(posts",
        "logprob" : -0.015471344,
        "bytes" : [ 40, 112, 111, 115, 116, 115 ],
        "top_logprobs" : [ {
          "token" : "(posts",
          "logprob" : -0.015471344,
          "bytes" : [ 40, 112, 111, 115, 116, 115 ]
        }, {
          "token" : "(created",
          "logprob" : -4.4029245,
          "bytes" : [ 40, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "2",
        "logprob" : -0.000031186566,
        "bytes" : [ 50 ],
        "top_logprobs" : [ {
          "token" : "2",
          "logprob" : -0.000031186566,
          "bytes" : [ 50 ]
        }, {
          "token" : ",",
          "logprob" : -10.409997,
          "bytes" : [ 44 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 44 ]
        }, {
          "token" : ")",
          "logprob" : -15.440119,
          "bytes" : [ 41 ]
        } ]
      }, {
        "token" : " comments",
        "logprob" : -0.5384392,
        "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ],
        "top_logprobs" : [ {
          "token" : " comments",
          "logprob" : -0.5384392,
          "bytes" : [ 32, 99, 111, 109, 109, 101, 110, 116, 115 ]
        }, {
          "token" : " created",
          "logprob" : -0.8778481,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Count",
        "logprob" : -3.1281633E-7,
        "bytes" : [ 67, 111, 117, 110, 116 ],
        "top_logprobs" : [ {
          "token" : "Count",
          "logprob" : -3.1281633E-7,
          "bytes" : [ 67, 111, 117, 110, 116 ]
        }, {
          "token" : "C",
          "logprob" : -16.357834,
          "bytes" : [ 67 ]
        } ]
      }, {
        "token" : ",",
        "logprob" : -0.00060378783,
        "bytes" : [ 44 ],
        "top_logprobs" : [ {
          "token" : ",",
          "logprob" : -0.00060378783,
          "bytes" : [ 44 ]
        }, {
          "token" : ")",
          "logprob" : -7.413224,
          "bytes" : [ 41 ]
        } ]
      }, {
        "token" : " created",
        "logprob" : -0.0000019816675,
        "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ],
        "top_logprobs" : [ {
          "token" : " created",
          "logprob" : -0.0000019816675,
          "bytes" : [ 32, 99, 114, 101, 97, 116, 101, 100 ]
        }, {
          "token" : "created",
          "logprob" : -13.686159,
          "bytes" : [ 99, 114, 101, 97, 116, 101, 100 ]
        } ]
      }, {
        "token" : "Date",
        "logprob" : 0,
        "bytes" : [ 68, 97, 116, 101 ],
        "top_logprobs" : [ {
          "token" : "Date",
          "logprob" : 0,
          "bytes" : [ 68, 97, 116, 101 ]
        }, {
          "token" : "Dat",
          "logprob" : -19.755175,
          "bytes" : [ 68, 97, 116 ]
        } ]
      }, {
        "token" : ")",
        "logprob" : -0.00017386234,
        "bytes" : [ 41 ],
        "top_logprobs" : [ {
          "token" : ")",
          "logprob" : -0.00017386234,
          "bytes" : [ 41 ]
        }, {
          "token" : ")\n",
          "logprob" : -8.665922,
          "bytes" : [ 41, 10 ]
        } ]
      } ]
    },
    "finish_reason" : "stop"
  } ],
  "usage" : {
    "prompt_tokens" : 1121,
    "completion_tokens" : 62,
    "total_tokens" : 1183
  },
  "system_fingerprint" : "fp_811d5fcad5"
}'. Cannot be parsed due to: JSON at path '/choices(0)/logprobs/content(29)/top_logprobs(1)/bytes' contains the following errors: error.expected.jsarray
    at io.cequence.openaiscala.JsonUtil$JsonOps.asSafe(JsonUtil.scala:30)
    at io.cequence.openaiscala.service.OpenAICoreServiceImpl.$anonfun$createChatCompletion$1(OpenAICoreServiceImpl.scala:108)
    at scala.util.Success.$anonfun$map$1(Try.scala:255)
    at scala.util.Success.map(Try.scala:213)
    at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
    ... 15 more
antonio-veezoo commented 7 months ago

This is a fine-tuned model with very very high top probabilities (even 1.0, which seems strange), idk if OpenAI sends all top_logprobs in all cases, the comment at line 96 of ChatCompletionResponse.scala suggests otherwise, so my issue might be related to this.

antonio-veezoo commented 7 months ago

Increasing temperature helps so I think my high probabilities are the issue here. Still strange that the format of the answer would change in that case, and that the library does not handle that.

peterbanda commented 6 months ago

Hi @antonio-veezoo , Thanks for reporting! Seems like a corner case - "bytes" : null for "token" : "<|end|>". Will fix

antonio-veezoo commented 6 months ago

Thanks for the quick fix! Do you have a timeline for when this would land on maven or alternatives for how to use a version with the fix right away?