tightening
This commit is contained in:
+3
-20
@@ -88,22 +88,6 @@ def _render_prompt_markdown(content: str, arguments: dict[str, Any]) -> str:
|
||||
return rendered
|
||||
|
||||
|
||||
def _python_type(prompt_arg_type: str) -> type[Any]:
|
||||
if prompt_arg_type == "string":
|
||||
return str
|
||||
if prompt_arg_type == "number":
|
||||
return float
|
||||
if prompt_arg_type == "integer":
|
||||
return int
|
||||
if prompt_arg_type == "boolean":
|
||||
return bool
|
||||
if prompt_arg_type == "array":
|
||||
return list
|
||||
if prompt_arg_type == "object":
|
||||
return dict
|
||||
return str
|
||||
|
||||
|
||||
def _make_prompt_handler(content: str):
|
||||
def prompt_handler(**kwargs: Any) -> str:
|
||||
return _render_prompt_markdown(content, kwargs)
|
||||
@@ -118,15 +102,14 @@ def _register_prompt_objects() -> None:
|
||||
params: list[Parameter] = []
|
||||
|
||||
for arg_name, arg in sorted(prompt.arguments.items()):
|
||||
arg_type = _python_type(arg.type)
|
||||
annotations[arg_name] = arg_type
|
||||
default = Parameter.empty if arg.required else arg.default
|
||||
annotations[arg_name] = str
|
||||
default = Parameter.empty if arg.required else None
|
||||
params.append(
|
||||
Parameter(
|
||||
arg_name,
|
||||
kind=Parameter.KEYWORD_ONLY,
|
||||
default=default,
|
||||
annotation=arg_type,
|
||||
annotation=str,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user