Attachment#

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

Annotated type that will be stored as an attachment if used.

Examples

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

Create new instance of Attachment(mime_type, data)

Attributes

data

Alias for field number 1

mime_type

Alias for field number 0

Methods

__init__()

count(value, /)

Return number of occurrences of value.

index(value[, start, stop])

Return first index of value.

Parameters:
  • mime_type (str)

  • data (bytes | Path)

__init__()#
count(value, /)#

Return number of occurrences of value.

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

Return first index of value.

Raises ValueError if the value is not present.