dspy.Signature
dspy.Signature
基类: BaseModel
函数
append(name, field, type_=None) -> type[Signature]
classmethod
delete(name) -> type[Signature]
classmethod
dump_state()
classmethod
Source code in dspy/signatures/signature.py
equals(other) -> bool
classmethod
比较两个Signature类的JSON模式。
Source code in dspy/signatures/signature.py
insert(index: int, name: str, field, type_: type | None = None) -> type[Signature]
classmethod
Source code in dspy/signatures/signature.py
load_state(state)
classmethod
Source code in dspy/signatures/signature.py
prepend(name, field, type_=None) -> type[Signature]
classmethod
with_instructions(instructions: str) -> type[Signature]
classmethod
with_updated_fields(name: str, type_: type | None = None, **kwargs: dict[str, Any]) -> type[Signature]
classmethod
使用更新后的字段信息创建一个新的签名类。
返回一个新的签名类,其中字段名称已更新,使用 fields[name].json_schema_extra[key] = value。
参数:
| 名称 | 类型 | 描述 | 默认值 |
|---|---|---|---|
name
|
str
|
要更新的字段名称。 |
必填 |
type_
|
type | None
|
字段的新类型。 |
None
|
kwargs
|
dict[str, Any]
|
字段的新值。 |
{}
|
返回:
| 类型 | 描述 |
|---|---|
type[Signature]
|
一个带有更新字段信息的新Signature类(不是实例)。 |
Source code in dspy/signatures/signature.py
:::