Merge remote-tracking branch 'origin/new_chat_template_args' into new_chat_template_args

This commit is contained in:
Matt 2024-05-29 18:12:52 +01:00
commit 4918868afb
1 changed files with 8 additions and 12 deletions

View File

@ -34,18 +34,14 @@ returns_re = re.compile(r"\n\s*Returns:\n\s*(.*?)[\n\s]*(Raises:|\Z)", re.DOTALL
def _get_json_schema_type(param_type):
if param_type == int:
return {"type": "integer"}
elif param_type == float:
return {"type": "number"}
elif param_type == str:
return {"type": "string"}
elif param_type == bool:
return {"type": "boolean"}
elif param_type == Any:
return {}
else:
return {"type": "object"}
type_mapping = {
int: {"type": "integer"},
float: {"type": "number"},
str: {"type": "string"},
bool: {"type": "boolean"},
Any: {},
}
return type_mapping.get(param_type, {"type": "object"})
def _parse_type_hint(hint):