gnodet commented on PR #22086: URL: https://github.com/apache/camel/pull/22086#issuecomment-4085158934
@jamesnetherton The embedding model is specified — it comes from the Ollama test service via `OLLAMA.embeddingModelName()` (see `setupResources()` in the test). That part works fine. The issue is the `encodingFormat` parameter. The OpenAI embeddings API supports two formats: - `float`: returns embedding vectors as `List<Float>` - `base64`: returns embedding vectors as a base64-encoded string The producer code at `OpenAIEmbeddingsProducer.java:109` calls `embedding.embedding()` which returns `List<Float>`. This works when the format is `float`, but when it's `base64`, the API returns a different data structure (base64 string), and the SDK's `embedding.embedding()` call results in a `ClassCastException` because it tries to deserialize a base64 string as a float list. The default was `base64`, so the `direct:embedding` route (which uses defaults, no explicit `encodingFormat`) would always fail. The `direct:embeddingWithEncodingFormatFloat` route worked because it explicitly set `encodingFormat=float`. Changing the default to `float` aligns the default with what the producer code actually expects. If someone wants `base64`, they'd need to set it explicitly and handle the response format differently. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
