Claus Ibsen created CAMEL-26216:
-----------------------------------

             Summary: camel-pinecone - QUERY without the TopK header fails with 
NullPointerException, and the pinecone:rag transformer always gives an empty 
list
                 Key: CAMEL-26216
                 URL: https://issues.apache.org/jira/browse/CAMEL-26216
             Project: Camel
          Issue Type: Bug
          Components: camel-pinecone
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while adding the catalog body types of pinecone (CAMEL-24961, PR #28402).

h4. 1. QUERY and QUERY_BY_ID without CamelPineconeQueryTopK fail with 
NullPointerException

{{PineconeVectorDbProducer.query}} (main 2a465aa4814c, line 302) and 
{{queryById}} (line 329) do {{int topK = in.getHeader(QUERY_TOP_K, 
Integer.class)}}; without the header the unboxing fails with a 
{{NullPointerException}}. There is no default (camel-weaviate uses 10, 
camel-pgvector 3). Checked on 4.24.0-SNAPSHOT with pinecone-local.

Proposed: use a default (for example 10) or an endpoint option, and fail with a 
clear message otherwise.

h4. 2. The pinecone:rag transformer never finds the query results

{{PineconeReverseEmbeddingsDataTypeTransformer}} (line 38) reads the body as a 
{{List<ScoredVectorWithUnsignedIndices>}}, but QUERY leaves a 
{{QueryResponseWithUnsignedIndices}} as the body (line 313), so 
{{getBody(List.class)}} gives null and the transformer sets an empty list. A 
route QUERY then {{transform(new DataType("pinecone:rag"))}} always gets no 
text. Read in the code, not run.

Proposed: take {{getMatchesList()}} when the body is a 
{{QueryResponseWithUnsignedIndices}}.

h4. 3. A vector as a List of Double fails with ClassCastException

{{upsert}} (line 218), {{update}} and {{query}} pass the body List to the 
Pinecone SDK, which expects {{List<Float>}}; a List of Double (what a JSON 
array unmarshals to) fails with a raw {{ClassCastException}}. camel-weaviate 
and camel-pgvector have the same problem. Checked on 4.24.0-SNAPSHOT with 
pinecone-local.

Proposed: convert each element with {{Number.floatValue()}}.

h4. 4. UPSERT without CamelPineconeIndexId fails

{{upsert}} (line 213) passes a null id to {{index.upsert}} when the header is 
not set, and the SDK fails with {{PineconeValidationException}}. Checked on 
4.24.0-SNAPSHOT with pinecone-local.

Proposed: generate an id (as the {{pinecone:embeddings}} transformer does with 
a random UUID) or fail with a message that names the header.

h4. 5. camel-test-infra pinecone maps only port 5080

{{PineconeLocalContainerInfraService}} (line 64) and {{PineconeIndexContainer}} 
(line 47) map only port 5080, the control plane of pinecone-local; the indexes 
it creates are served on 5081 and up, so data-plane calls (upsert, query, 
fetch) from the test cannot reach the index. Checked on 4.24.0-SNAPSHOT: 
pinecone-local was started by hand with ports 5080-5085 to run the data-plane 
operations.

Proposed: also map the index ports (5081-5085), or document that only the 
control plane can be tested.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to