Details
-
Task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
4.7.0
-
None
-
Unknown
Description
Camel JBang is unable to load langchain4j embeddings
[main][~/code/java/camel-jbang-explain]$ jbang -Dcamel.jbang.version=4.7.0-SNAPSHOT camel@apache/camel explain whatis --model-name=granite-code:8b --system-prompt="You are a coding assistant specialized in Apache Camel" "How can I enable manual commits for the Kafka component?" Exception in thread "main" java.lang.ExceptionInInitializerError at org.apache.camel.jbang.ai.WhatIsCommand.doCall(WhatIsCommand.java:63) at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:71) at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:37) at picocli.CommandLine.executeUserObject(CommandLine.java:2045) at picocli.CommandLine.access$1500(CommandLine.java:148) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465) at picocli.CommandLine$RunLast.handle(CommandLine.java:2457) at picocli.CommandLine$RunLast.handle(CommandLine.java:2419) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277) at picocli.CommandLine$RunLast.execute(CommandLine.java:2421) at picocli.CommandLine.execute(CommandLine.java:2174) at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:167) at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:61) at main.CamelJBang.main(CamelJBang.java:36) Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "java.io.InputStream.read(byte[], int, int)" because "inputStream" is null at dev.langchain4j.model.embedding.OnnxBertBiEncoder.<init>(OnnxBertBiEncoder.java:42) at dev.langchain4j.model.embedding.AbstractInProcessEmbeddingModel.loadFromJar(AbstractInProcessEmbeddingModel.java:22) at dev.langchain4j.model.embedding.AllMiniLmL6V2EmbeddingModel.<clinit>(AllMiniLmL6V2EmbeddingModel.java:18) ... 14 more Caused by: java.lang.NullPointerException: Cannot invoke "java.io.InputStream.read(byte[], int, int)" because "inputStream" is null at dev.langchain4j.model.embedding.OnnxBertBiEncoder.loadModel(OnnxBertBiEncoder.java:229) at dev.langchain4j.model.embedding.OnnxBertBiEncoder.<init>(OnnxBertBiEncoder.java:37) ... 16 more
This can be triggered by something such as:
@Override public Integer doCall() throws Exception { EmbeddingModel embeddingModel = new AllMiniLmL6V2EmbeddingModel(); }