Code Monkey home page Code Monkey logo

chatgpt-jvm-api's Introduction

ChatGPT has released official API. This repo is supposed to be archived.

chatgpt-jvm-api's People

Contributors

ohararinney avatar

Stargazers

Eric avatar Gaurav Salvi avatar

Watchers

 avatar

chatgpt-jvm-api's Issues

Getting error 'MissingKotlinParameterException: Instantiation of [simple type, class moe.yiheng.SessionResult] value failed for JSON property user due to missing (therefore NULL) value for creator parameter user which is a non-nullable type'

Hi, Thanks for starting a Kotlin library for ChatGPT.
I tried passing my token and calling the classes in the library as shown below

suspend fun main() {
    val chatGPTAPI = ChatGPTAPI( sessionToken = "== removed ==" )
    val conversation: Conversation = Conversation(chatGPTAPI)
    conversation.sendMessage("What is ChatGpt") { println("Response $it") }
}

But I am getting the below exception :

/Library/Java/JavaVirtualMachines/jdk-17/Contents/Home/bin/java -javaagent:/Users/gauravsalvi/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=50443:/Users/gauravsalvi/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/gauravsalvi/work2/github/chatgpt-jvm-api/build/classes/kotlin/main:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.7.21/5407c3593c58860cec5ee3f66c468396b42f4c2b/kotlin-stdlib-jdk8-1.7.21.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-kotlin/2.14.0/44242eb7fae51ac12447010be7cd5a922f36949/jackson-module-kotlin-2.14.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.14.0/513b8ca3fea0352ceebe4d0bbeea527ab343dc1a/jackson-databind-2.14.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-okhttp-jvm/2.1.3/d45f10d6ab29f54945f02768aed6d18f89f7bfc0/ktor-client-okhttp-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-content-negotiation-jvm/2.1.3/879ae79de9b9956d3df5591a697da765ba55574a/ktor-client-content-negotiation-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-client-core-jvm/2.1.3/180d1278feb8afae83602607ffe311810cfc97e0/ktor-client-core-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-jackson-jvm/2.1.3/83b742c33ef7df27a3a4e1a7939db71e45e1092a/ktor-serialization-jackson-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.7.21/a0ba09615c2213d580315e234b3febfea25b757e/kotlin-stdlib-jdk7-1.7.21.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.7.21/1a2eaf898a0dda83037034b10a42053cf8a7caf8/kotlin-stdlib-1.7.21.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm/1.6.4/2c997cd1c0ef33f3e751d3831929aeff1390cb30/kotlinx-coroutines-core-jvm-1.6.4.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.14.0/fb7afb3c9c8ea363a9c88ea9c0a7177cf2fbd369/jackson-annotations-2.14.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.14.0/49d219171d6af643e061e9e1baaaf6a6a067918d/jackson-core-2.14.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-jdk8/1.6.4/5bc4b0bf6fd90fc190fd2f17e919c74c6274cb71/kotlinx-coroutines-jdk8-1.6.4.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/4.9.3/b0b14b3d12980912723fb8b66afb48dcda742fcb/okhttp-4.9.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.36/6c62681a2f655b49963a5983b8b0950a6120ae14/slf4j-api-1.7.36.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.7.21/cb02257de8e13e8498f8e2f69f742f2d438e794d/kotlin-stdlib-common-1.7.21.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/2.8.0/49b64e09d81c0cc84b267edd0c2fd7df5a64c78c/okio-jvm-2.8.0.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-serialization-jvm/2.1.3/533a5f02109366995f31709c66ffa9142b0494d8/ktor-serialization-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-events-jvm/2.1.3/fe0a8843347f6dbd768b89eb7bd88fd502d40f0b/ktor-events-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-websocket-serialization-jvm/2.1.3/b9039e5649ea2e5f9b310f604b8c4e23ff670e8e/ktor-websocket-serialization-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-http-jvm/2.1.3/db0e297e5b37101af54df5e294cb729dd6cc19a2/ktor-http-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-websockets-jvm/2.1.3/67811306207dac366d792c5b1d0d0c10263a3c5f/ktor-websockets-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-utils-jvm/2.1.3/88d0613187fea03d1b0015b665ceb0b926b4951b/ktor-utils-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/io.ktor/ktor-io-jvm/2.1.3/38646a4965f01113605e2a0ea510f20399a8d20/ktor-io-jvm-2.1.3.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-reflect/1.7.20/12b2501e33bb6373e8e347c86d85481863629381/kotlin-reflect-1.7.20.jar:/Users/gauravsalvi/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-slf4j/1.6.4/9369fcabacb66a55ca3b7939b72bb0b62af112ce/kotlinx-coroutines-slf4j-1.6.4.jar moe.yiheng.DemoKt
Exception in thread "main" io.ktor.serialization.JsonConvertException: Illegal json parameter found
	at io.ktor.serialization.jackson.JacksonConverter.deserialize(JacksonConverter.kt:67)
	at io.ktor.serialization.jackson.JacksonConverter$deserialize$1.invokeSuspend(JacksonConverter.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:283)
	at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith$default(DispatchedContinuation.kt:278)
	at kotlinx.coroutines.DispatchedCoroutine.afterResume(Builders.common.kt:260)
	at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
Caused by: com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException: Instantiation of [simple type, class moe.yiheng.SessionResult] value failed for JSON property user due to missing (therefore NULL) value for creator parameter user which is a non-nullable type
 at [Source: (InputStreamReader); line: 1, column: 2] (through reference chain: moe.yiheng.SessionResult["user"])
	at com.fasterxml.jackson.module.kotlin.KotlinValueInstantiator.createFromObjectWith(KotlinValueInstantiator.kt:84)
	at com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:202)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:519)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1405)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:352)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:185)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3706)
	at io.ktor.serialization.jackson.JacksonConverter$deserialize$2.invokeSuspend(JacksonConverter.kt:64)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	... 7 more

Process finished with exit code 130 (interrupted by signal 2: SIGINT)

Maybe i am doing anything wrong but would be nice to know what went wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.