附件#

class langsmith.schemas.Attachment(mime_type: str, data: bytes | Path)[source]#

注解类型,如果使用,将被存储为附件。

示例

from langsmith import traceable
from langsmith.schemas import Attachment


@traceable
def my_function(bar: int, my_val: Attachment):
    # my_val will be stored as an attachment
    # bar will be stored as inputs
    return bar

创建 Attachment(mime_type, data) 的新实例

属性

data

字段编号 1 的别名

mime_type

字段编号 0 的别名

方法

__init__()

count(value, /)

返回值的出现次数。

index(value[, start, stop])

返回值的首次出现的索引。

参数:
  • mime_type (str)

  • data (bytes | Path)

__init__()#
count(value, /)#

返回值的出现次数。

index(value, start=0, stop=9223372036854775807, /)#

返回值的首次出现的索引。

如果值不存在,则引发 ValueError。