From 4c2523c36f5b0a8cf89c90a51b97e9a7f8b14b42 Mon Sep 17 00:00:00 2001 From: Tom Cunningham Date: Fri, 28 Feb 2025 08:50:01 -0500 Subject: [PATCH] Add host to camel-pinecone and fix possible collectionDimension NPE (#17299) --- .../camel/catalog/components/pinecone.json | 32 ++++++++++--------- .../PineconeVectorDbComponentConfigurer.java | 3 ++ ...neconeVectorDbConfigurationConfigurer.java | 3 ++ .../PineconeVectorDbEndpointConfigurer.java | 3 ++ .../PineconeVectorDbEndpointUriFactory.java | 3 +- .../camel/component/pinecone/pinecone.json | 32 ++++++++++--------- .../component/pinecone/PineconeVectorDb.java | 1 + .../PineconeVectorDbConfiguration.java | 16 +++++++++- .../pinecone/PineconeVectorDbEndpoint.java | 21 ++++++++---- .../pinecone/PineconeVectorDbProducer.java | 17 +++++++--- .../PineconeComponentConfigurationTest.java | 1 + .../test/resources/pinecone_index.properties | 4 ++- .../camel/model/ProcessorDefinition.java | 6 ++-- .../dsl/PineconeComponentBuilderFactory.java | 18 +++++++++++ ...ineconeVectorDbEndpointBuilderFactory.java | 16 ++++++++++ 15 files changed, 130 insertions(+), 46 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pinecone.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pinecone.json index b485013342c93..f8d422124a388 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pinecone.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/pinecone.json @@ -26,16 +26,17 @@ "componentProperties": { "cloud": { "index": 0, "kind": "property", "displayName": "Cloud", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud type to use (aws\/gcp\/azure)" }, "cloudRegion": { "index": 1, "kind": "property", "displayName": "Cloud Region", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud region" }, - "collectionDimension": { "index": 2, "kind": "property", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, + "collectionDimension": { "index": 2, "kind": "property", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1536", "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, "collectionSimilarityMetric": { "index": 3, "kind": "property", "displayName": "Collection Similarity Metric", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Similarity Metric to use (cosine\/euclidean\/dotproduct)" }, "configuration": { "index": 4, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration;" }, - "indexName": { "index": 5, "kind": "property", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, - "lazyStartProducer": { "index": 6, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, - "proxyHost": { "index": 7, "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, - "proxyPort": { "index": 8, "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, - "tls": { "index": 9, "kind": "property", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, - "token": { "index": 10, "kind": "property", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, - "autowiredEnabled": { "index": 11, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + "host": { "index": 5, "kind": "property", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets a custom host URL to connect to" }, + "indexName": { "index": 6, "kind": "property", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, + "lazyStartProducer": { "index": 7, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, + "proxyHost": { "index": 8, "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, + "proxyPort": { "index": 9, "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, + "tls": { "index": 10, "kind": "property", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, + "token": { "index": 11, "kind": "property", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, + "autowiredEnabled": { "index": 12, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } }, "headers": { "CamelPineconeAction": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "enum": [ "CREATE_COLLECTION", "CREATE_INDEX", "UPSERT", "INSERT", "SEARCH", "DELETE", "UPDATE", "QUERY", "QUERY_BY_ID" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The action to be performed.", "constantName": "org.apache.camel.component.pinecone.PineconeVectorDb$Headers#ACTION" }, @@ -60,13 +61,14 @@ "collection": { "index": 0, "kind": "path", "displayName": "Collection", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The collection Name" }, "cloud": { "index": 1, "kind": "parameter", "displayName": "Cloud", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud type to use (aws\/gcp\/azure)" }, "cloudRegion": { "index": 2, "kind": "parameter", "displayName": "Cloud Region", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud region" }, - "collectionDimension": { "index": 3, "kind": "parameter", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, + "collectionDimension": { "index": 3, "kind": "parameter", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1536", "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, "collectionSimilarityMetric": { "index": 4, "kind": "parameter", "displayName": "Collection Similarity Metric", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Similarity Metric to use (cosine\/euclidean\/dotproduct)" }, - "indexName": { "index": 5, "kind": "parameter", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, - "proxyHost": { "index": 6, "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, - "proxyPort": { "index": 7, "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, - "tls": { "index": 8, "kind": "parameter", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, - "token": { "index": 9, "kind": "parameter", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, - "lazyStartProducer": { "index": 10, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." } + "host": { "index": 5, "kind": "parameter", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets a custom host URL to connect to" }, + "indexName": { "index": 6, "kind": "parameter", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, + "proxyHost": { "index": 7, "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, + "proxyPort": { "index": 8, "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, + "tls": { "index": 9, "kind": "parameter", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, + "token": { "index": 10, "kind": "parameter", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, + "lazyStartProducer": { "index": 11, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." } } } diff --git a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbComponentConfigurer.java b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbComponentConfigurer.java index 539cfee4b619d..148a4b1a67d12 100644 --- a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbComponentConfigurer.java +++ b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbComponentConfigurer.java @@ -40,6 +40,7 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "collectionsimilaritymetric": case "collectionSimilarityMetric": getOrCreateConfiguration(target).setCollectionSimilarityMetric(property(camelContext, java.lang.String.class, value)); return true; case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.pinecone.PineconeVectorDbConfiguration.class, value)); return true; + case "host": getOrCreateConfiguration(target).setHost(property(camelContext, java.lang.String.class, value)); return true; case "indexname": case "indexName": getOrCreateConfiguration(target).setIndexName(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": @@ -67,6 +68,7 @@ public Class getOptionType(String name, boolean ignoreCase) { case "collectionsimilaritymetric": case "collectionSimilarityMetric": return java.lang.String.class; case "configuration": return org.apache.camel.component.pinecone.PineconeVectorDbConfiguration.class; + case "host": return java.lang.String.class; case "indexname": case "indexName": return java.lang.String.class; case "lazystartproducer": @@ -95,6 +97,7 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "collectionsimilaritymetric": case "collectionSimilarityMetric": return getOrCreateConfiguration(target).getCollectionSimilarityMetric(); case "configuration": return target.getConfiguration(); + case "host": return getOrCreateConfiguration(target).getHost(); case "indexname": case "indexName": return getOrCreateConfiguration(target).getIndexName(); case "lazystartproducer": diff --git a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbConfigurationConfigurer.java b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbConfigurationConfigurer.java index aebba00cc5597..00d3f530e7fb2 100644 --- a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbConfigurationConfigurer.java +++ b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbConfigurationConfigurer.java @@ -31,6 +31,7 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "collectionDimension": target.setCollectionDimension(property(camelContext, java.lang.Integer.class, value)); return true; case "collectionsimilaritymetric": case "collectionSimilarityMetric": target.setCollectionSimilarityMetric(property(camelContext, java.lang.String.class, value)); return true; + case "host": target.setHost(property(camelContext, java.lang.String.class, value)); return true; case "indexname": case "indexName": target.setIndexName(property(camelContext, java.lang.String.class, value)); return true; case "proxyhost": @@ -54,6 +55,7 @@ public Class getOptionType(String name, boolean ignoreCase) { case "collectionDimension": return java.lang.Integer.class; case "collectionsimilaritymetric": case "collectionSimilarityMetric": return java.lang.String.class; + case "host": return java.lang.String.class; case "indexname": case "indexName": return java.lang.String.class; case "proxyhost": @@ -78,6 +80,7 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "collectionDimension": return target.getCollectionDimension(); case "collectionsimilaritymetric": case "collectionSimilarityMetric": return target.getCollectionSimilarityMetric(); + case "host": return target.getHost(); case "indexname": case "indexName": return target.getIndexName(); case "proxyhost": diff --git a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointConfigurer.java b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointConfigurer.java index 353ccb4c45c0e..e4ed0559f6966 100644 --- a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointConfigurer.java +++ b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointConfigurer.java @@ -30,6 +30,7 @@ public boolean configure(CamelContext camelContext, Object obj, String name, Obj case "collectionDimension": target.getConfiguration().setCollectionDimension(property(camelContext, java.lang.Integer.class, value)); return true; case "collectionsimilaritymetric": case "collectionSimilarityMetric": target.getConfiguration().setCollectionSimilarityMetric(property(camelContext, java.lang.String.class, value)); return true; + case "host": target.getConfiguration().setHost(property(camelContext, java.lang.String.class, value)); return true; case "indexname": case "indexName": target.getConfiguration().setIndexName(property(camelContext, java.lang.String.class, value)); return true; case "lazystartproducer": @@ -54,6 +55,7 @@ public Class getOptionType(String name, boolean ignoreCase) { case "collectionDimension": return java.lang.Integer.class; case "collectionsimilaritymetric": case "collectionSimilarityMetric": return java.lang.String.class; + case "host": return java.lang.String.class; case "indexname": case "indexName": return java.lang.String.class; case "lazystartproducer": @@ -79,6 +81,7 @@ public Object getOptionValue(Object obj, String name, boolean ignoreCase) { case "collectionDimension": return target.getConfiguration().getCollectionDimension(); case "collectionsimilaritymetric": case "collectionSimilarityMetric": return target.getConfiguration().getCollectionSimilarityMetric(); + case "host": return target.getConfiguration().getHost(); case "indexname": case "indexName": return target.getConfiguration().getIndexName(); case "lazystartproducer": diff --git a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointUriFactory.java b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointUriFactory.java index ea2b1e3323da7..37d6ae1f81b8e 100644 --- a/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointUriFactory.java +++ b/components/camel-ai/camel-pinecone/src/generated/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpointUriFactory.java @@ -23,12 +23,13 @@ public class PineconeVectorDbEndpointUriFactory extends org.apache.camel.support private static final Set SECRET_PROPERTY_NAMES; private static final Set MULTI_VALUE_PREFIXES; static { - Set props = new HashSet<>(11); + Set props = new HashSet<>(12); props.add("cloud"); props.add("cloudRegion"); props.add("collection"); props.add("collectionDimension"); props.add("collectionSimilarityMetric"); + props.add("host"); props.add("indexName"); props.add("lazyStartProducer"); props.add("proxyHost"); diff --git a/components/camel-ai/camel-pinecone/src/generated/resources/META-INF/org/apache/camel/component/pinecone/pinecone.json b/components/camel-ai/camel-pinecone/src/generated/resources/META-INF/org/apache/camel/component/pinecone/pinecone.json index b485013342c93..f8d422124a388 100644 --- a/components/camel-ai/camel-pinecone/src/generated/resources/META-INF/org/apache/camel/component/pinecone/pinecone.json +++ b/components/camel-ai/camel-pinecone/src/generated/resources/META-INF/org/apache/camel/component/pinecone/pinecone.json @@ -26,16 +26,17 @@ "componentProperties": { "cloud": { "index": 0, "kind": "property", "displayName": "Cloud", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud type to use (aws\/gcp\/azure)" }, "cloudRegion": { "index": 1, "kind": "property", "displayName": "Cloud Region", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud region" }, - "collectionDimension": { "index": 2, "kind": "property", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, + "collectionDimension": { "index": 2, "kind": "property", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1536", "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, "collectionSimilarityMetric": { "index": 3, "kind": "property", "displayName": "Collection Similarity Metric", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Similarity Metric to use (cosine\/euclidean\/dotproduct)" }, "configuration": { "index": 4, "kind": "property", "displayName": "Configuration", "group": "producer", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "deprecated": false, "autowired": false, "secret": false, "description": "The configuration;" }, - "indexName": { "index": 5, "kind": "property", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, - "lazyStartProducer": { "index": 6, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, - "proxyHost": { "index": 7, "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, - "proxyPort": { "index": 8, "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, - "tls": { "index": 9, "kind": "property", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, - "token": { "index": 10, "kind": "property", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, - "autowiredEnabled": { "index": 11, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } + "host": { "index": 5, "kind": "property", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets a custom host URL to connect to" }, + "indexName": { "index": 6, "kind": "property", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, + "lazyStartProducer": { "index": 7, "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." }, + "proxyHost": { "index": 8, "kind": "property", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, + "proxyPort": { "index": 9, "kind": "property", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, + "tls": { "index": 10, "kind": "property", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, + "token": { "index": 11, "kind": "property", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, + "autowiredEnabled": { "index": 12, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." } }, "headers": { "CamelPineconeAction": { "index": 0, "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "enum": [ "CREATE_COLLECTION", "CREATE_INDEX", "UPSERT", "INSERT", "SEARCH", "DELETE", "UPDATE", "QUERY", "QUERY_BY_ID" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The action to be performed.", "constantName": "org.apache.camel.component.pinecone.PineconeVectorDb$Headers#ACTION" }, @@ -60,13 +61,14 @@ "collection": { "index": 0, "kind": "path", "displayName": "Collection", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The collection Name" }, "cloud": { "index": 1, "kind": "parameter", "displayName": "Cloud", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud type to use (aws\/gcp\/azure)" }, "cloudRegion": { "index": 2, "kind": "parameter", "displayName": "Cloud Region", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the cloud region" }, - "collectionDimension": { "index": 3, "kind": "parameter", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, + "collectionDimension": { "index": 3, "kind": "parameter", "displayName": "Collection Dimension", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1536", "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Dimension to use (1-1536)" }, "collectionSimilarityMetric": { "index": 4, "kind": "parameter", "displayName": "Collection Similarity Metric", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the Collection Similarity Metric to use (cosine\/euclidean\/dotproduct)" }, - "indexName": { "index": 5, "kind": "parameter", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, - "proxyHost": { "index": 6, "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, - "proxyPort": { "index": 7, "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, - "tls": { "index": 8, "kind": "parameter", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, - "token": { "index": 9, "kind": "parameter", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, - "lazyStartProducer": { "index": 10, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." } + "host": { "index": 5, "kind": "parameter", "displayName": "Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets a custom host URL to connect to" }, + "indexName": { "index": 6, "kind": "parameter", "displayName": "Index Name", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the index name to use" }, + "proxyHost": { "index": 7, "kind": "parameter", "displayName": "Proxy Host", "group": "producer", "label": "producer", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy host" }, + "proxyPort": { "index": 8, "kind": "parameter", "displayName": "Proxy Port", "group": "producer", "label": "producer", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Set the proxy port" }, + "tls": { "index": 9, "kind": "parameter", "displayName": "Tls", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Whether the client uses Transport Layer Security (TLS) to secure communications" }, + "token": { "index": 10, "kind": "parameter", "displayName": "Token", "group": "producer", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": true, "configurationClass": "org.apache.camel.component.pinecone.PineconeVectorDbConfiguration", "configurationField": "configuration", "description": "Sets the API key to use for authentication" }, + "lazyStartProducer": { "index": 11, "kind": "parameter", "displayName": "Lazy Start Producer", "group": "producer (advanced)", "label": "producer,advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." } } } diff --git a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDb.java b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDb.java index 923517193c40c..a47fd08cdc212 100644 --- a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDb.java +++ b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDb.java @@ -20,6 +20,7 @@ public class PineconeVectorDb { public static final String SCHEME = "pinecone"; + public static final int DEFAULT_COLLECTION_DIMENSION = 1536; private PineconeVectorDb() { } diff --git a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbConfiguration.java b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbConfiguration.java index 675b9541ae1a7..934a3b0884652 100644 --- a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbConfiguration.java +++ b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbConfiguration.java @@ -40,7 +40,7 @@ public class PineconeVectorDbConfiguration implements Cloneable { @UriParam(label = "producer") private String collectionSimilarityMetric; - @UriParam(label = "producer") + @UriParam(label = "producer", defaultValue = "1536") private Integer collectionDimension; @UriParam(label = "producer") @@ -58,6 +58,9 @@ public class PineconeVectorDbConfiguration implements Cloneable { @UriParam(defaultValue = "true", label = "producer") private boolean tls; + @UriParam(label = "producer") + private String host; + public String getIndexName() { return indexName; } @@ -146,6 +149,17 @@ public void setTls(boolean tls) { this.tls = tls; } + public String getHost() { + return host; + } + + /** + * Sets a custom host URL to connect to + */ + public void setHost(String host) { + this.host = host; + } + public String getToken() { return token; } diff --git a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpoint.java b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpoint.java index cc158b55d244e..c40fdfd6eda38 100644 --- a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpoint.java +++ b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbEndpoint.java @@ -110,18 +110,27 @@ public void doStop() throws Exception { private Pinecone createClient() { - Pinecone pinecone; boolean tls = configuration.isTls(); + Pinecone.Builder builder = new Pinecone.Builder(configuration.getToken()); + + // Check to see if a host is configured + if (getConfiguration().getHost() != null) { + builder = builder.withHost(getConfiguration().getHost()); + } + + // if TLS is false, set it + if (!tls) { + builder = builder.withTlsEnabled(tls); + } + // Check to see if a proxyHost/proxyPort pair is configured if ((getConfiguration().getProxyHost() != null) && (getConfiguration().getProxyPort() != null)) { - pinecone = new Pinecone.Builder(configuration.getToken()).withProxy(getConfiguration().getProxyHost(), - getConfiguration().getProxyPort().intValue()).withTlsEnabled(tls).build(); - } else { - pinecone = new Pinecone.Builder(configuration.getToken()).withTlsEnabled(tls).build(); + builder = builder.withProxy(getConfiguration().getProxyHost(), + getConfiguration().getProxyPort().intValue()); } - return pinecone; + return builder.build(); } } diff --git a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbProducer.java b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbProducer.java index 70f8c900a17ef..c1452a8cde766 100644 --- a/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbProducer.java +++ b/components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/PineconeVectorDbProducer.java @@ -127,9 +127,14 @@ private void createServerlessIndex(Exchange exchange) throws Exception { String indexName = getEndpoint().getConfiguration().getIndexName(); String collectionSimilarityMetricName = getEndpoint().getConfiguration().getCollectionSimilarityMetric(); - int collectionDimension = getEndpoint().getConfiguration().getCollectionDimension().intValue(); + String collectionCloudName = getEndpoint().getConfiguration().getCloud(); String collectionCloudRegionName = getEndpoint().getConfiguration().getCloudRegion(); + int collectionDimension = PineconeVectorDb.DEFAULT_COLLECTION_DIMENSION; + + if (getEndpoint().getConfiguration().getCollectionDimension() != null) { + collectionDimension = getEndpoint().getConfiguration().getCollectionDimension().intValue(); + } if (in.getHeader(PineconeVectorDb.Headers.INDEX_NAME, String.class) != null) { indexName = in.getHeader(PineconeVectorDb.Headers.INDEX_NAME, String.class); @@ -161,18 +166,22 @@ private void createPodIndex(Exchange exchange) throws Exception { final Message in = exchange.getMessage(); String indexName = getEndpoint().getConfiguration().getIndexName(); String collectionSimilarityMetricName = getEndpoint().getConfiguration().getCollectionSimilarityMetric(); - int collectionDimension = getEndpoint().getConfiguration().getCollectionDimension().intValue(); + int collectionDimension = PineconeVectorDb.DEFAULT_COLLECTION_DIMENSION; + + if (getEndpoint().getConfiguration().getCollectionDimension() != null) { + collectionDimension = getEndpoint().getConfiguration().getCollectionDimension().intValue(); + } if (in.getHeader(PineconeVectorDb.Headers.INDEX_NAME, String.class) != null) { indexName = in.getHeader(PineconeVectorDb.Headers.INDEX_NAME, String.class); } if (in.getHeader(PineconeVectorDb.Headers.COLLECTION_SIMILARITY_METRIC, String.class) != null) { - collectionSimilarityMetricName = getEndpoint().getConfiguration().getCollectionSimilarityMetric(); + collectionSimilarityMetricName = in.getHeader(PineconeVectorDb.Headers.COLLECTION_SIMILARITY_METRIC, String.class); } if (in.getHeader(PineconeVectorDb.Headers.COLLECTION_DIMENSION, Integer.class) != null) { - collectionDimension = getEndpoint().getConfiguration().getCollectionDimension().intValue(); + collectionDimension = in.getHeader(PineconeVectorDb.Headers.COLLECTION_DIMENSION, Integer.class); } String indexPodType = in.getHeader(PineconeVectorDb.Headers.INDEX_POD_TYPE, String.class); diff --git a/components/camel-ai/camel-pinecone/src/test/java/org/apache/camel/component/pinecone/PineconeComponentConfigurationTest.java b/components/camel-ai/camel-pinecone/src/test/java/org/apache/camel/component/pinecone/PineconeComponentConfigurationTest.java index bf5cd889f6989..55c4fc938c708 100644 --- a/components/camel-ai/camel-pinecone/src/test/java/org/apache/camel/component/pinecone/PineconeComponentConfigurationTest.java +++ b/components/camel-ai/camel-pinecone/src/test/java/org/apache/camel/component/pinecone/PineconeComponentConfigurationTest.java @@ -63,6 +63,7 @@ void createEndpointWithProperties() throws Exception { assertEquals("localhost", endpoint.getConfiguration().getProxyHost()); assertEquals(9080, endpoint.getConfiguration().getProxyPort().intValue()); assertEquals(false, endpoint.getConfiguration().isTls()); + assertEquals("http://www.foobar.com", endpoint.getConfiguration().getHost()); } } diff --git a/components/camel-ai/camel-pinecone/src/test/resources/pinecone_index.properties b/components/camel-ai/camel-pinecone/src/test/resources/pinecone_index.properties index 9672dd67b2f96..7e44cf5305324 100644 --- a/components/camel-ai/camel-pinecone/src/test/resources/pinecone_index.properties +++ b/components/camel-ai/camel-pinecone/src/test/resources/pinecone_index.properties @@ -22,4 +22,6 @@ cloudRegion=us-east-1 proxyHost=localhost proxyPort=9080 -tls=false \ No newline at end of file +tls=false + +host=http://www.foobar.com \ No newline at end of file diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java index 88be9b1717ea0..8f8c7ae841fa6 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/model/ProcessorDefinition.java @@ -808,11 +808,11 @@ public Type nodePrefixId(String prefixId) { /** * Sets the description of this node. *

- * Important: If you want to set the description of the route, then you must use {@link #routeDescription(String)} - * instead. + * Important: If you want to set the description of the route, then you must use + * {@link #routeDescription(String)} instead. * * @param description the description - * @return the builder + * @return the builder */ @Override public Type description(String description) { diff --git a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PineconeComponentBuilderFactory.java b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PineconeComponentBuilderFactory.java index 1aff1b0c8f5a6..5fd6d1f9e643a 100644 --- a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PineconeComponentBuilderFactory.java +++ b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/PineconeComponentBuilderFactory.java @@ -80,11 +80,13 @@ default PineconeComponentBuilder cloudRegion(java.lang.String cloudRegion) { return this; } + /** * Sets the Collection Dimension to use (1-1536). * * The option is a: <code>java.lang.Integer</code> type. * + * Default: 1536 * Group: producer * * @param collectionDimension the value to set @@ -127,6 +129,21 @@ default PineconeComponentBuilder configuration(org.apache.camel.component.pineco return this; } + /** + * Sets a custom host URL to connect to. + * + * The option is a: <code>java.lang.String</code> type. + * + * Group: producer + * + * @param host the value to set + * @return the dsl builder + */ + default PineconeComponentBuilder host(java.lang.String host) { + doSetProperty("host", host); + return this; + } + /** * Sets the index name to use. * @@ -277,6 +294,7 @@ protected boolean setPropertyOnComponent( case "collectionDimension": getOrCreateConfiguration((PineconeVectorDbComponent) component).setCollectionDimension((java.lang.Integer) value); return true; case "collectionSimilarityMetric": getOrCreateConfiguration((PineconeVectorDbComponent) component).setCollectionSimilarityMetric((java.lang.String) value); return true; case "configuration": ((PineconeVectorDbComponent) component).setConfiguration((org.apache.camel.component.pinecone.PineconeVectorDbConfiguration) value); return true; + case "host": getOrCreateConfiguration((PineconeVectorDbComponent) component).setHost((java.lang.String) value); return true; case "indexName": getOrCreateConfiguration((PineconeVectorDbComponent) component).setIndexName((java.lang.String) value); return true; case "lazyStartProducer": ((PineconeVectorDbComponent) component).setLazyStartProducer((boolean) value); return true; case "proxyHost": getOrCreateConfiguration((PineconeVectorDbComponent) component).setProxyHost((java.lang.String) value); return true; diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PineconeVectorDbEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PineconeVectorDbEndpointBuilderFactory.java index 8ef9071c926da..e0530022e099d 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PineconeVectorDbEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PineconeVectorDbEndpointBuilderFactory.java @@ -77,6 +77,7 @@ default PineconeVectorDbEndpointBuilder cloudRegion(String cloudRegion) { * * The option is a: java.lang.Integer type. * + * Default: 1536 * Group: producer * * @param collectionDimension the value to set @@ -92,6 +93,7 @@ default PineconeVectorDbEndpointBuilder collectionDimension(Integer collectionDi * The option will be converted to a java.lang.Integer * type. * + * Default: 1536 * Group: producer * * @param collectionDimension the value to set @@ -116,6 +118,20 @@ default PineconeVectorDbEndpointBuilder collectionSimilarityMetric(String collec doSetProperty("collectionSimilarityMetric", collectionSimilarityMetric); return this; } + /** + * Sets a custom host URL to connect to. + * + * The option is a: java.lang.String type. + * + * Group: producer + * + * @param host the value to set + * @return the dsl builder + */ + default PineconeVectorDbEndpointBuilder host(String host) { + doSetProperty("host", host); + return this; + } /** * Sets the index name to use. *