set a DEFAULT_TEXT_PROMPT_LLM_KEY if TextPromptBlock.llm_key is not passed to backend (#1280)

This commit is contained in:
Shuchang Zheng 2024-11-27 16:41:52 -08:00 committed by GitHub
parent eec7e7c40c
commit a8dfc51b5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from typing import Annotated, Any, Literal
from pydantic import BaseModel, Field
from skyvern.config import settings
from skyvern.forge.sdk.schemas.tasks import ProxyLocation
from skyvern.forge.sdk.workflow.models.block import BlockType, FileType
from skyvern.forge.sdk.workflow.models.parameter import ParameterType, WorkflowParameterType
@ -154,6 +155,9 @@ class CodeBlockYAML(BlockYAML):
parameter_keys: list[str] | None = None
DEFAULT_TEXT_PROMPT_LLM_KEY = settings.SECONDARY_LLM_KEY or settings.LLM_KEY
class TextPromptBlockYAML(BlockYAML):
# There is a mypy bug with Literal. Without the type: ignore, mypy will raise an error:
# Parameter 1 of Literal[...] cannot be of type "Any"
@ -161,7 +165,7 @@ class TextPromptBlockYAML(BlockYAML):
# to infer the type of the parameter_type attribute.
block_type: Literal[BlockType.TEXT_PROMPT] = BlockType.TEXT_PROMPT # type: ignore
llm_key: str
llm_key: str = DEFAULT_TEXT_PROMPT_LLM_KEY
prompt: str
parameter_keys: list[str] | None = None
json_schema: dict[str, Any] | None = None