Skip to content

Commit

Permalink
Use model-integration as provided and specify exported classes in Pla…
Browse files Browse the repository at this point in the history
…tformBundles
  • Loading branch information
lesters committed Apr 16, 2024
1 parent 780bc7c commit 66b57cd
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cloud-tenant-base-dependencies-enforcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion config-model-api/abi-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1862,4 +1862,4 @@
"public final java.lang.String serviceName"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum JarSuffix {

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(
Expand Down Expand Up @@ -88,6 +89,10 @@ public static boolean isSearchAndDocprocClass(String className) {
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(),
Expand Down Expand Up @@ -149,7 +154,11 @@ public static boolean isSearchAndDocprocClass(String className) {
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()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ public static BundleInstantiationSpecification build(Element spec) {
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);

Expand All @@ -47,7 +48,7 @@ private static void validate(BundleInstantiationSpecification instSpec) {
}
}

//null if missing
// null if missing
private static ComponentSpecification getComponentSpecification(Element spec, String attributeName) {
return (spec.hasAttribute(attributeName)) ?
new ComponentSpecification(spec.getAttribute(attributeName)) :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand Down
2 changes: 1 addition & 1 deletion container-dependencies-enforcer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions container-search-and-docproc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</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>
Expand Down

0 comments on commit 66b57cd

Please sign in to comment.