shu/removeSettingsManager.get_settings (#1305)
This commit is contained in:
@@ -7,6 +7,7 @@ from typing import Any
|
||||
import litellm
|
||||
import structlog
|
||||
|
||||
from skyvern.config import settings
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.sdk.api.llm.config_registry import LLMConfigRegistry
|
||||
from skyvern.forge.sdk.api.llm.exceptions import (
|
||||
@@ -19,7 +20,6 @@ from skyvern.forge.sdk.api.llm.models import LLMAPIHandler, LLMConfig, LLMRouter
|
||||
from skyvern.forge.sdk.api.llm.utils import llm_messages_builder, parse_api_response
|
||||
from skyvern.forge.sdk.artifact.models import ArtifactType
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.settings_manager import SettingsManager
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
||||
@@ -50,7 +50,7 @@ class LLMAPIHandlerFactory:
|
||||
allowed_fails=llm_config.allowed_fails,
|
||||
allowed_fails_policy=llm_config.allowed_fails_policy,
|
||||
cooldown_time=llm_config.cooldown_time,
|
||||
set_verbose=(False if SettingsManager.get_settings().is_cloud_environment() else llm_config.set_verbose),
|
||||
set_verbose=(False if settings.is_cloud_environment() else llm_config.set_verbose),
|
||||
enable_pre_call_checks=True,
|
||||
)
|
||||
main_model_group = llm_config.main_model_group
|
||||
@@ -213,7 +213,7 @@ class LLMAPIHandlerFactory:
|
||||
response = await litellm.acompletion(
|
||||
model=llm_config.model_name,
|
||||
messages=messages,
|
||||
timeout=SettingsManager.get_settings().LLM_CONFIG_TIMEOUT,
|
||||
timeout=settings.LLM_CONFIG_TIMEOUT,
|
||||
**active_parameters,
|
||||
)
|
||||
LOG.info("LLM API call successful", llm_key=llm_key, model=llm_config.model_name)
|
||||
@@ -263,7 +263,7 @@ class LLMAPIHandlerFactory:
|
||||
def get_api_parameters(llm_config: LLMConfig | LLMRouterConfig) -> dict[str, Any]:
|
||||
return {
|
||||
"max_tokens": llm_config.max_output_tokens,
|
||||
"temperature": SettingsManager.get_settings().LLM_CONFIG_TEMPERATURE,
|
||||
"temperature": settings.LLM_CONFIG_TEMPERATURE,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import structlog
|
||||
|
||||
from skyvern.config import settings
|
||||
from skyvern.forge.sdk.api.llm.exceptions import (
|
||||
DuplicateLLMConfigError,
|
||||
InvalidLLMConfigError,
|
||||
@@ -7,7 +8,6 @@ from skyvern.forge.sdk.api.llm.exceptions import (
|
||||
NoProviderEnabledError,
|
||||
)
|
||||
from skyvern.forge.sdk.api.llm.models import LiteLLMParams, LLMConfig, LLMRouterConfig
|
||||
from skyvern.forge.sdk.settings_manager import SettingsManager
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
|
||||
@@ -46,17 +46,17 @@ class LLMConfigRegistry:
|
||||
# if none of the LLM providers are enabled, raise an error
|
||||
if not any(
|
||||
[
|
||||
SettingsManager.get_settings().ENABLE_OPENAI,
|
||||
SettingsManager.get_settings().ENABLE_ANTHROPIC,
|
||||
SettingsManager.get_settings().ENABLE_AZURE,
|
||||
SettingsManager.get_settings().ENABLE_AZURE_GPT4O_MINI,
|
||||
SettingsManager.get_settings().ENABLE_BEDROCK,
|
||||
settings.ENABLE_OPENAI,
|
||||
settings.ENABLE_ANTHROPIC,
|
||||
settings.ENABLE_AZURE,
|
||||
settings.ENABLE_AZURE_GPT4O_MINI,
|
||||
settings.ENABLE_BEDROCK,
|
||||
]
|
||||
):
|
||||
raise NoProviderEnabledError()
|
||||
|
||||
|
||||
if SettingsManager.get_settings().ENABLE_OPENAI:
|
||||
if settings.ENABLE_OPENAI:
|
||||
LLMConfigRegistry.register_config(
|
||||
"OPENAI_GPT4_TURBO",
|
||||
LLMConfig(
|
||||
@@ -103,7 +103,7 @@ if SettingsManager.get_settings().ENABLE_OPENAI:
|
||||
)
|
||||
|
||||
|
||||
if SettingsManager.get_settings().ENABLE_ANTHROPIC:
|
||||
if settings.ENABLE_ANTHROPIC:
|
||||
LLMConfigRegistry.register_config(
|
||||
"ANTHROPIC_CLAUDE3",
|
||||
LLMConfig(
|
||||
@@ -151,7 +151,7 @@ if SettingsManager.get_settings().ENABLE_ANTHROPIC:
|
||||
),
|
||||
)
|
||||
|
||||
if SettingsManager.get_settings().ENABLE_BEDROCK:
|
||||
if settings.ENABLE_BEDROCK:
|
||||
# Supported through AWS IAM authentication
|
||||
LLMConfigRegistry.register_config(
|
||||
"BEDROCK_ANTHROPIC_CLAUDE3_OPUS",
|
||||
@@ -209,11 +209,11 @@ if SettingsManager.get_settings().ENABLE_BEDROCK:
|
||||
)
|
||||
|
||||
|
||||
if SettingsManager.get_settings().ENABLE_AZURE:
|
||||
if settings.ENABLE_AZURE:
|
||||
LLMConfigRegistry.register_config(
|
||||
"AZURE_OPENAI",
|
||||
LLMConfig(
|
||||
f"azure/{SettingsManager.get_settings().AZURE_DEPLOYMENT}",
|
||||
f"azure/{settings.AZURE_DEPLOYMENT}",
|
||||
[
|
||||
"AZURE_DEPLOYMENT",
|
||||
"AZURE_API_KEY",
|
||||
@@ -225,11 +225,11 @@ if SettingsManager.get_settings().ENABLE_AZURE:
|
||||
),
|
||||
)
|
||||
|
||||
if SettingsManager.get_settings().ENABLE_AZURE_GPT4O_MINI:
|
||||
if settings.ENABLE_AZURE_GPT4O_MINI:
|
||||
LLMConfigRegistry.register_config(
|
||||
"AZURE_OPENAI_GPT4O_MINI",
|
||||
LLMConfig(
|
||||
f"azure/{SettingsManager.get_settings().AZURE_GPT4O_MINI_DEPLOYMENT}",
|
||||
f"azure/{settings.AZURE_GPT4O_MINI_DEPLOYMENT}",
|
||||
[
|
||||
"AZURE_GPT4O_MINI_DEPLOYMENT",
|
||||
"AZURE_GPT4O_MINI_API_KEY",
|
||||
@@ -237,9 +237,9 @@ if SettingsManager.get_settings().ENABLE_AZURE_GPT4O_MINI:
|
||||
"AZURE_GPT4O_MINI_API_VERSION",
|
||||
],
|
||||
litellm_params=LiteLLMParams(
|
||||
api_base=SettingsManager.get_settings().AZURE_GPT4O_MINI_API_BASE,
|
||||
api_key=SettingsManager.get_settings().AZURE_GPT4O_MINI_API_KEY,
|
||||
api_version=SettingsManager.get_settings().AZURE_GPT4O_MINI_API_VERSION,
|
||||
api_base=settings.AZURE_GPT4O_MINI_API_BASE,
|
||||
api_key=settings.AZURE_GPT4O_MINI_API_KEY,
|
||||
api_version=settings.AZURE_GPT4O_MINI_API_VERSION,
|
||||
model_info={"model_name": "azure/gpt-4o-mini"},
|
||||
),
|
||||
supports_vision=True,
|
||||
|
||||
Reference in New Issue
Block a user