diff --git a/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithChroma.java b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithChroma.java index b886641a1..7d7cd863a 100644 --- a/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithChroma.java +++ b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithChroma.java @@ -9,8 +9,8 @@ import dev.langchain4j.data.document.Document; import dev.langchain4j.model.embedding.EmbeddingModel; -import dev.langchain4j.store.embedding.EmbeddingStore; import dev.langchain4j.store.embedding.EmbeddingStoreIngestor; +import io.quarkiverse.langchain4j.chroma.ChromaEmbeddingStore; @ApplicationScoped public class IngestorExampleWithChroma { @@ -20,7 +20,7 @@ public class IngestorExampleWithChroma { * The bean is provided by the quarkus-langchain4j-chroma extension. */ @Inject - EmbeddingStore store; + ChromaEmbeddingStore store; /** * The embedding model (how is computed the vector of a document). diff --git a/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithPinecone.java b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithPinecone.java new file mode 100644 index 000000000..01d2be286 --- /dev/null +++ b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithPinecone.java @@ -0,0 +1,41 @@ +package io.quarkiverse.langchain4j.samples; + +import static dev.langchain4j.data.document.splitter.DocumentSplitters.recursive; + +import java.util.List; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +import dev.langchain4j.data.document.Document; +import dev.langchain4j.model.embedding.EmbeddingModel; +import dev.langchain4j.store.embedding.EmbeddingStoreIngestor; +import io.quarkiverse.langchain4j.pinecone.PineconeEmbeddingStore; + +@ApplicationScoped +public class IngestorExampleWithPinecone { + + /** + * The embedding store (the database). + * The bean is provided by the quarkus-langchain4j-pinecone extension. + */ + @Inject + PineconeEmbeddingStore store; + + /** + * The embedding model (how is computed the vector of a document). + * The bean is provided by the LLM (like openai) extension. + */ + @Inject + EmbeddingModel embeddingModel; + + public void ingest(List documents) { + EmbeddingStoreIngestor ingestor = EmbeddingStoreIngestor.builder() + .embeddingStore(store) + .embeddingModel(embeddingModel) + .documentSplitter(recursive(500, 0)) + .build(); + // Warning - this can take a long time... + ingestor.ingest(documents); + } +} diff --git a/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExample.java b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithRedis.java similarity index 89% rename from docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExample.java rename to docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithRedis.java index f792de497..a7da80f28 100644 --- a/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExample.java +++ b/docs/modules/ROOT/examples/io/quarkiverse/langchain4j/samples/IngestorExampleWithRedis.java @@ -9,18 +9,18 @@ import dev.langchain4j.data.document.Document; import dev.langchain4j.model.embedding.EmbeddingModel; -import dev.langchain4j.store.embedding.EmbeddingStore; import dev.langchain4j.store.embedding.EmbeddingStoreIngestor; +import io.quarkiverse.langchain4j.redis.RedisEmbeddingStore; @ApplicationScoped -public class IngestorExample { +public class IngestorExampleWithRedis { /** * The embedding store (the database). * The bean is provided by the quarkus-langchain4j-redis extension. */ @Inject - EmbeddingStore store; + RedisEmbeddingStore store; /** * The embedding model (how is computed the vector of a document). diff --git a/docs/modules/ROOT/pages/pinecone-store.adoc b/docs/modules/ROOT/pages/pinecone-store.adoc index 33aa24759..a536f362b 100644 --- a/docs/modules/ROOT/pages/pinecone-store.adoc +++ b/docs/modules/ROOT/pages/pinecone-store.adoc @@ -16,6 +16,20 @@ To make use of the Pinecone document store, you'll need to include the following ---- +The required configuration properties to make the extension work are +`quarkus.langchain4j.pinecone.api-key`, +`quarkus.langchain4j.pinecone.environment`, +`quarkus.langchain4j.pinecone.index-name`, and +`quarkus.langchain4j.pinecone.project-id`. The specified index will be +created if it doesn't exist yet. + +Upon installing the extension, you can utilize the Pinecone embedding store using the following code: + +[source,java] +---- +include::{examples-dir}/io/quarkiverse/langchain4j/samples/IngestorExampleWithPinecone.java[] +---- + == Configuration Settings Customize the behavior of the extension by exploring various configuration options: diff --git a/docs/modules/ROOT/pages/redis-store.adoc b/docs/modules/ROOT/pages/redis-store.adoc index 04f989624..4b7765535 100644 --- a/docs/modules/ROOT/pages/redis-store.adoc +++ b/docs/modules/ROOT/pages/redis-store.adoc @@ -28,7 +28,7 @@ Upon installing the extension, you can utilize the Redis document store using th [source,java] ---- -include::{examples-dir}/io/quarkiverse/langchain4j/samples/IngestorExample.java[] +include::{examples-dir}/io/quarkiverse/langchain4j/samples/IngestorExampleWithRedis.java[] ---- == Configuration Settings diff --git a/docs/modules/ROOT/pages/retrievers.adoc b/docs/modules/ROOT/pages/retrievers.adoc index 74897fe60..0ed4a67ee 100644 --- a/docs/modules/ROOT/pages/retrievers.adoc +++ b/docs/modules/ROOT/pages/retrievers.adoc @@ -48,7 +48,7 @@ The following code demonstrates document ingestion in a Redis database: [source,java] ---- -include::{examples-dir}/io/quarkiverse/langchain4j/samples/IngestorExample.java[] +include::{examples-dir}/io/quarkiverse/langchain4j/samples/IngestorExampleWithRedis.java[] ---- Adjust the `documentSplitter` parameter based on the data structure. diff --git a/docs/pom.xml b/docs/pom.xml index c9f6debda..37057df83 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -23,26 +23,26 @@ quarkus-langchain4j-openai ${project.version} - - - - - + + io.quarkiverse.langchain4j + quarkus-langchain4j-hugging-face + ${project.version} + io.quarkiverse.langchain4j quarkus-langchain4j-redis ${project.version} - - - - - - - - - - + + io.quarkiverse.langchain4j + quarkus-langchain4j-chroma + ${project.version} + + + io.quarkiverse.langchain4j + quarkus-langchain4j-pinecone + ${project.version} + @@ -55,21 +55,21 @@ quarkus-langchain4j-redis-deployment ${project.version} - - - - - - - - - - - - - - - + + io.quarkiverse.langchain4j + quarkus-langchain4j-chroma-deployment + ${project.version} + + + io.quarkiverse.langchain4j + quarkus-langchain4j-pinecone-deployment + ${project.version} + + + io.quarkiverse.langchain4j + quarkus-langchain4j-hugging-face-deployment + ${project.version} + diff --git a/docs/src/main/resources/application.properties b/docs/src/main/resources/application.properties index e2275a79f..b4a8a0fbc 100644 --- a/docs/src/main/resources/application.properties +++ b/docs/src/main/resources/application.properties @@ -3,4 +3,6 @@ quarkus.langchain4j.redis.dimension=180 quarkus.langchain4j.pinecone.environment=abc quarkus.langchain4j.pinecone.index-name=abc quarkus.langchain4j.pinecone.project-id=abc -quarkus.langchain4j.pinecone.api-key=abc \ No newline at end of file +quarkus.langchain4j.pinecone.api-key=abc +quarkus.langchain4j.chat-model.provider=openai +quarkus.langchain4j.embedding-model.provider=openai \ No newline at end of file