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
[BUG] Streaming AI Service: a NullPointerException when using non-OpenAI APIs #921
Comments
langchain4j
changed the title
[BUG] a NullPointerException
[BUG] Streaming AI Service: a NullPointerException when using non-OpenAI APIs
Apr 11, 2024
This happends with other models as well:
|
langchain4j
added a commit
that referenced
this issue
Apr 15, 2024
6 tasks
langchain4j
added a commit
that referenced
this issue
Apr 16, 2024
…939) ## Context Fixed #921 ## Change When `TokenUsage` is null, do not fail with NPE ## Checklist Before submitting this PR, please check the following points: - [X] I have added unit and integration tests for my change - [X] All unit and integration tests in the module I have added/changed are green - [X] All unit and integration tests in the [core](https://github.com/langchain4j/langchain4j/tree/main/langchain4j-core) and [main](https://github.com/langchain4j/langchain4j/tree/main/langchain4j) modules are green - [ ] I have added/updated the [documentation](https://github.com/langchain4j/langchain4j/tree/main/docs/docs) - [ ] I have added an example in the [examples repo](https://github.com/langchain4j/langchain4j-examples) (only for "big" features) - [ ] I have added my new module in the [BOM](https://github.com/langchain4j/langchain4j/blob/main/langchain4j-bom/pom.xml) (only when a new module is added)
OK,I have updated v0.30 ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
java.lang.NullPointerException
Log and Stack trace
at dev.langchain4j.model.output.TokenUsage.add(TokenUsage.java:88) ~[langchain4j-core-0.29.1.jar:na]
at dev.langchain4j.service.AiServiceStreamingResponseHandler.onComplete(AiServiceStreamingResponseHandler.java:92) ~[langchain4j-0.29.1.jar:na]
at dev.langchain4j.model.openai.OpenAiStreamingChatModel.lambda$generate$1(OpenAiStreamingChatModel.java:166) ~[langchain4j-open-ai-0.29.1.jar:na]
at dev.ai4j.openai4j.StreamingRequestExecutor$2.onEvent(StreamingRequestExecutor.java:170) ~[openai4j-0.17.0.jar:na]
at okhttp3.internal.sse.RealEventSource.onEvent(RealEventSource.kt:101) [okhttp-sse-4.9.3.jar:na]
at okhttp3.internal.sse.ServerSentEventReader.completeEvent(ServerSentEventReader.kt:108) ~[okhttp-sse-4.9.3.jar:na]
at okhttp3.internal.sse.ServerSentEventReader.processNextEvent(ServerSentEventReader.kt:52) ~[okhttp-sse-4.9.3.jar:na]
at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:75) [okhttp-sse-4.9.3.jar:na]
at okhttp3.internal.sse.RealEventSource.onResponse(RealEventSource.kt:46) [okhttp-sse-4.9.3.jar:na]
at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) [okhttp-4.11.0.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_332]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_332]
at java.lang.Thread.run(Thread.java:750) [na:1.8.0_332]
To Reproduce
Expected behavior
fix this bug , or allow custom TokenStream ;
Please complete the following information:
implementation 'org.springframework.boot:spring-boot-starter-web'
Additional context
The text was updated successfully, but these errors were encountered: