Skip to content

Commit

Permalink
update pincone credentials provider
Browse files Browse the repository at this point in the history
  • Loading branch information
aarushik93 committed Oct 23, 2024
1 parent 477a730 commit 9470a9e
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions autogpt_platform/backend/backend/blocks/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@
from backend.data.block import Block, BlockCategory, BlockOutput, BlockSchema
from backend.data.model import CredentialsField, CredentialsMetaInput, SchemaField

PineconeCredentials = APIKeyCredentials
PineconeCredentialsInput = CredentialsMetaInput[
Literal["pinecone"],
Literal["api_key"],
]


def PineconeCredentialsField() -> PineconeCredentialsInput:
"""
Creates a Pinecone credentials input on a block.
"""
return CredentialsField(
provider="pinecone",
supported_credential_types={"api_key"},
description="The Pinecone integration can be used with an API Key.",
)

class PineconeInitBlock(Block):
class Input(BlockSchema):
credentials: CredentialsMetaInput[Literal["pinecone"], Literal["api_key"]] = (
CredentialsField(
provider="pinecone",
supported_credential_types={"api_key"},
description="The Pinecone integration can be used with "
"any API key with sufficient permissions for the blocks it is used on.",
)
)
credentials: PineconeCredentialsInput = PineconeCredentialsField()
index_name: str = SchemaField(description="Name of the Pinecone index")
dimension: int = SchemaField(
description="Dimension of the vectors", default=768
Expand Down Expand Up @@ -72,14 +82,7 @@ def run(

class PineconeQueryBlock(Block):
class Input(BlockSchema):
credentials: CredentialsMetaInput[Literal["pinecone"], Literal["api_key"]] = (
CredentialsField(
provider="pinecone",
supported_credential_types={"api_key"},
description="The Pinecone integration can be used with "
"any API key with sufficient permissions for the blocks it is used on.",
)
)
credentials: PineconeCredentialsInput = PineconeCredentialsField()
query_vector: list = SchemaField(description="Query vector")
namespace: str = SchemaField(
description="Namespace to query in Pinecone", default=""
Expand Down

0 comments on commit 9470a9e

Please sign in to comment.