Skip to content

Commit

Permalink
feat(blocks/jina): Add default credentials for Jina (#8603)
Browse files Browse the repository at this point in the history
add jina defaults
  • Loading branch information
aarushik93 authored Nov 10, 2024
1 parent f981a74 commit e6e4737
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@
title="Use Credits for D-ID",
expires_at=None,
)
jina_credentials = APIKeyCredentials(
id="7f26de70-ba0d-494e-ba76-238e65e7b45f",
provider="jina",
api_key=SecretStr(settings.secrets.jina_api_key),
title="Use Credits for Jina",
expires_at=None,
)


DEFAULT_CREDENTIALS = [
revid_credentials,
Expand All @@ -81,6 +89,7 @@
anthropic_credentials,
groq_credentials,
did_credentials,
jina_credentials,
]


Expand Down Expand Up @@ -124,6 +133,8 @@ def get_all_creds(self, user_id: str) -> list[Credentials]:
all_credentials.append(anthropic_credentials)
if settings.secrets.did_api_key:
all_credentials.append(did_credentials)
if settings.secrets.jina_api_key:
all_credentials.append(jina_credentials)
return all_credentials

def get_creds_by_id(self, user_id: str, credentials_id: str) -> Credentials | None:
Expand Down
14 changes: 13 additions & 1 deletion autogpt_platform/backend/backend/data/credit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
did_credentials,
groq_credentials,
ideogram_credentials,
jina_credentials,
openai_credentials,
replicate_credentials,
revid_credentials,
Expand Down Expand Up @@ -144,7 +145,18 @@ def __init__(
},
)
],
SearchTheWebBlock: [BlockCost(cost_amount=1)],
SearchTheWebBlock: [
BlockCost(
cost_amount=1,
cost_filter={
"credentials": {
"id": jina_credentials.id,
"provider": jina_credentials.provider,
"type": jina_credentials.type,
}
},
)
],
ExtractWebsiteContentBlock: [
BlockCost(cost_amount=1, cost_filter={"raw_content": False})
],
Expand Down
1 change: 1 addition & 0 deletions autogpt_platform/backend/backend/util/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class Secrets(UpdateTrackingModel["Secrets"], BaseSettings):
replicate_api_key: str = Field(default="", description="Replicate API Key")
unreal_speech_api_key: str = Field(default="", description="Unreal Speech API Key")
ideogram_api_key: str = Field(default="", description="Ideogram API Key")
jina_api_key: str = Field(default="", description="Jina API Key")

# Add more secret fields as needed

Expand Down

0 comments on commit e6e4737

Please sign in to comment.