Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bedrock integration #251

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions skyvern/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Settings(BaseSettings):
ENABLE_OPENAI: bool = True
ENABLE_ANTHROPIC: bool = False
ENABLE_AZURE: bool = False
ENABLE_BEDROCK: bool = False
# OPENAI
OPENAI_API_KEY: str | None = None
# ANTHROPIC
Expand Down
2 changes: 2 additions & 0 deletions skyvern/forge/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from skyvern.forge.sdk.artifact.manager import ArtifactManager
from skyvern.forge.sdk.artifact.storage.factory import StorageFactory
from skyvern.forge.sdk.db.client import AgentDB
from skyvern.forge.sdk.experimentation.providers import BaseExperimentationProvider, NoOpExperimentationProvider
from skyvern.forge.sdk.forge_log import setup_logger
from skyvern.forge.sdk.models import Organization
from skyvern.forge.sdk.schemas.tasks import Task
Expand All @@ -35,6 +36,7 @@
STORAGE = StorageFactory.get_storage()
ARTIFACT_MANAGER = ArtifactManager()
BROWSER_MANAGER = BrowserManager()
EXPERIMENTATION_PROVIDER: BaseExperimentationProvider = NoOpExperimentationProvider()
LLM_API_HANDLER = LLMAPIHandlerFactory.get_llm_api_handler(SettingsManager.get_settings().LLM_KEY)
WORKFLOW_CONTEXT_MANAGER = WorkflowContextManager()
WORKFLOW_SERVICE = WorkflowService()
Expand Down
24 changes: 23 additions & 1 deletion skyvern/forge/sdk/api/llm/config_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,29 @@ def get_config(cls, llm_key: str) -> LLMRouterConfig | LLMConfig:

if SettingsManager.get_settings().ENABLE_ANTHROPIC:
LLMConfigRegistry.register_config(
"ANTHROPIC_CLAUDE3", LLMConfig("anthropic/claude-3-opus-20240229", ["ANTHROPIC_API_KEY"], True)
"ANTHROPIC_CLAUDE3_OPUS", LLMConfig("anthropic/claude-3-opus-20240229", ["ANTHROPIC_API_KEY"], True)
)
LLMConfigRegistry.register_config(
"ANTHROPIC_CLAUDE3_SONNET", LLMConfig("anthropic/claude-3-sonnet-20240229", ["ANTHROPIC_API_KEY"], True)
)

if SettingsManager.get_settings().ENABLE_BEDROCK:
# Supported through AWS IAM authentication
LLMConfigRegistry.register_config(
"BEDROCK_ANTHROPIC_CLAUDE3_OPUS",
LLMConfig(
"bedrock/anthropic.claude-3-opus-20240229-v1:0",
["AWS_REGION"],
True,
),
)
LLMConfigRegistry.register_config(
"BEDROCK_ANTHROPIC_CLAUDE3_SONNET",
LLMConfig(
"bedrock/anthropic.claude-3-sonnet-20240229-v1:0",
["AWS_REGION"],
True,
),
)

if SettingsManager.get_settings().ENABLE_AZURE:
Expand Down
2 changes: 1 addition & 1 deletion skyvern/forge/sdk/api/llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LLMRouterConfig(LLMConfig):
"usage-based-routing-v2",
"latency-based-routing",
] = "usage-based-routing"
num_retries: int = 2
num_retries: int = 1
retry_delay_seconds: int = 15
set_verbose: bool = False

Expand Down
Empty file.
16 changes: 16 additions & 0 deletions skyvern/forge/sdk/experimentation/providers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from abc import ABC, abstractmethod

import structlog

LOG = structlog.get_logger()


class BaseExperimentationProvider(ABC):
@abstractmethod
def is_feature_enabled(self, feature_name: str, distinct_id: str) -> bool:
"""Check if a specific feature is enabled."""


class NoOpExperimentationProvider(BaseExperimentationProvider):
def is_feature_enabled(self, feature_name: str, distinct_id: str) -> bool:
return False
Loading