Skip to content

Commit

Permalink
Merge pull request #73 from jmartisk/inject-generic-embedding-store
Browse files Browse the repository at this point in the history
Allow injecting EmbeddingStore<TextSegment> with the type parameter
  • Loading branch information
geoand authored Nov 28, 2023
2 parents 8fd0e71 + 44c0ec9 commit f0b0ddd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import jakarta.enterprise.context.ApplicationScoped;

import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
import org.jboss.jandex.ParameterizedType;

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingStore;
import io.quarkiverse.langchain4j.chroma.ChromaEmbeddingStore;
import io.quarkiverse.langchain4j.chroma.runtime.ChromaConfig;
Expand Down Expand Up @@ -34,7 +37,8 @@ public void createBean(
ChromaConfig config) {
beanProducer.produce(SyntheticBeanBuildItem
.configure(CHROMA_EMBEDDING_STORE)
.types(EmbeddingStore.class)
.types(ClassType.create(EmbeddingStore.class),
ParameterizedType.create(EmbeddingStore.class, ClassType.create(TextSegment.class)))
.defaultBean()
.setRuntimeInit()
.defaultBean()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

import org.jboss.jandex.ClassType;
import org.jboss.jandex.DotName;
import org.jboss.jandex.ParameterizedType;

import dev.langchain4j.data.segment.TextSegment;
import dev.langchain4j.store.embedding.EmbeddingStore;
import io.quarkiverse.langchain4j.redis.runtime.RedisEmbeddingStoreConfig;
import io.quarkiverse.langchain4j.redis.runtime.RedisEmbeddingStoreRecorder;
Expand Down Expand Up @@ -42,7 +44,8 @@ public void createBean(
RedisEmbeddingStoreConfig config) {
beanProducer.produce(SyntheticBeanBuildItem
.configure(REDIS_EMBEDDING_STORE)
.types(EmbeddingStore.class)
.types(ClassType.create(EmbeddingStore.class),
ParameterizedType.create(EmbeddingStore.class, ClassType.create(TextSegment.class)))
.setRuntimeInit()
.defaultBean()
.scope(ApplicationScoped.class)
Expand Down

0 comments on commit f0b0ddd

Please sign in to comment.