Skip to content

Commit 1e67471

Browse files
monikakusterivicac
authored andcommitted
1344 - Refactor
1 parent 2099473 commit 1e67471

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

server/libs/modules/components/ai/vector-store/pinecone/src/main/java/com/bytechef/component/ai/vectorstore/pinecone/action/PineconeDataQueryAction.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
package com.bytechef.component.ai.vectorstore.pinecone.action;
1818

19+
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.DATA_QUERY;
20+
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.EMBEDDING_API_KEY;
1921
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.QUERY;
2022
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.API_KEY;
21-
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.EMBEDDING_API_KEY;
2223
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.ENVIRONMENT;
2324
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.INDEX_NAME;
2425
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.PROJECT_ID;
@@ -38,9 +39,9 @@
3839
*/
3940
public class PineconeDataQueryAction {
4041

41-
public static final ModifiableActionDefinition ACTION_DEFINITION = action("dataQuery")
42+
public static final ModifiableActionDefinition ACTION_DEFINITION = action(DATA_QUERY)
4243
.title("Data Query")
43-
.description("Loads data into a Pinecone vector store using OpenAI embeddings.")
44+
.description("Query data from a Pinecone vector store using OpenAI embeddings.")
4445
.properties(
4546
string(QUERY)
4647
.label("Query")

server/libs/modules/components/ai/vector-store/pinecone/src/main/java/com/bytechef/component/ai/vectorstore/pinecone/action/PineconeLoadDataAction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818

1919
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.DOCUMENT_PROPERTY;
2020
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.DOCUMENT_TYPE_PROPERTY;
21+
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.EMBEDDING_API_KEY;
2122
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.JSON_KEYS_TO_USE_PROPERTY;
23+
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.LOAD_DATA;
2224
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.API_KEY;
23-
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.EMBEDDING_API_KEY;
2425
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.ENVIRONMENT;
2526
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.INDEX_NAME;
2627
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.PROJECT_ID;
@@ -40,7 +41,7 @@
4041
*/
4142
public class PineconeLoadDataAction {
4243

43-
public static final ModifiableActionDefinition ACTION_DEFINITION = action("loadData")
44+
public static final ModifiableActionDefinition ACTION_DEFINITION = action(LOAD_DATA)
4445
.title("Load Data")
4546
.description("Loads data into a Pinecone vector store using OpenAI embeddings.")
4647
.properties(

server/libs/modules/components/ai/vector-store/pinecone/src/main/java/com/bytechef/component/ai/vectorstore/pinecone/connection/PineconeConnection.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package com.bytechef.component.ai.vectorstore.pinecone.connection;
1818

19+
import static com.bytechef.component.ai.vectorstore.constant.VectorStoreConstants.EMBEDDING_API_KEY_PROPERTY;
1920
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.API_KEY;
20-
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.EMBEDDING_API_KEY;
2121
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.ENVIRONMENT;
2222
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.INDEX_NAME;
2323
import static com.bytechef.component.ai.vectorstore.pinecone.constant.PineconeConstants.PROJECT_ID;
@@ -37,10 +37,7 @@ public class PineconeConnection {
3737
.authorizations(
3838
authorization(CUSTOM)
3939
.properties(
40-
string(EMBEDDING_API_KEY)
41-
.label("Open AI API Key")
42-
.description("The API key for the OpenAI API which is used to generate embeddings.")
43-
.required(true),
40+
EMBEDDING_API_KEY_PROPERTY,
4441
string(API_KEY)
4542
.label("Pinecone API Key")
4643
.description("The API key for the Pinecone API.")

server/libs/modules/components/ai/vector-store/pinecone/src/main/java/com/bytechef/component/ai/vectorstore/pinecone/constant/PineconeConstants.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ private PineconeConstants() {
2525
}
2626

2727
public static final String API_KEY = "apiKey";
28-
public static final String EMBEDDING_API_KEY = "embeddingApiKey";
2928
public static final String ENVIRONMENT = "environment";
3029
public static final String INDEX_NAME = "indexName";
3130
public static final String PROJECT_ID = "projectId";

server/libs/modules/components/ai/vector-store/src/main/java/com/bytechef/component/ai/vectorstore/constant/VectorStoreConstants.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@
3030
*/
3131
public class VectorStoreConstants {
3232

33+
public static final String DATA_QUERY = "dataQuery";
3334
public static final String DOCUMENT = "document";
3435
public static final String DOCUMENT_TYPE = "documentType";
36+
public static final String EMBEDDING_API_KEY = "embeddingApiKey";
3537
public static final String JSON = "json";
3638
public static final String JSON_KEYS_TO_USE = "jsonKeysToUse";
39+
public static final String LOAD_DATA = "loadData";
3740
public static final String MD = "md";
3841
public static final String PDF = "pdf";
3942
public static final String TIKA = "tika";
@@ -54,6 +57,11 @@ public class VectorStoreConstants {
5457
option("Tika (DOCX, PPTX, HTML...)", TIKA))
5558
.required(true);
5659

60+
public static final ModifiableStringProperty EMBEDDING_API_KEY_PROPERTY = string(EMBEDDING_API_KEY)
61+
.label("Open AI API Key")
62+
.description("The API key for the OpenAI API which is used to generate embeddings.")
63+
.required(true);
64+
5765
public static final ModifiableArrayProperty JSON_KEYS_TO_USE_PROPERTY = array(JSON_KEYS_TO_USE)
5866
.label("JSON Keys to Use")
5967
.description(

0 commit comments

Comments
 (0)