{"record":{"id":"6cb00d3d1c431838","repo":"conductor-oss/conductor","slug":"embeddings-are-not-supported-by-the-stability-ai-p","errorCode":null,"errorMessage":"Embeddings are not supported by the Stability AI provider","messagePattern":"Embeddings are not supported by the Stability AI provider","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/providers/stabilityai/StabilityAI.java","lineNumber":164,"sourceCode":"        return org.springframework.ai.image.ImageOptionsBuilder.builder()\n                .model(input.getModel())\n                .N(input.getN())\n                .height(input.getHeight())\n                .width(input.getWidth())\n                .responseFormat(\"b64_json\")\n                .style(input.getStyle())\n                .build();\n    }\n\n    @Override\n    public ChatModel getChatModel() {\n        throw new UnsupportedOperationException(\n                \"Chat completion is not supported by the Stability AI provider\");\n    }\n\n    @Override\n    public List<Float> generateEmbeddings(EmbeddingGenRequest embeddingGenRequest) {\n        throw new UnsupportedOperationException(\n                \"Embeddings are not supported by the Stability AI provider\");\n    }\n\n    /**\n     * Derive an aspect ratio string from width/height in ImageOptions.\n     *\n     * <p>The v2beta API accepts aspect ratios like \"1:1\", \"16:9\", \"9:16\", \"3:2\", \"2:3\", \"4:5\",\n     * \"5:4\", \"21:9\", \"9:21\". If width and height are both provided, we compute the closest matching\n     * ratio. If not provided, defaults to \"1:1\".\n     */\n    private static String deriveAspectRatio(ImageOptions options) {\n        if (options == null || options.getWidth() == null || options.getHeight() == null) {\n            return \"1:1\";\n        }\n        int w = options.getWidth();\n        int h = options.getHeight();\n        if (w <= 0 || h <= 0) {\n            return \"1:1\";","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/providers/stabilityai/StabilityAI.java#L146-L182","documentation":"Thrown by StabilityAI.generateEmbeddings as UnsupportedOperationException. Stability AI is an image-only provider and does not offer an embeddings endpoint, so the AIModel method is intentionally unimplemented.","triggerScenarios":"Calling generateEmbeddings() on a StabilityAI instance, or routing an embeddings task to the stabilityai provider.","commonSituations":"An embedding task whose llmProvider is stabilityai, or generic AIModel code calling generateEmbeddings without a capability check.","solutions":["Route embeddings to an embeddings-capable provider (OpenAI).","Guard generateEmbeddings() with a provider/capability check.","Set the correct llmProvider on the embedding task input."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (\"stabilityai\".equals(model.getModelProvider())) {\n    throw new IllegalArgumentException(\n        \"Stability AI does not support embeddings\");\n}\nList<Float> emb = model.generateEmbeddings(req);","typeGuard":"boolean supportsEmbeddings(AIModel m) {\n    return !\"stabilityai\".equals(m.getModelProvider())\n        && !\"perplexity\".equals(m.getModelProvider());\n}","tryCatchPattern":"try {\n    List<Float> emb = model.generateEmbeddings(req);\n} catch (UnsupportedOperationException e) {\n    // provider lacks embeddings; switch to OpenAI\n}","preventionTips":["Check getModelProvider() before calling generateEmbeddings.","Route embedding tasks to OpenAI.","Keep a known-capabilities map per provider."],"tags":["stabilityai","embeddings","unsupported-operation","provider-capabilities"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}