diff --git a/sail/pom.xml b/sail/pom.xml index ad2defbc2..234cd794b 100644 --- a/sail/pom.xml +++ b/sail/pom.xml @@ -61,13 +61,14 @@ dev.langchain4j - langchain4j-ollama + langchain4j-core ${langchain4j.version} dev.langchain4j - langchain4j-local-ai + langchain4j-embeddings-all-minilm-l6-v2-q ${langchain4j.version} + test diff --git a/sail/src/main/java/com/msd/gin/halyard/sail/HBaseTripleSource.java b/sail/src/main/java/com/msd/gin/halyard/sail/HBaseTripleSource.java index f5c7deed6..af78c2115 100644 --- a/sail/src/main/java/com/msd/gin/halyard/sail/HBaseTripleSource.java +++ b/sail/src/main/java/com/msd/gin/halyard/sail/HBaseTripleSource.java @@ -111,7 +111,7 @@ public final QueryPreparer newQueryPreparer() { public final T getQueryHelper(Class qhType) { Object qh = queryHelpers.get(qhType); if (qh == null) { - throw new QueryEvaluationException(String.format("%s is not available", qhType.getName())); + throw new QueryEvaluationException(String.format("Query helper %s is not registered", qhType.getName())); } return qhType.cast(qh); } diff --git a/sail/src/test/java/com/msd/gin/halyard/sail/model/embedding/EmbeddingModelQueryHelperProviderTest.java b/sail/src/test/java/com/msd/gin/halyard/sail/model/embedding/EmbeddingModelQueryHelperProviderTest.java index 514cae493..e32bd6e76 100644 --- a/sail/src/test/java/com/msd/gin/halyard/sail/model/embedding/EmbeddingModelQueryHelperProviderTest.java +++ b/sail/src/test/java/com/msd/gin/halyard/sail/model/embedding/EmbeddingModelQueryHelperProviderTest.java @@ -5,16 +5,15 @@ import org.junit.jupiter.api.Test; -import dev.langchain4j.model.localai.LocalAiEmbeddingModel; +import dev.langchain4j.model.embedding.EmbeddingModel; public class EmbeddingModelQueryHelperProviderTest { @Test - public void testLocalAI() throws Exception { + public void testProvider() throws Exception { EmbeddingModelQueryHelperProvider provider = new EmbeddingModelQueryHelperProvider(); Map config = new HashMap<>(); - config.put("model.class", LocalAiEmbeddingModel.class.getName()); - config.put("baseUrl", "http://localhost"); - config.put("modelName", "llama3"); - provider.createQueryHelper(config); + config.put("model.class", dev.langchain4j.model.embedding.onnx.allminilml6v2q.AllMiniLmL6V2QuantizedEmbeddingModel.class.getName()); + EmbeddingModel model = provider.createQueryHelper(config); + model.embed("foobar"); } } diff --git a/sdk/pom.xml b/sdk/pom.xml index cda28bb40..28c865688 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -1,5 +1,7 @@ - + 4.0.0 halyard-sdk pom @@ -28,21 +30,22 @@ - - org.eclipse.rdf4j - rdf4j-console - ${rdf4j.version} - + + + org.eclipse.rdf4j + rdf4j-console + ${rdf4j.version} + org.eclipse.rdf4j rdf4j-spin - - ch.qos.logback - logback-classic - - - + + ch.qos.logback + logback-classic + + + org.slf4j @@ -87,15 +90,23 @@ process-classes - + - - + + - + - + diff --git a/tools/pom.xml b/tools/pom.xml index d32a9a016..800270d9b 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -86,6 +86,23 @@ 3.1 runtime + + + dev.langchain4j + langchain4j-embeddings-all-minilm-l6-v2-q + ${langchain4j.version} + + + dev.langchain4j + langchain4j-ollama + ${langchain4j.version} + + + dev.langchain4j + langchain4j-local-ai + ${langchain4j.version} + + ${project.groupId} halyard-common diff --git a/tools/src/main/java/com/msd/gin/halyard/tools/AbstractHalyardTool.java b/tools/src/main/java/com/msd/gin/halyard/tools/AbstractHalyardTool.java index 457990ba9..5767ec43b 100644 --- a/tools/src/main/java/com/msd/gin/halyard/tools/AbstractHalyardTool.java +++ b/tools/src/main/java/com/msd/gin/halyard/tools/AbstractHalyardTool.java @@ -22,6 +22,7 @@ import com.msd.gin.halyard.common.KeyspaceConnection; import com.msd.gin.halyard.common.RDFFactory; import com.msd.gin.halyard.common.StatementIndices; +import com.msd.gin.halyard.rio.HRDFParser; import com.msd.gin.halyard.util.Version; import java.io.IOException; @@ -51,6 +52,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.TableName; +import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.hbase.mapreduce.TableMapper; import org.apache.hadoop.hbase.regionserver.BloomType; import org.apache.hadoop.hbase.tool.BulkLoadHFiles; @@ -64,9 +66,18 @@ import org.eclipse.rdf4j.query.BindingSet; import org.eclipse.rdf4j.query.algebra.evaluation.QueryBindingSet; import org.eclipse.rdf4j.rio.helpers.NTriplesUtil; +import org.eclipse.rdf4j.rio.nquads.NQuadsParserFactory; +import org.eclipse.rdf4j.rio.ntriples.NTriplesParserFactory; +import org.eclipse.rdf4j.rio.rdfjson.RDFJSONParserFactory; +import org.eclipse.rdf4j.rio.rdfxml.RDFXMLParserFactory; +import org.eclipse.rdf4j.rio.trig.TriGParserFactory; +import org.eclipse.rdf4j.rio.trix.TriXParserFactory; +import org.eclipse.rdf4j.rio.turtle.TurtleParserFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.langchain4j.model.embedding.EmbeddingModel; + /** * * @author Adam Sotona (MSD) @@ -276,11 +287,36 @@ protected final List