diff options
author | Lester Solbakken <lester.solbakken@gmail.com> | 2024-04-16 13:45:04 +0200 |
---|---|---|
committer | Lester Solbakken <lester.solbakken@gmail.com> | 2024-04-16 13:45:04 +0200 |
commit | 66b57cd4feba406e4b8f6821c88d914ac5a5cec1 (patch) | |
tree | 1591db2472ca8a6763805c37b797d9f35e8c2f39 | |
parent | 780bc7cbe8fb67ae712fcf278f8900c8f32e14a6 (diff) |
Use model-integration as provided and specify exported classes in PlatformBundles
7 files changed, 25 insertions, 8 deletions
diff --git a/cloud-tenant-base-dependencies-enforcer/pom.xml b/cloud-tenant-base-dependencies-enforcer/pom.xml index 6d6ac4a81e7..98bef7df402 100644 --- a/cloud-tenant-base-dependencies-enforcer/pom.xml +++ b/cloud-tenant-base-dependencies-enforcer/pom.xml @@ -97,7 +97,6 @@ <include>com.yahoo.vespa:messagebus:*:provided</include> <include>com.yahoo.vespa:metrics:*:provided</include> <include>com.yahoo.vespa:model-evaluation:*:provided</include> - <include>com.yahoo.vespa:model-integration:*:provided</include> <include>com.yahoo.vespa:opennlp-linguistics:*:provided</include> <include>com.yahoo.vespa:predicate-search-core:*:provided</include> <include>com.yahoo.vespa:provided-dependencies:*:provided</include> @@ -123,6 +122,7 @@ <include>com.yahoo.vespa:indexinglanguage:*:test</include> <include>com.yahoo.vespa:logd:*:test</include> <include>com.yahoo.vespa:metrics-proxy:*:test</include> + <include>com.yahoo.vespa:model-integration:*:test</include> <include>com.yahoo.vespa:searchsummary:*:test</include> <include>com.yahoo.vespa:standalone-container:*:test</include> <include>com.yahoo.vespa:storage:*:test</include> diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index c416a5e3a0b..42e7e23dfcc 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -1862,4 +1862,4 @@ "public final java.lang.String serviceName" ] } -} +}
\ No newline at end of file diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/PlatformBundles.java b/config-model/src/main/java/com/yahoo/vespa/model/container/PlatformBundles.java index e801884a73a..468cf8dd961 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/PlatformBundles.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/PlatformBundles.java @@ -38,6 +38,7 @@ public class PlatformBundles { public static final Path LIBRARY_PATH = Paths.get(Defaults.getDefaults().underVespaHome("lib/jars")); public static final String SEARCH_AND_DOCPROC_BUNDLE = BundleInstantiationSpecification.CONTAINER_SEARCH_AND_DOCPROC; + public static final String MODEL_INTEGRATION_BUNDLE = BundleInstantiationSpecification.MODEL_INTEGRATION; // Bundles that must be loaded for all container types. public static final Set<Path> COMMON_VESPA_BUNDLES = toBundlePaths( @@ -88,6 +89,10 @@ public class PlatformBundles { return searchAndDocprocComponents.contains(className); } + public static boolean isModelIntegrationClass(String className) { + return modelIntegrationComponents.contains(className); + } + // This is a hack to allow users to declare components from the search-and-docproc bundle without naming the bundle. private static final Set<String> searchAndDocprocComponents = Set.of( com.yahoo.docproc.AbstractConcreteDocumentFactory.class.getName(), @@ -149,7 +154,11 @@ public class PlatformBundles { com.yahoo.vespa.streamingvisitors.MetricsSearcher.class.getName(), com.yahoo.vespa.streamingvisitors.StreamingBackend.class.getName(), ai.vespa.search.llm.LLMSearcher.class.getName(), - ai.vespa.search.llm.RAGSearcher.class.getName(), + ai.vespa.search.llm.RAGSearcher.class.getName() + ); + + // This is a hack to allow users to declare components from the model-integration bundle without naming the bundle. + private static final Set<String> modelIntegrationComponents = Set.of( ai.vespa.llm.clients.OpenAI.class.getName(), ai.vespa.llm.clients.LocalLLM.class.getName() ); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java index 7e14eafc2ee..1323506eaeb 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/BundleInstantiationSpecificationBuilder.java @@ -26,17 +26,18 @@ public class BundleInstantiationSpecificationBuilder { BundleInstantiationSpecification instSpec = new BundleInstantiationSpecification(id, classId, bundle); validate(instSpec); - return bundle == null ? setBundleForSearchAndDocprocComponents(instSpec) : instSpec; + return bundle == null ? setBundleForComponent(instSpec) : instSpec; } - private static BundleInstantiationSpecification setBundleForSearchAndDocprocComponents(BundleInstantiationSpecification spec) { + private static BundleInstantiationSpecification setBundleForComponent(BundleInstantiationSpecification spec) { if (PlatformBundles.isSearchAndDocprocClass(spec.getClassName())) return spec.inBundle(PlatformBundles.SEARCH_AND_DOCPROC_BUNDLE); + else if (PlatformBundles.isModelIntegrationClass(spec.getClassName())) + return spec.inBundle(PlatformBundles.MODEL_INTEGRATION_BUNDLE); else return spec; } - private static void validate(BundleInstantiationSpecification instSpec) { List<String> forbiddenClasses = List.of(SearchHandler.HANDLER_CLASSNAME, PROCESSING_HANDLER_CLASS); @@ -47,7 +48,7 @@ public class BundleInstantiationSpecificationBuilder { } } - //null if missing + // null if missing private static ComponentSpecification getComponentSpecification(Element spec, String attributeName) { return (spec.hasAttribute(attributeName)) ? new ComponentSpecification(spec.getAttribute(attributeName)) : diff --git a/container-core/src/main/java/com/yahoo/container/bundle/BundleInstantiationSpecification.java b/container-core/src/main/java/com/yahoo/container/bundle/BundleInstantiationSpecification.java index bd35d257813..b49f519906f 100644 --- a/container-core/src/main/java/com/yahoo/container/bundle/BundleInstantiationSpecification.java +++ b/container-core/src/main/java/com/yahoo/container/bundle/BundleInstantiationSpecification.java @@ -15,6 +15,7 @@ import com.yahoo.component.ComponentSpecification; public final class BundleInstantiationSpecification { public static final String CONTAINER_SEARCH_AND_DOCPROC = "container-search-and-docproc"; + public static final String MODEL_INTEGRATION = "model-integration"; public final ComponentId id; public final ComponentSpecification classId; diff --git a/container-dependencies-enforcer/pom.xml b/container-dependencies-enforcer/pom.xml index 6451e32941c..cbe8b4b6d24 100644 --- a/container-dependencies-enforcer/pom.xml +++ b/container-dependencies-enforcer/pom.xml @@ -116,7 +116,6 @@ <include>com.yahoo.vespa:messagebus:*:provided</include> <include>com.yahoo.vespa:metrics:*:provided</include> <include>com.yahoo.vespa:model-evaluation:*:provided</include> - <include>com.yahoo.vespa:model-integration:*:provided</include> <include>com.yahoo.vespa:opennlp-linguistics:*:provided</include> <include>com.yahoo.vespa:predicate-search-core:*:provided</include> <include>com.yahoo.vespa:provided-dependencies:*:provided</include> @@ -140,6 +139,7 @@ <include>com.yahoo.vespa:indexinglanguage:*:test</include> <include>com.yahoo.vespa:logd:*:test</include> <include>com.yahoo.vespa:metrics-proxy:*:test</include> + <include>com.yahoo.vespa:model-integration:*:test</include> <include>com.yahoo.vespa:searchsummary:*:test</include> <include>com.yahoo.vespa:standalone-container:*:test</include> <include>com.yahoo.vespa:storage:*:test</include> diff --git a/container-search-and-docproc/pom.xml b/container-search-and-docproc/pom.xml index ee74b86dbec..0aa1627f33e 100644 --- a/container-search-and-docproc/pom.xml +++ b/container-search-and-docproc/pom.xml @@ -228,6 +228,12 @@ </dependency> <dependency> <groupId>com.yahoo.vespa</groupId> + <artifactId>model-integration</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>com.yahoo.vespa</groupId> <artifactId>container-llama</artifactId> <version>${project.version}</version> <scope>provided</scope> |