-
Notifications
You must be signed in to change notification settings - Fork 193
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
Error when creating an OpenAI object #248
Comments
Something is wrong; you are using |
I had an issue like this in my JetBrains plugin. I switched to OpenAI(
OpenAIConfig(
token = "token",
engine = JavaHttpEngine(JavaHttpConfig())
)
) |
Thanks! Where can I exactly find JavaHttpEngine and JavaHttpConfig? What should I include? Edit: it worked when using |
@notAnElephant : Did you find a solution? Facing the same issue in a jetbrains plugin project |
@mwesox I did not. I ended up using https://github.com/arvarik/openai-kotlin instead. That didn't work either out of the box, but using its source code directly, I was able to make things work |
Description
The following line always fails, despite being provided the dependencies in build.gradle.kts
val openAI = OpenAI("my-api-key")
Steps to Reproduce
dependencies { implementation(platform("com.aallam.openai:openai-client-bom:3.5.0")) implementation("com.aallam.openai:openai-client") implementation("io.ktor:ktor-client-okhttp") }
Environment
Additional Info
The error message and call stack:
java.util.ServiceConfigurationError: io.ktor.client.HttpClientEngineContainer: io.ktor.client.engine.cio.CIOEngineContainer not a subtype at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244) at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273) at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309) at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393) at kotlin.collections.CollectionsKt___CollectionsKt.toCollection(_Collections.kt:1295) at kotlin.collections.CollectionsKt___CollectionsKt.toMutableList(_Collections.kt:1328) at kotlin.collections.CollectionsKt___CollectionsKt.toList(_Collections.kt:1319) at io.ktor.client.HttpClientJvmKt.<clinit>(HttpClientJvm.kt:39) at com.aallam.openai.client.internal.HttpClientKt.createHttpClient(HttpClient.kt:24) at com.aallam.openai.client.OpenAIKt.OpenAI(OpenAI.kt:61) at com.aallam.openai.client.OpenAIKt.OpenAI(OpenAI.kt:41) at com.aallam.openai.client.OpenAIKt.OpenAI$default(OpenAI.kt:31) at myplugin.MyClass.actionPerformed(XYAction.kt:39)
It is a jetbrains IDE plugin, if that matters.
The text was updated successfully, but these errors were encountered: