Json 架构
convert_json_schema_to_str(json_schema)
将JSON模式转换为字符串。
参数:
| 名称 | 类型 | 描述 | 默认值 |
|---|---|---|---|
json_schema
|
Union[dict, str, Type[BaseModel]]
|
The JSON schema. |
required |
返回:
| 类型 | 描述 |
|---|---|
str
|
转换为字符串的JSON模式。 |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
如果模式不是字典、字符串或 Pydantic 类。 |
Source code in outlines/fsm/json_schema.py
get_schema_from_signature(fn)
将函数签名转换为JSON架构。
每个有效的 JSON 对象都可以传递给 fn 使用 ** 解包语法。