diff --git a/docs/PLUGIN_API_CHANGELOG.md b/docs/PLUGIN_API_CHANGELOG.md index 8de3f3c485..9b79639203 100644 --- a/docs/PLUGIN_API_CHANGELOG.md +++ b/docs/PLUGIN_API_CHANGELOG.md @@ -35,7 +35,38 @@ need a source change, a recompile, or both · `tooling` = API-stability milestone. **[verified]** = read from the checked-in ABI dump. **[reconstructed]** = diffed from `plugin-api/src` history (predates the dump; symbol-accurate). -### 26.36 — unreleased +### 26.40 — unreleased +- **added — An embedding capability a backend can declare** _(ADFA-6053)_ **[verified]** + A backend that has an embedding model can now say so. The only embedding entry point + before this was `LlmInferenceService.getEmbeddings(String, String)`, which addresses a + backend by id and hands back a bare `float[]`: the caller learns neither which model + produced the vector nor how long it is, and pays one round trip per text. Indexing a + project is thousands of chunks, so that is thousands of requests, and a stored vector + carries no provenance — swapping the model behind a backend silently degrades every + vector already on disk instead of invalidating it. + `LlmInferenceService.EmbeddingBackend extends LlmBackend` is an optional capability + interface, like `ToolCallingBackend` and `HistoryCapableBackend`: implement it and the + consumer finds it with `instanceof`, there is no flag to set. It declares + `embed(List)` returning `CompletableFuture>` index-aligned with + the input, `getEmbeddingDimensions()`, and `getEmbeddingModelId()` — the model's + identity, not the backend's, because two models of equal width are mutually + incomparable and a width check alone cannot detect a swap. + The batch either completes whole or fails whole; it never yields a short list, a list + padded with nulls, or a placeholder vector, so a caller can never store a partially-real + batch. `embed` must not block the calling thread and must be safe for concurrent calls + (indexing and a user's query can be in flight at once), and it snapshots the caller's + list before returning, so a caller may reuse or clear its own list as soon as the call + comes back; the caller owns the returned list and arrays outright. It reports every failure by + completing the future exceptionally and throws synchronously only for a caller's own + mistake — `NullPointerException` for a null argument or element, `IllegalArgumentException` + for an empty list. The static `EmbeddingBackend.requireValidBatch(List)` does + those checks and returns the snapshot, so a backend calls it first in `embed`. + Purely additive: a new interface with three new methods and one static helper, nothing + existing changed (the ABI dump diff is seven added lines and no removals), so an already-built `.cgp` keeps + loading and running against the refreshed jar. `getEmbeddings(String, String)` stays — + the Vector-Search plugin is a live caller. Floor `plugin.min_ide_version` at `26.40` if + you implement or consume `EmbeddingBackend`; an older IDE has no such type, and a + consumer's `instanceof` against it there fails to resolve the class. - **added — `SnippetContribution.language` accepts `kotlin`** _(ADFA-6189)_ The host keys Kotlin snippets under `kt`, so a contribution declaring `kotlin` registered under a language nothing looks up and never appeared in a `.kt` file. The id is now @@ -43,6 +74,7 @@ milestone. **[verified]** = read from the checked-in ABI dump. **[reconstructed] Accepted ids are `java`, `kt` (or `kotlin`) and `xml` — anything else registers but is never queried. +### 26.37 — 2026-09-08 - **added — Build provenance in every `.cgp`** _(ADFA-5394)_ **[verified]** A plugin artifact now records the commit it was built from, so a crash report or a support question can be traced back to source. Nothing in the pipeline carried a git @@ -97,6 +129,8 @@ milestone. **[verified]** = read from the checked-in ABI dump. **[reconstructed] either state. Neither can be applied by the IDE on a plugin's behalf: `Window` has no theme attribute for its type, and a toast is posted by the system against whatever context built it. + +### 26.36 — 2026-09-01 - **added — File-targeted editor save** _(ADFA-5259)_ Save a named file's open buffer and find out whether the bytes actually landed. `saveCurrentFile` follows whichever tab the user has focused and returns as soon @@ -382,3 +416,6 @@ Map any commit to the release that first shipped it: ```bash git tag --list --contains | grep -E '^[0-9]{2}\.[0-9]{2}$' | sort -V | head -1 ``` + +When a release is tagged, replace its bucket's `unreleased` with the tag date and move +any entry the tag does not contain up to the next bucket. diff --git a/docs/plugin-api.md b/docs/plugin-api.md index 3824834fb6..cfb2c97a18 100644 --- a/docs/plugin-api.md +++ b/docs/plugin-api.md @@ -12,7 +12,7 @@ The surface a plugin binds to is broader than one module. All of the following a - Core: `IPlugin` (lifecycle), `PluginContext`, `PluginLogger`, `ServiceRegistry`, `ResourceManager`. - Extension interfaces plugins **implement**: `UIExtension`, `EditorExtension`, `EditorTabExtension`, `DocumentationExtension`, `BuildActionExtension`, `SnippetExtension`, `ProjectExtension`, `FileOpenExtension`, `SettingsExtension`. - IDE service interfaces plugins **call** (via `ServiceRegistry.get(X::class.java)`): `IdeProjectService`, `IdeEditorService`, `IdeFileService`, `IdeEnvironmentService`, `IdeArchiveService`, `IdeBuildService`, `IdeUIService`, `IdeEditorTabService`, `IdeTooltipService`, `IdeThemeService`, `IdeFeatureFlagService`, `IdeCommandService`, `IdeTemplateService`, `IdeSnippetService`, `IdeSidebarService`. - - Cross-plugin service interfaces, where **one plugin implements what another calls** (via `SharedServices`): `LlmInferenceService` — implemented by ai-core, called by every AI plugin — together with the types nested in it that a *backend* plugin implements (`LlmBackend`, `HistoryCapableBackend`, `ToolCallingBackend`, `CancellableBackend`, `ConfigurableBackend`) and the value types either side constructs (`ChatMessage`, `LlmConfig`, `LlmResponse`, `SystemPromptRequest`, `ToolDefinition`, `ToolCallRequest`). Also `ToolSourceRegistry` — implemented by ai-core, called by any plugin contributing tools to the agent — with `ToolSource` and `ToolSpec`, which a *contributing* plugin implements, `ToolInvocation`, which ai-core constructs and passes to `ToolSource.invoke`, and `ToolOutcome`, which the source returns. + - Cross-plugin service interfaces, where **one plugin implements what another calls** (via `SharedServices`): `LlmInferenceService` — implemented by ai-core, called by every AI plugin — together with the types nested in it that a *backend* plugin implements (`LlmBackend`, `HistoryCapableBackend`, `ToolCallingBackend`, `CancellableBackend`, `ConfigurableBackend`, `EmbeddingBackend`) and the value types either side constructs (`ChatMessage`, `LlmConfig`, `LlmResponse`, `SystemPromptRequest`, `ToolDefinition`, `ToolCallRequest`). Also `ToolSourceRegistry` — implemented by ai-core, called by any plugin contributing tools to the agent — with `ToolSource` and `ToolSpec`, which a *contributing* plugin implements, `ToolInvocation`, which ai-core constructs and passes to `ToolSource.invoke`, and `ToolOutcome`, which the source returns. - Utility classes plugins **instantiate**: `KeystoreSecretStore` (AES/GCM over the Android Keystore, alias supplied by the caller). Host-side implementation rather than an interface, so plugins share one copy in the process instead of compiling their own. - Data classes plugins **construct** (e.g. `MenuItem`, `TabItem`, `EditorTabItem`, `NavigationItem`, `ToolbarAction`, `FabAction`, `PluginBuildAction`, `SnippetContribution`, `PluginTooltipEntry`, `PluginSettingsEntry`). - Enums / sealed types plugins **reference**: `PluginPermission`, `ShowAsAction`, `ArchiveFormat`, `BuildActionCategory`, `ToolbarActionIds`, `CommandSpec`, `CommandResult`, `ExtractResult`, `KeystoreSecretStore.Stored`. Sealed, so a plugin `when`s over the cases exhaustively — adding one is a **breaking** change, not an additive one. diff --git a/plugin-api/api/plugin-api.api b/plugin-api/api/plugin-api.api index 9e56ba7ee5..3ed7154a79 100644 --- a/plugin-api/api/plugin-api.api +++ b/plugin-api/api/plugin-api.api @@ -1604,6 +1604,13 @@ public abstract interface class com/itsaky/androidide/plugins/services/LlmInfere public abstract fun getSettingsFragmentClassName ()Ljava/lang/String; } +public abstract interface class com/itsaky/androidide/plugins/services/LlmInferenceService$EmbeddingBackend : com/itsaky/androidide/plugins/services/LlmInferenceService$LlmBackend { + public abstract fun embed (Ljava/util/List;)Ljava/util/concurrent/CompletableFuture; + public abstract fun getEmbeddingDimensions ()I + public abstract fun getEmbeddingModelId ()Ljava/lang/String; + public static fun requireValidBatch (Ljava/util/List;)Ljava/util/List; +} + public abstract interface class com/itsaky/androidide/plugins/services/LlmInferenceService$HistoryCapableBackend : com/itsaky/androidide/plugins/services/LlmInferenceService$LlmBackend { public abstract fun generateStreamingWithHistory (Ljava/util/List;Ljava/lang/String;Lcom/itsaky/androidide/plugins/services/LlmInferenceService$LlmConfig;Lcom/itsaky/androidide/plugins/services/LlmInferenceService$StreamCallback;)V } diff --git a/plugin-api/src/main/java/com/itsaky/androidide/plugins/services/LlmInferenceService.java b/plugin-api/src/main/java/com/itsaky/androidide/plugins/services/LlmInferenceService.java index f9cb3b5c8b..0a34a333b4 100644 --- a/plugin-api/src/main/java/com/itsaky/androidide/plugins/services/LlmInferenceService.java +++ b/plugin-api/src/main/java/com/itsaky/androidide/plugins/services/LlmInferenceService.java @@ -13,7 +13,7 @@ * Service for LLM inference operations. Provided by ai-core plugin. * *

- * {@link LlmBackend} is the one type here that plugins implement rather than call, so it carries only what every backend can answer. Anything a backend may or may not do is a separate interface extending it -- {@link HistoryCapableBackend}, {@link ToolCallingBackend}, {@link CancellableBackend}, {@link ConfigurableBackend} -- and the consumer asks with {@code instanceof} before it calls. A capability is therefore declared by the type, not by a flag a backend can set inconsistently with the methods it overrode. + * {@link LlmBackend} is the one type here that plugins implement rather than call, so it carries only what every backend can answer. Anything a backend may or may not do is a separate interface extending it -- {@link HistoryCapableBackend}, {@link ToolCallingBackend}, {@link CancellableBackend}, {@link ConfigurableBackend}, {@link EmbeddingBackend} -- and the consumer asks with {@code instanceof} before it calls. A capability is therefore declared by the type, not by a flag a backend can set inconsistently with the methods it overrode. */ public interface LlmInferenceService { @@ -102,6 +102,9 @@ void generateStreamingWithTools( /** * Generates embeddings for the given text. * + *

+ * Addresses a backend by id and returns a bare vector, so the caller learns neither which model produced it nor how long it is, and pays one round trip per text. {@link EmbeddingBackend} carries both and takes a batch; prefer it for anything a caller stores or repeats. This method stays because plugins already built against it call it. + * * @param text * the input text to embed (must not be null) * @param backendId @@ -251,6 +254,85 @@ interface ConfigurableBackend extends LlmBackend { String getSettingsFragmentClassName(); } + /** + * An {@link LlmBackend} that turns text into vectors. + * + *

+ * Implementing this is the declaration, exactly as with {@link ToolCallingBackend}: a backend that has no embedding model does not implement it, and the consumer asks with {@code instanceof} before it calls. Nothing here is reachable through {@link LlmInferenceService#getEmbeddings}, which addresses a backend by id and cannot report what produced the vector it returns. + * + *

+ * The batch is the unit of work, not a convenience over a single-text call. Indexing a project is thousands of chunks, and one round trip per chunk against a remote provider is the difference between a feature that finishes on a phone and one that does not. + * + *

+ * Failure contract. A batch completes whole or fails whole. The returned future either yields a list the same size as {@code texts}, positionally aligned with it, or completes exceptionally; it never yields a short list, a list padded with nulls, or a list holding a placeholder vector. A caller storing the result would otherwise persist entries it cannot tell apart from real ones, and a vector that is merely plausible never reports itself as wrong -- it just stops matching. + * + *

+ * Threading. {@link #embed} may be called from any thread and must not block the calling one: start the work and return the future. Implementations must be safe for concurrent calls, because indexing and a user's query can be in flight at once. {@link #getEmbeddingModelId} and {@link #getEmbeddingDimensions} are consulted on the caller's thread, so they answer from state the backend already holds rather than performing I/O. + * + *

+ * Errors. Neither accessor throws. {@link #embed} reports every failure -- transport, authentication, rate limiting, a model that rejected an input -- by completing the future exceptionally, and throws synchronously only for a caller's own mistake, {@link NullPointerException} for a null argument or element and {@link IllegalArgumentException} for an empty list. A consumer that cannot tell a failure from a refusal to start has to guard both paths at every call site. + */ + interface EmbeddingBackend extends LlmBackend { + + /** + * Validates a batch against {@link #embed}'s synchronous contract and snapshots it, so every backend enforces the contract the same way. Call it first in {@code embed}, before starting any work. + * + * @param texts + * the batch as passed to {@link #embed} + * @return a copy of {@code texts} that later caller mutations cannot reach + * @throws IllegalArgumentException + * if {@code texts} is empty + * @throws NullPointerException + * if {@code texts} or any element of it is null + */ + @NonNull + static List requireValidBatch(List texts) { + List batch = new ArrayList<>(Objects.requireNonNull(texts, "texts")); + if (batch.isEmpty()) { + throw new IllegalArgumentException("texts must not be empty"); + } + for (String text : batch) { + Objects.requireNonNull(text, "texts must not contain a null element"); + } + return batch; + } + + /** + * Embeds a batch of texts in one call. + * + * @param texts + * the texts to embed; must not be null, must not be empty, and must contain no null element. The implementation snapshots the list before it returns, so a caller may reuse or clear its own list the moment the call comes back without disturbing the batch in flight. + * @return a future yielding one vector per input, in input order, each of {@link #getEmbeddingDimensions} length -- or completed exceptionally, leaving the whole batch unproduced (never null). The caller owns the returned list and its arrays outright; the implementation must not retain or share them, for example from a cache. + * @throws IllegalArgumentException + * if {@code texts} is empty + * @throws NullPointerException + * if {@code texts} or any element of it is null + */ + @NonNull + CompletableFuture> embed(@NonNull List texts); + + /** + * Gets the number of components in every vector this backend produces. + * + *

+ * Constant for the lifetime of the backend instance, so a consumer may size its storage once. It is not on its own an identity: two unrelated models commonly share a width, and comparing their vectors yields a similarity that looks ordinary and means nothing. Pair it with {@link #getEmbeddingModelId} wherever provenance is recorded. + * + * @return the vector length, always positive + */ + int getEmbeddingDimensions(); + + /** + * Gets the stable identifier of the model producing these vectors, for example {@code "text-embedding-3-small"}. + * + *

+ * This is the model's identity, not the backend's -- {@link LlmBackend#getId} names the backend, and one backend may be reconfigured onto a different model without changing it. Vectors from two different models are incomparable whether or not their widths agree, so a consumer that persists vectors records this alongside them and reindexes when it changes. Without it a model swap silently degrades every stored vector instead of invalidating it. + * + * @return the embedding model identifier, never empty + */ + @NonNull + String getEmbeddingModelId(); + } + /** * An {@link LlmBackend} that renders earlier turns of a conversation. * diff --git a/plugin-api/src/test/java/com/itsaky/androidide/plugins/services/LlmInferenceServiceTest.java b/plugin-api/src/test/java/com/itsaky/androidide/plugins/services/LlmInferenceServiceTest.java index 58ad49fb9a..4ff3f6b695 100644 --- a/plugin-api/src/test/java/com/itsaky/androidide/plugins/services/LlmInferenceServiceTest.java +++ b/plugin-api/src/test/java/com/itsaky/androidide/plugins/services/LlmInferenceServiceTest.java @@ -1,23 +1,42 @@ package com.itsaky.androidide.plugins.services; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import org.junit.Test; /** - * Covers the validating, coalescing and copying branches of the value types plugins construct. Every consumer of this jar is an out-of-tree plugin, so a constructor that accepts a bad state here surfaces as a runtime failure nothing in this repo compiles against. + * Covers the validating, coalescing and copying branches of the value types plugins construct, and the contracts a plugin implements rather than calls. Every consumer of this jar is an out-of-tree plugin, so a constructor that accepts a bad state here, or a capability interface that drifts, surfaces as a runtime failure nothing in this repo compiles against. */ public class LlmInferenceServiceTest { + /** + * Mirrors {@link HashingEmbeddingBackend}'s vector so a result can be traced back to the input that produced it. + */ + private static float[] expectedVector(String text, int dimensions) { + float[] vector = new float[dimensions]; + for (int i = 0; i < dimensions; i++) { + // low 24 bits so the int survives the float conversion exactly and inputs stay distinct + vector[i] = Objects.hash(text, i) & 0xFFFFFF; + } + return vector; + } + @Test public void chatMessageCarriesNoCorrelatorsForAConversationTurn() { LlmInferenceService.ChatMessage message = new LlmInferenceService.ChatMessage(LlmInferenceService.ChatMessage.Role.USER, "hello"); @@ -48,6 +67,92 @@ public void chatMessageRejectsAToolRoleWithoutCorrelators() { } } + @Test + public void embeddingBackendDeclaresItsCapabilityByTypeRatherThanByAFlag() { + LlmInferenceService.LlmBackend plain = new PlainBackend(); + LlmInferenceService.LlmBackend embedding = new HashingEmbeddingBackend(4, "text-embedding-3-small"); + + assertFalse(plain instanceof LlmInferenceService.EmbeddingBackend); + assertTrue(embedding instanceof LlmInferenceService.EmbeddingBackend); + } + + @Test + public void embeddingBackendFailsTheWholeBatchRatherThanPartOfIt() throws Exception { + LlmInferenceService.EmbeddingBackend backend = new RefusingEmbeddingBackend(); + + CompletableFuture> future = backend.embed(Arrays.asList("first", "second")); + + try { + future.get(5, TimeUnit.SECONDS); + fail("expected ExecutionException"); + } catch (ExecutionException expected) { + // nothing is handed back, so a caller cannot store half a batch and mistake it for a whole one + assertTrue(expected.getCause() instanceof IOException); + } + } + + @Test + public void embeddingBackendIgnoresAMutationOfTheCallersListAfterTheCall() throws Exception { + LlmInferenceService.EmbeddingBackend backend = new HashingEmbeddingBackend(4, "text-embedding-3-small"); + List texts = new ArrayList<>(Arrays.asList("alpha", "beta")); + + CompletableFuture> future = backend.embed(texts); + texts.clear(); + + List vectors = future.get(5, TimeUnit.SECONDS); + assertEquals(2, vectors.size()); + assertArrayEquals(expectedVector("alpha", 4), vectors.get(0), 0.0f); + assertArrayEquals(expectedVector("beta", 4), vectors.get(1), 0.0f); + } + + @Test + public void embeddingBackendNamesTheModelApartFromTheBackend() { + LlmInferenceService.EmbeddingBackend backend = new HashingEmbeddingBackend(1536, "text-embedding-3-small"); + + // two models of equal width are mutually incomparable, so the id is the part that detects a swap + assertEquals("hashing", backend.getId()); + assertEquals("text-embedding-3-small", backend.getEmbeddingModelId()); + assertEquals(1536, backend.getEmbeddingDimensions()); + } + + @Test + public void embeddingBackendRejectsAnEmptyBatchBeforeStartingWork() { + LlmInferenceService.EmbeddingBackend backend = new HashingEmbeddingBackend(4, "text-embedding-3-small"); + + try { + backend.embed(Collections.emptyList()); + fail("expected IllegalArgumentException"); + } catch (IllegalArgumentException expected) { + assertTrue(expected.getMessage().contains("texts")); + } + } + + @Test + public void embeddingBackendRejectsANullTextBeforeStartingWork() { + LlmInferenceService.EmbeddingBackend backend = new HashingEmbeddingBackend(4, "text-embedding-3-small"); + + try { + backend.embed(Arrays.asList("alpha", null)); + fail("expected NullPointerException"); + } catch (NullPointerException expected) { + // thrown from the call, not the future, so a caller guards one path rather than two + } + } + + @Test + public void embeddingBackendReturnsOneVectorPerInputInInputOrder() throws Exception { + LlmInferenceService.EmbeddingBackend backend = new HashingEmbeddingBackend(4, "text-embedding-3-small"); + List texts = Arrays.asList("alpha", "beta", "gamma"); + + List vectors = backend.embed(texts).get(5, TimeUnit.SECONDS); + + assertEquals(texts.size(), vectors.size()); + for (int i = 0; i < texts.size(); i++) { + assertEquals(backend.getEmbeddingDimensions(), vectors.get(i).length); + assertArrayEquals(expectedVector(texts.get(i), 4), vectors.get(i), 0.0f); + } + } + @Test public void llmConfigRejectsAMissingBackendId() { try { @@ -157,4 +262,137 @@ public void toolResultRejectsAMissingCallId() { // without a call id the result cannot be matched to the call it answers } } + + /** + * A minimal conforming backend: stateless, so concurrent batches cannot interleave; validating before it starts any work; and copying the caller's list so a mutation after the call cannot reach the batch in flight. + */ + private static final class HashingEmbeddingBackend extends StubEmbeddingBackend { + + HashingEmbeddingBackend(int dimensions, String modelId) { + super("hashing", dimensions, modelId); + } + + @Override + public CompletableFuture> embed(List texts) { + List batch = LlmInferenceService.EmbeddingBackend.requireValidBatch(texts); + int dimensions = getEmbeddingDimensions(); + return CompletableFuture.supplyAsync(() -> { + List vectors = new ArrayList<>(batch.size()); + for (String text : batch) { + vectors.add(expectedVector(text, dimensions)); + } + return Collections.unmodifiableList(vectors); + }); + } + } + + /** + * An {@link LlmInferenceService.LlmBackend} with no embedding capability, so the {@code instanceof} discrimination is exercised against a backend that really lacks it rather than against a mock. + */ + private static final class PlainBackend implements LlmInferenceService.LlmBackend { + + @Override + public CompletableFuture generate(String prompt, LlmInferenceService.LlmConfig config) { + return CompletableFuture.completedFuture(LlmInferenceService.LlmResponse.success("ok", 1, 1L)); + } + + @Override + public void generateStreaming(String prompt, LlmInferenceService.LlmConfig config, LlmInferenceService.StreamCallback callback) { + callback.onComplete(LlmInferenceService.LlmResponse.success("ok", 1, 1L)); + } + + @Override + public CompletableFuture generateWithHistory(List history, String prompt, LlmInferenceService.LlmConfig config) { + return generate(prompt, config); + } + + @Override + public String getId() { + return "plain"; + } + + @Override + public String getName() { + return "Plain"; + } + + @Override + public boolean isAvailable() { + return true; + } + } + + /** + * Reports a transport failure the documented way: the future completes exceptionally and yields no vector at all, not a short or padded list. + */ + private static final class RefusingEmbeddingBackend extends StubEmbeddingBackend { + + RefusingEmbeddingBackend() { + super("refusing", 4, "text-embedding-3-small"); + } + + @Override + public CompletableFuture> embed(List texts) { + LlmInferenceService.EmbeddingBackend.requireValidBatch(texts); + CompletableFuture> future = new CompletableFuture<>(); + future.completeExceptionally(new IOException("embedding endpoint refused")); + return future; + } + } + + /** + * The {@link LlmInferenceService.LlmBackend} half of an embedding backend, which none of these tests exercise. Kept apart from the embedding behaviour so each double below says only what it is for. + */ + private abstract static class StubEmbeddingBackend implements LlmInferenceService.EmbeddingBackend { + + private final int dimensions; + private final String id; + private final String modelId; + + StubEmbeddingBackend(String id, int dimensions, String modelId) { + this.id = id; + this.dimensions = dimensions; + this.modelId = modelId; + } + + @Override + public CompletableFuture generate(String prompt, LlmInferenceService.LlmConfig config) { + return CompletableFuture.completedFuture(LlmInferenceService.LlmResponse.failure("not a generating backend")); + } + + @Override + public void generateStreaming(String prompt, LlmInferenceService.LlmConfig config, LlmInferenceService.StreamCallback callback) { + callback.onError("not a generating backend"); + } + + @Override + public CompletableFuture generateWithHistory(List history, String prompt, LlmInferenceService.LlmConfig config) { + return generate(prompt, config); + } + + @Override + public int getEmbeddingDimensions() { + return dimensions; + } + + @Override + public String getEmbeddingModelId() { + return modelId; + } + + @Override + public String getId() { + return id; + } + + @Override + public String getName() { + return id; + } + + @Override + public boolean isAvailable() { + return true; + } + } }