> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-run-filter-ui-updates.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# weave

> Weave용 Python SDK 레퍼런스

export const SourceLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="source-link">
    출처
  </a>;

<div id="api-overview">
  # API Overview
</div>

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/agent/agent.py#L17" />

## <kbd>class</kbd> `Agent`

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `model_name`: `<class 'str'>`
* `temperature`: `<class 'float'>`
* `system_message`: `<class 'str'>`
* `tools`: `list[typing.Any]`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L23" />

### <kbd>방법</kbd> `step`

```python theme={null}
step(state: AgentState) → AgentState
```

에이전트의 step을 수행합니다.

**매개변수:**

* <b>`state`</b>: 환경의 현재 상태입니다.
* <b>`action`</b>: 수행할 동작입니다.
  **반환값:**
  환경의 새 상태입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/agent/agent.py#L12" />

## <kbd>class</kbd> `AgentState`

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `history`: `list[typing.Any]`

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace_server/interface/builtin_object_classes/annotation_spec.py#L12" />

## <kbd>class</kbd> `AnnotationSpec`

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `field_schema`: `dict[str, typing.Any]`
* `unique_among_creators`: `<class 'bool'>`
* `op_scope`: `list[str] | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace_server/interface/builtin_object_classes/annotation_spec.py#L47" />

### <kbd>클래스 메서드</kbd> `preprocess_field_schema`

```python theme={null}
preprocess_field_schema(data: dict[str, Any]) → dict[str, Any]
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace_server/interface/builtin_object_classes/annotation_spec.py#L92" />

### <kbd>클래스 메서드</kbd> `validate_field_schema`

```python theme={null}
validate_field_schema(schema: dict[str, Any]) → dict[str, Any]
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace_server/interface/builtin_object_classes/annotation_spec.py#L103" />

### <kbd>방법</kbd> `value_is_valid`

```python theme={null}
value_is_valid(payload: Any) → bool
```

페이로드가 이 annotation spec의 스키마에 맞는지 검증합니다.

**매개변수:**

* <b>`payload`</b>: 스키마를 기준으로 검증할 데이터
  **반환값:**

* <b>`bool`</b>: 검증에 성공하면 True, 그렇지 않으면 False

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/Audio/audio.py#L81" />

## <kbd>class</kbd> `Audio`

지원되는 형식(wav 또는 mp3)의 오디오 데이터를 나타내는 클래스입니다.

이 클래스는 오디오 데이터 저장소를 관리하며, 다양한 소스에서 데이터를 로드하고 파일로 내보내는 방법을 제공합니다.

**속성:**

* <b>`format`</b>:  오디오 형식(현재 'wav' 또는 'mp3' 지원)
* <b>`data`</b>:  바이트 형식의 원시 오디오 데이터

**매개변수:**

* <b>`data`</b>: 오디오 데이터(바이트 또는 base64로 인코딩된 문자열)

* <b>`format`</b>: 오디오 형식('wav' 또는 'mp3')

* <b>`validate_base64`</b>: 입력 데이터에 대해 base64 디코딩을 시도할지 여부
  **예외:**

* <b>`ValueError`</b>:  오디오 데이터가 비어 있거나 형식이 지원되지 않는 경우

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/Audio/audio.py#L106" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(
    data: 'bytes',
    format: 'SUPPORTED_FORMATS_TYPE',
    validate_base64: 'bool' = True
) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/Audio/audio.py#L174" />

### <kbd>방법</kbd> `export`

```python theme={null}
export(path: 'str | bytes | Path | PathLike') → None
```

오디오 데이터를 파일로 저장합니다.

**매개변수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/Audio/audio.py#L121" />

### <kbd>클래스 메서드</kbd> `from_data`

```python theme={null}
from_data(data: 'str | bytes', format: 'str') → Self
```

원시 데이터와 지정한 형식으로 Audio 객체를 생성합니다.

* <b>`path`</b>: 오디오 파일을 저장할 경로
  **매개변수:**

* <b>`data`</b>: 바이트 또는 base64로 인코딩된 문자열 형태의 오디오 데이터

* <b>`format`</b>: 오디오 형식 ('wav' 또는 'mp3')
  **반환값:**

* <b>`Audio`</b>:  새로운 Audio 인스턴스

**예외:**

* <b>`ValueError`</b>:  형식이 지원되지 않는 경우

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/Audio/audio.py#L146" />

### <kbd>클래스 메서드</kbd> `from_path`

```python theme={null}
from_path(path: 'str | bytes | Path | PathLike') → Self
```

파일 경로로부터 Audio 객체를 생성합니다.

**매개변수:**

* <b>`path`</b>: `.wav` 또는 `.mp3` 확장자를 가진 오디오 파일 경로
  **반환값:**

* <b>`Audio`</b>: 파일에서 로드된 새 Audio 인스턴스

**예외:**

* <b>`ValueError`</b>: 파일이 존재하지 않거나 지원하지 않는 확장자인 경우

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L42" />

## <kbd>class</kbd> `Content`

다양한 소스의 콘텐츠를 나타내며, 이를 관련 메타데이터와 함께 바이트 기반의 통합 표현으로 변환하는 클래스입니다.

이 클래스는 다음 클래스 메서드 중 하나를 사용해 인스턴스화해야 합니다.

* from\_path()
* from\_bytes()
* from\_text()
* from\_url()
* from\_base64()
* from\_data\_url()

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L87" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(*args: 'Any', **kwargs: 'Any') → None
```

직접 초기화는 지원되지 않습니다. 인스턴스를 생성하려면 `Content.from_path()`와 같은 클래스 메서드를 사용하세요.

**Pydantic 필드:**

* `data`: `<class 'bytes'>`
* `size`: `<class 'int'>`
* `mimetype`: `<class 'str'>`
* `digest`: `<class 'str'>`
* `filename`: `<class 'str'>`
* `content_type`: `typing.Literal['bytes', 'text', 'base64', 'file', 'url', 'data_url', 'data_url:base64', 'data_url:encoding', 'data_url:encoding:base64']`
* `input_type`: `<class 'str'>`
* `encoding`: `<class 'str'>`
* `metadata`: `dict[str, typing.Any] | None`
* `extension`: `str | None`

***

#### <kbd>속성</kbd> art

#### <kbd>속성</kbd> ref

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L543" />

### <kbd>방법</kbd> `as_string`

```python theme={null}
as_string() → str
```

데이터를 문자열로 표시합니다. 바이트는 `encoding` 속성을 사용해 디코딩합니다. base64인 경우, 데이터를 먼저 base64 바이트로 다시 인코딩한 다음 ASCII 문자열로 디코딩합니다.

**반환값:**
str.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L258" />

### <kbd>클래스 메서드</kbd> `from_base64`

```python theme={null}
from_base64(
    b64_data: 'str | bytes',
    extension: 'str | None' = None,
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None
) → Self
```

base64로 인코딩된 문자열 또는 바이트에서 Content를 초기화합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L168" />

### <kbd>클래스 메서드</kbd> `from_bytes`

```python theme={null}
from_bytes(
    data: 'bytes',
    extension: 'str | None' = None,
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None,
    encoding: 'str' = 'utf-8'
) → Self
```

원시 바이트 데이터로부터 Content를 초기화합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L357" />

### <kbd>클래스 메서드</kbd> `from_data_url`

```python theme={null}
from_data_url(url: 'str', metadata: 'dict[str, Any] | None' = None) → Self
```

데이터 URL로부터 Content를 초기화합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L309" />

### <kbd>클래스 메서드</kbd> `from_path`

```python theme={null}
from_path(
    path: 'str | Path',
    encoding: 'str' = 'utf-8',
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None
) → Self
```

로컬 파일 경로를 사용해 Content를 초기화합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L209" />

### <kbd>클래스 메서드</kbd> `from_text`

```python theme={null}
from_text(
    text: 'str',
    extension: 'str | None' = None,
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None,
    encoding: 'str' = 'utf-8'
) → Self
```

텍스트 문자열에서 Content를 초기화합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L399" />

### <kbd>클래스 메서드</kbd> `from_url`

```python theme={null}
from_url(
    url: 'str',
    headers: 'dict[str, Any] | None' = None,
    timeout: 'int | None' = 30,
    metadata: 'dict[str, Any] | None' = None
) → Self
```

HTTP(S) URL에서 바이트를 가져와 Content를 초기화합니다.

콘텐츠를 다운로드하고, 헤더, URL 경로, 데이터로부터 MIME 유형/확장자를 추론한 뒤, 결과 바이트로 Content 객체를 생성합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L97" />

### <kbd>클래스 메서드</kbd> `model_validate`

```python theme={null}
model_validate(
    obj: 'Any',
    strict: 'bool | None' = None,
    from_attributes: 'bool | None' = None,
    context: 'dict[str, Any] | None' = None,
    extra: 'str | None' = None,
    by_alias: 'bool | None' = None,
    by_name: 'bool | None' = None
) → Self
```

dict에서 Content를 재구성하는 작업을 처리하도록 model\_validate를 재정의합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L148" />

### <kbd>클래스 메서드</kbd> `model_validate_json`

```python theme={null}
model_validate_json(
    json_data: 'str | bytes | bytearray',
    strict: 'bool | None' = None,
    context: 'dict[str, Any] | None' = None,
    extra: 'str | None' = None,
    by_alias: 'bool | None' = None,
    by_name: 'bool | None' = None
) → Self
```

JSON에서 Content를 재구성할 수 있도록 model\_validate\_json을 재정의합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L553" />

### <kbd>방법</kbd> `open`

```python theme={null}
open() → bool
```

운영 체제의 기본 애플리케이션을 사용하여 파일을 엽니다.

이 방법은 파일 유형과 연결된 기본 애플리케이션으로 파일을 열기 위해 플랫폼별 메커니즘을 사용합니다.

**반환값:**

* <b>`bool`</b>: 파일을 성공적으로 열었으면 True, 그렇지 않으면 False입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L583" />

### <kbd>방법</kbd> `save`

```python theme={null}
save(dest: 'str | Path') → None
```

파일을 지정된 대상 경로로 복사합니다. 마지막으로 저장된 복사본을 기준으로 콘텐츠의 파일명과 경로를 업데이트합니다.

**매개변수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L535" />

### <kbd>방법</kbd> `serialize_data`

```python theme={null}
serialize_data(data: 'bytes') → str
```

모델을 JSON 모드로 덤프할 때

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_wrappers/Content/content.py#L510" />

### <kbd>방법</kbd> `to_data_url`

```python theme={null}
to_data_url(use_base64: 'bool' = True) → str
```

콘텐츠에서 데이터 URL을 생성합니다.

* <b>`dest`</b>: 파일이 복사될 대상 경로입니다(string 또는 pathlib.Path). 대상 경로는 파일 또는 디렉터리일 수 있습니다. `dest`에 파일 확장자(예: `.txt`)가 없으면 대상 경로는 디렉터리로 간주됩니다.
  **매개변수:**

* <b>`use_base64`</b>: True이면 데이터는 base64로 인코딩됩니다. 그렇지 않으면 퍼센트 인코딩됩니다. 기본값은 True입니다.
  **반환값:**
  데이터 URL 문자열입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L26" />

## <kbd>class</kbd> `Dataset`

손쉽게 저장할 수 있고 자동 버전 관리를 지원하는 데이터셋 객체입니다.

**예시:**

```python theme={null}
# 데이터셋 생성
dataset = Dataset(name='grammar', rows=[
     {'id': '0', 'sentence': "He no likes ice cream.", 'correction': "He doesn't like ice cream."},
     {'id': '1', 'sentence': "She goed to the store.", 'correction': "She went to the store."},
     {'id': '2', 'sentence': "They plays video games all day.", 'correction': "They play video games all day."}
])

# 데이터셋 게시
weave.publish(dataset)

# 데이터셋 조회
dataset_ref = weave.ref('grammar').get()

# 특정 예시 액세스
example_label = dataset_ref.rows[2]['sentence']
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `rows`: `trace.table.Table | trace.vals.WeaveTable`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L129" />

### <kbd>방법</kbd> `add_rows`

```python theme={null}
add_rows(rows: Iterable[dict]) → Dataset
```

기존 데이터셋에 행을 덧붙여 새 데이터셋 버전을 만듭니다.

이 방법은 전체 데이터셋을 메모리에 로드하지 않고도 대규모 데이터셋에 예제를 추가할 때 유용합니다.

**매개변수:**

* <b>`rows`</b>: 데이터셋에 추가할 행입니다.
  **반환값:**
  업데이트된 데이터셋입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L173" />

### <kbd>클래스 메서드</kbd> `convert_to_table`

```python theme={null}
convert_to_table(rows: Any) → Table | WeaveTable
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L61" />

### <kbd>클래스 메서드</kbd> `from_calls`

```python theme={null}
from_calls(calls: Iterable[Call]) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L71" />

### <kbd>클래스 메서드</kbd> `from_hf`

```python theme={null}
from_hf(
    hf_dataset: Union[ForwardRef('HFDataset'), ForwardRef('HFDatasetDict')]
) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L52" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L66" />

### <kbd>클래스 메서드</kbd> `from_pandas`

```python theme={null}
from_pandas(df: 'DataFrame') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L220" />

### <kbd>방법</kbd> `select`

```python theme={null}
select(indices: Iterable[int]) → Self
```

제공된 인덱스를 기준으로 데이터셋에서 행을 선택합니다.

**매개변수:**

* <b>`indices`</b>: 선택할 행을 지정하는 정수 인덱스의 이터러블입니다.
  **반환값:**
  선택한 행만 포함하는 새 Dataset 객체입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L115" />

### <kbd>방법</kbd> `to_hf`

```python theme={null}
to_hf() → HFDataset
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/dataset/dataset.py#L107" />

### <kbd>방법</kbd> `to_pandas`

```python theme={null}
to_pandas() → DataFrame
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L192" />

## <kbd>class</kbd> `EasyPrompt`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L200" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(
    content: str | dict | list | None = None,
    role: str | None = None,
    dedent: bool = False,
    **kwargs: Any
) → None
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `data`: `<class 'list'>`
* `config`: `<class 'dict'>`
* `requirements`: `<class 'dict'>`

***

#### <kbd>속성</kbd> as\_str

모든 메시지를 하나의 문자열로 합쳐 반환합니다.

***

#### <kbd>속성</kbd> is\_bound

***

#### <kbd>속성</kbd> 메시지

#### <kbd>속성</kbd> 플레이스홀더

***

#### <kbd>속성</kbd> system\_message

모든 메시지를 합쳐 하나의 system prompt 메시지로 만듭니다.

***

#### <kbd>속성</kbd> system\_prompt

모든 메시지를 시스템 프롬프트 객체로 합칩니다.

***

#### <kbd>속성</kbd> unbound\_placeholders

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L230" />

### <kbd>방법</kbd> `append`

```python theme={null}
append(item: Any, role: str | None = None, dedent: bool = False) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L489" />

### <kbd>방법</kbd> `as_dict`

```python theme={null}
as_dict() → dict[str, Any]
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L486" />

### <kbd>방법</kbd> `as_pydantic_dict`

```python theme={null}
as_pydantic_dict() → dict[str, Any]
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L321" />

### <kbd>방법</kbd> `bind`

```python theme={null}
bind(*args: Any, **kwargs: Any) → Prompt
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L341" />

### <kbd>방법</kbd> `bind_rows`

```python theme={null}
bind_rows(dataset: list[dict] | Any) → list['Prompt']
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L447" />

### <kbd>방법</kbd> `config_table`

```python theme={null}
config_table(title: str | None = None) → Table
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L411" />

### <kbd>방법</kbd> `configure`

```python theme={null}
configure(config: dict | None = None, **kwargs: Any) → Prompt
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L527" />

### <kbd>방법</kbd> `dump`

```python theme={null}
dump(fp: <class 'IO'>) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L530" />

### <kbd>방법</kbd> `dump_file`

```python theme={null}
dump_file(filepath: str | Path) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L84" />

### <kbd>방법</kbd> `format`

```python theme={null}
format(**kwargs: Any) → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L496" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L511" />

### <kbd>클래스 메서드</kbd> `load`

```python theme={null}
load(fp: <class 'IO'>) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L521" />

### <kbd>클래스 메서드</kbd> `load_file`

```python theme={null}
load_file(filepath: str | Path) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L427" />

### <kbd>방법</kbd> `messages_table`

```python theme={null}
messages_table(title: str | None = None) → Table
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L455" />

### <kbd>방법</kbd> `print`

```python theme={null}
print() → str
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L417" />

### <kbd>방법</kbd> `publish`

```python theme={null}
publish(
    name: str | None = None,
    tags: list[str] | None = None,
    aliases: list[str] | None = None
) → ObjectRef
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L407" />

### <kbd>방법</kbd> `require`

```python theme={null}
require(param_name: str, **kwargs: Any) → Prompt
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L540" />

### <kbd>방법</kbd> `run`

```python theme={null}
run() → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L298" />

### <kbd>방법</kbd> `validate_requirement`

```python theme={null}
validate_requirement(key: str, value: Any) → list
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L315" />

### <kbd>방법</kbd> `validate_requirements`

```python theme={null}
validate_requirements(values: dict[str, Any]) → list
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L439" />

### <kbd>방법</kbd> `values_table`

```python theme={null}
values_table(title: str | None = None) → Table
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L61" />

## <kbd>class</kbd> `Evaluation`

scorer 집합과 데이터셋을 포함하는 Evaluation을 설정합니다.

평가.evaluate(model)을 호출하면 데이터셋의 각 행이 모델에 전달되며, 이때 데이터셋의 column 이름이 model.predict의 argument 이름과 일치하도록 매핑됩니다.

그런 다음 모든 scorer를 호출하고 결과를 Weave에 저장합니다.

데이터셋의 행을 전처리하려면 preprocess\_model\_input에 함수를 전달할 수 있습니다.

**예시:**

```python theme={null}
# 예시 데이터 수집
examples = [
     {"question": "What is the capital of France?", "expected": "Paris"},
     {"question": "Who wrote 'To Kill a Mockingbird'?", "expected": "Harper Lee"},
     {"question": "What is the square root of 64?", "expected": "8"},
]

# 맞춤형 scoring 함수 정의
@weave.op
def match_score1(expected: str, model_output: dict) -> dict:
     # 모델 출력을 채점하는 로직을 여기에 정의합니다
     return {'match': expected == model_output['generated_text']}

@weave.op
def function_to_evaluate(question: str):
     # LLM 호출을 추가하고 출력을 반환하는 부분입니다
     return  {'generated_text': 'Paris'}

# scoring 함수를 사용하여 예시 채점
evaluation = Evaluation(
     dataset=examples, scorers=[match_score1]
)

# 평가 tracking 시작
weave.init('intro-example')
# 평가 실행
asyncio.run(evaluation.evaluate(function_to_evaluate))
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `dataset`: `<class 'dataset.dataset.Dataset'>`
* `scorers`: `list[typing.Annotated[trace.op_protocol.Op | flow.scorer.Scorer, BeforeValidator(func=<function cast_to_scorer at 0x7f97165532e0>, json_schema_input_type=PydanticUndefined)]] | None`
* `preprocess_model_input`: `collections.abc.Callable[[dict], dict] | None`
* `trials`: `<class 'int'>`
* `metadata`: `dict[str, typing.Any] | None`
* `evaluation_name`: `str | collections.abc.Callable[trace.call.Call, str] | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L295" />

### <kbd>방법</kbd> `evaluate`

```python theme={null}
evaluate(model: Op | Model) → dict
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L119" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L243" />

### <kbd>방법</kbd> `get_eval_results`

```python theme={null}
get_eval_results(model: Op | Model) → EvaluationResults
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L306" />

### <kbd>방법</kbd> `get_evaluate_calls`

```python theme={null}
get_evaluate_calls() → PaginatedIterator[CallSchema, WeaveObject]
```

이 Evaluation 객체를 사용한 모든 평가 call을 조회합니다.

단일 평가에 대해 여러 평가 call이 있을 수 있으므로(예: 동일한 평가을 여러 번 run한 경우), 단일 Call이 아니라 CallsIter를 반환합니다.

**반환값:**

* <b>`CallsIter`</b>: 평가 run을 나타내는 Call 객체의 이터레이터입니다.

**예외:**

* <b>`ValueError`</b>: 평가에 ref가 없는 경우(아직 저장되거나 run되지 않은 경우)

**예시:**

```python theme={null}
evaluation = Evaluation(dataset=examples, scorers=[scorer])
await evaluation.evaluate(model)  # 먼저 평가 실행
calls = evaluation.get_evaluate_calls()
for call in calls:
     print(f"Evaluation run: {call.id} at {call.started_at}")
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L342" />

### <kbd>방법</kbd> `get_score_calls`

```python theme={null}
get_score_calls() → dict[str, list[Call]]
```

각 evaluation run의 scorer call을 트레이스 ID별로 그룹화하여 조회합니다.

**반환값:**

* <b>`dict[str, list[Call]]`</b>: 트레이스 ID를 scorer Call 객체 목록에 매핑한 딕셔너리입니다. 각 트레이스 ID는 하나의 evaluation run을 나타내며, 목록에는 해당 run 동안 실행된 모든 scorer call이 포함됩니다.

**예시:**

```python theme={null}
evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
await evaluation.evaluate(model)
score_calls = evaluation.get_score_calls()
for trace_id, calls in score_calls.items():
     print(f"Trace {trace_id}: {len(calls)} scorer calls")
     for call in calls:
         scorer_name = call.summary.get("weave", {}).get("trace_name")
         print(f"  Scorer: {scorer_name}, Output: {call.output}")
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval.py#L381" />

### <kbd>방법</kbd> `get_scores`

```python theme={null}
get_scores() → dict[str, dict[str, list[Any]]]
```

평가 run의 scorer 출력을 추출해 정리합니다.

**반환값:**

* <b>`dict[str, dict[str, list[Any]]]`</b>: 다음과 같은 중첩 딕셔너리 구조입니다.
  * 첫 번째 수준의 키는 트레이스 ID(평가 run)입니다.
  * 두 번째 수준의 키는 scorer 이름입니다.
  * 값은 해당 run 및 scorer에 대한 scorer 출력 목록입니다.

**예시:**

```python theme={null}
evaluation = Evaluation(dataset=examples, scorers=[accuracy_scorer, f1_scorer])
await evaluation.evaluate(model)
scores = evaluation.get_scores()
# 트레이스 및 scorer별 점수 액세스
for trace_id, trace_scores in scores.items():
         print(f"Evaluation run {trace_id}:")
         for scorer_name, outputs in trace_scores.items():
             print(f"  {scorer_name}: {outputs}")
```

예상 출력:

```
{
     "trace_123": {
     "accuracy_scorer": [{"accuracy": 0.85}],
     "f1_scorer": [{"f1": 0.78}]
     }
}
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/pydantic/_internal/_model_construction.py#L163" />

### <kbd>방법</kbd> `model_post_init`

```python theme={null}
model_post_init(_Evaluation__context: Any) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L180" />

### <kbd>방법</kbd> `predict_and_score`

```python theme={null}
predict_and_score(model: Op | Model, example: dict) → dict
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L220" />

### <kbd>방법</kbd> `summarize`

```python theme={null}
summarize(eval_table: EvaluationResults) → dict
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L604" />

## <kbd>class</kbd> `EvaluationLogger`

이 클래스는 평가를 로깅하기 위한 명령형 인터페이스를 제공합니다.

평가는 첫 번째 예측이 `log_prediction` 방법으로 로깅되면 자동으로 시작되고, `log_summary` 방법이 호출되면 종료됩니다.

예측을 로깅할 때마다 `ScoreLogger` 객체가 반환됩니다. 이 객체를 사용해 해당 예측의 점수와 메타데이터를 로깅할 수 있습니다. 자세한 내용은 `ScoreLogger` 클래스를 참조하세요.

기본 사용법 - 입력과 출력을 직접 전달해 예측을 로깅합니다:

```python theme={null}
ev = EvaluationLogger()

# 알려진 입력/출력으로 예측 로깅
pred = ev.log_prediction(inputs={'q': 'Hello'}, outputs={'a': 'Hi there!'})
pred.log_score("correctness", 0.9)

# 평가 완료
ev.log_summary({"avg_score": 0.9})
```

고급 활용 - 동적 출력과 중첩 오퍼레이션에는 컨텍스트 관리자를 사용:

```python theme={null}
ev = EvaluationLogger()

# 중첩 오퍼레이션을 캡처해야 할 때 컨텍스트 관리자를 사용하세요
with ev.log_prediction(inputs={'q': 'Hello'}) as pred:
     # 여기서 수행되는 모든 오퍼레이션(예: LLM calls)은 자동으로
     # predict call의 하위 항목이 됩니다
     response = your_llm_call(...)
     pred.output = response.content
     pred.log_score("correctness", 0.9)

# 평가를 완료합니다
ev.log_summary({"avg_score": 0.9})
```

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L646" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(
    name: 'str | None' = None,
    model: 'Model | dict | str | None' = None,
    dataset: 'Dataset | list[dict] | str | None' = None,
    eval_attributes: 'dict[str, Any] | None' = None,
    scorers: 'list[str] | None' = None
) → None
```

***

#### <kbd>속성</kbd> attributes

***

#### <kbd>속성</kbd> ui\_url

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L1024" />

### <kbd>방법</kbd> `fail`

```python theme={null}
fail(exception: 'BaseException') → None
```

예외를 발생시켜 평가를 실패 처리하는 편의 방법입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L1008" />

### <kbd>방법</kbd> `finish`

```python theme={null}
finish(exception: 'BaseException | None' = None) → None
```

summary를 로깅하지 않고 평가 리소스를 명시적으로 정리합니다.

모든 prediction call과 주 평가 call이 최종 처리되도록 보장합니다. logger를 컨텍스트 관리자로 사용하는 경우 이 메서드는 자동으로 호출됩니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L868" />

### <kbd>방법</kbd> `log_example`

```python theme={null}
log_example(
    inputs: 'dict[str, Any]',
    output: 'Any',
    scores: 'dict[str, ScoreType]'
) → None
```

입력, 출력, 점수를 포함한 전체 예시를 기록합니다.

모든 데이터가 미리 준비되어 있을 때 `log_prediction`과 `log_score`를 함께 사용하는 편의 방법입니다.

**매개변수:**

* <b>`inputs`</b>: 예측을 위한 입력 데이터
* <b>`output`</b>: 출력 값
* <b>`scores`</b>: scorer 이름을 점수 값에 매핑한 사전
  **예시:**

```python theme={null}
ev = EvaluationLogger()
ev.log_example(
    inputs={'q': 'What is 2+2?'},
    output='4',
    scores={'correctness': 1.0, 'fluency': 0.9}
)
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L796" />

### <kbd>방법</kbd> `log_prediction`

```python theme={null}
log_prediction(inputs: 'dict[str, Any]', output: 'Any' = None) → ScoreLogger
```

Evaluation에 예측을 기록합니다.

직접 사용하거나 컨텍스트 관리자로 사용할 수 있는 ScoreLogger를 반환합니다.

**매개변수:**

* <b>`inputs`</b>: 예측용 입력 데이터
* <b>`output`</b>: 출력값입니다. 기본값은 None입니다. 나중에 pred.output으로 설정할 수 있습니다.
  **반환값:**
  점수를 기록하고 필요에 따라 예측을 완료하는 데 사용하는 ScoreLogger입니다.

예시(직접 호출):

* <b>`pred = ev.log_prediction({'q'`</b>:  '...'}, output="answer") pred.log\_score("correctness", 0.9) pred.finish()

예시(컨텍스트 관리자):

* <b>`with ev.log_prediction({'q'`</b>:  '...'}) as pred:  response = model(...)  pred.output = response  pred.log\_score("correctness", 0.9) # 종료 시 finish()가 자동으로 호출됩니다

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L907" />

### <kbd>방법</kbd> `log_summary`

```python theme={null}
log_summary(summary: 'dict | None' = None, auto_summarize: 'bool' = True) → None
```

Evaluation에 summary 딕셔너리를 로깅합니다.

이 작업을 수행하면 summary를 계산하고 summarize op를 호출한 뒤 Evaluation을 종료하므로, 이후에는 predictions나 scores를 더 이상 로깅할 수 없습니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/evaluation/eval_imperative.py#L956" />

### <kbd>방법</kbd> `set_view`

```python theme={null}
set_view(
    name: 'str',
    content: 'Content | str',
    extension: 'str | None' = None,
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None,
    encoding: 'str' = 'utf-8'
) → None
```

`weave.views` 아래의 evaluation 기본 call 요약에 뷰를 연결합니다.

제공된 콘텐츠를 프로젝트의 객체로 저장하고, evaluation의 `evaluate` call에 대해 그 레퍼런스 URI를 `summary.weave.views.<name>` 아래에 기록합니다. 문자열 입력은 제공된 확장자 또는 MIME 유형을 사용해 `Content.from_text`로 텍스트 콘텐츠로 래핑됩니다.

**매개변수:**

* <b>`name`</b>: 표시할 뷰 이름입니다. `summary.weave.views` 아래에서 키로 사용됩니다.
* <b>`content`</b>: 직렬화할 `weave.Content` 인스턴스 또는 문자열입니다.
* <b>`extension`</b>: 문자열 콘텐츠 입력에 사용할 선택적 파일 확장자입니다.
* <b>`mimetype`</b>: 문자열 콘텐츠 입력에 사용할 선택적 MIME 유형입니다.
* <b>`metadata`</b>: 새로 생성된 `Content`에 첨부할 선택적 메타데이터입니다.
* <b>`encoding`</b>: 문자열 콘텐츠 입력에 대한 텍스트 인코딩입니다.
  **반환값:**
  없음

**예시:**
` import weave`

> > > ev = weave.EvaluationLogger()
> > > ev.set\_view("report", "# Report", extension="md")

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/File/file.py#L30" />

## <kbd>class</kbd> `File`

경로, MIME 유형, 크기 정보가 있는 파일을 나타내는 클래스입니다.

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/File/file.py#L34" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(path: 'str | Path', mimetype: 'str | None' = None)
```

File 객체를 초기화합니다.

**매개변수:**

***

#### <kbd>속성</kbd> filename

파일 이름을 조회합니다.

* <b>`path`</b>: 파일 경로(string 또는 pathlib.Path)

* <b>`mimetype`</b>: 파일의 선택 사항인 MIME 유형 - 지정하지 않으면 확장자를 기준으로 추론됩니다
  **반환값:**

* <b>`str`</b>:  디렉터리 경로를 제외한 파일 이름입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/File/file.py#L60" />

### <kbd>방법</kbd> `open`

```python theme={null}
open() → bool
```

운영 체제의 기본 애플리케이션을 사용해 파일을 엽니다.

이 방법은 플랫폼별 메커니즘을 사용해 파일 유형에 연결된 기본 애플리케이션으로 파일을 엽니다.

**반환값:**

* <b>`bool`</b>: 파일을 성공적으로 열었으면 True, 그렇지 않으면 False입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/type_handlers/File/file.py#L81" />

### <kbd>방법</kbd> `save`

```python theme={null}
save(dest: 'str | Path') → None
```

파일을 지정된 대상 경로에 복사합니다.

**매개변수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/rich/markdown.py#L512" />

## <kbd>class</kbd> `Markdown`

렌더링할 수 있는 Markdown입니다.

* <b>`dest`</b>: 파일이 복사될 대상 경로입니다(string 또는 pathlib.Path). 대상 경로는 파일일 수도 있고 디렉터리일 수도 있습니다. **매개변수:**

* <b>`markup`</b> (str): Markdown이 포함된 문자열입니다.

* <b>`code_theme`</b> (str, optional): 코드 블록에 사용할 Pygments 테마입니다. 기본값은 "monokai"입니다. 코드 테마는 [https://pygments.org/styles/](https://pygments.org/styles/) 를 참조하세요.

* <b>`justify`</b> (JustifyMethod, optional): 단락의 정렬 값입니다. 기본값은 None입니다.

* <b>`style`</b> (Union\[str, Style], optional): Markdown에 적용할 선택적 스타일입니다.

* <b>`hyperlinks`</b> (bool, optional): 하이퍼링크를 활성화합니다. 기본값은 `True`입니다.

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/rich/markdown.py#L548" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(
    markup: 'str',
    code_theme: 'str' = 'monokai',
    justify: 'JustifyMethod | None' = None,
    style: 'str | Style' = 'none',
    hyperlinks: 'bool' = True,
    inline_code_lexer: 'str | None' = None,
    inline_code_theme: 'str | None' = None
) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L164" />

## <kbd>class</kbd> `MessagesPrompt`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L168" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(messages: list[dict])
```

* <b>`inline_code_lexer`</b>: (str, optional): 인라인 코드 강조가 활성화된 경우 사용할 렉서입니다. 기본값은 None입니다.

* <b>`inline_code_theme`</b>: (Optional\[str], optional): 인라인 코드 강조에 사용할 Pygments 테마이며, 강조를 사용하지 않으려면 None으로 설정합니다. 기본값은 None입니다.
  **Pydantic Fields:**

* `name`: `str | None`

* `description`: `str | None`

* `ref`: `trace.refs.ObjectRef | None`

* `messages`: `list[dict]`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L180" />

### <kbd>방법</kbd> `format`

```python theme={null}
format(**kwargs: Any) → list
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L172" />

### <kbd>방법</kbd> `format_message`

```python theme={null}
format_message(message: dict, **kwargs: Any) → dict
```

템플릿 변수를 치환해 단일 메시지를 포맷합니다.

이 방법은 실제 포맷팅 로직을 독립 실행형 format\_message\_with\_template\_vars 함수에 위임합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L183" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/model.py#L25" />

## <kbd>class</kbd> `Model`

입력을 받아 동작하는 코드와 데이터의 조합을 캡처하기 위한 클래스입니다. 예를 들어, 예측을 수행하거나 텍스트를 생성하기 위해 프롬프트와 함께 LLM을 call할 수 있습니다.

모델을 정의하는 속성이나 코드를 변경하면 이러한 변경 사항이 로깅되고 버전이 업데이트됩니다. 이를 통해 모델의 서로 다른 버전 간 예측을 비교할 수 있습니다. 이를 사용해 프롬프트를 반복 개선하거나 최신 LLM을 사용해 보고, 서로 다른 설정에서 예측을 비교할 수 있습니다.

**예시:**

```python theme={null}
class YourModel(Model):
     attribute1: str
     attribute2: int

     @weave.op
     def predict(self, input_data: str) -> dict:
         # 모델 로직을 여기에 작성하세요
         prediction = self.attribute1 + ' ' + input_data
         return {'pred': prediction}
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/model.py#L51" />

### <kbd>방법</kbd> `get_infer_method`

```python theme={null}
get_infer_method() → Callable
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/monitor.py#L39" />

## <kbd>class</kbd> `Monitor`

수신되는 call의 점수를 자동으로 매기는 모니터를 설정합니다.

**예시:**

```python theme={null}
import weave
from weave.scorers import ValidJSONScorer

json_scorer = ValidJSONScorer()

my_monitor = weave.Monitor(
     name="my-monitor",
     description="This is a test monitor",
     sampling_rate=0.5,
     op_names=["my_op"],
     query={
         "$expr": {
             "$gt": [
                 {
                         "$getField": "started_at"
                     },
                     {
                         "$literal": 1742540400
                     }
                 ]
             }
         }
     },
     scorers=[json_scorer],
)

my_monitor.activate()
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `sampling_rate`: `<class 'float'>`
* `scorers`: `list[flow.scorer.Scorer]`
* `op_names`: `list[str]`
* `query`: `trace_server.interface.query.Query | None`
* `is_traced`: `<class 'bool'>`
* `active`: `<class 'bool'>`
* `scorer_debounce_config`: `flow.monitor.ScorerDebounceConfig | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/monitor.py#L88" />

### <kbd>방법</kbd> `activate`

```python theme={null}
activate() → ObjectRef
```

모니터를 활성화합니다.

**반환값:**
모니터에 대한 참조입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/monitor.py#L98" />

### <kbd>방법</kbd> `deactivate`

```python theme={null}
deactivate() → ObjectRef
```

모니터를 비활성화합니다.

**반환값:**
모니터에 대한 참조입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/monitor.py#L108" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/object/obj.py#L21" />

## <kbd>class</kbd> `Object`

추적 및 버전 관리가 가능한 Weave 객체의 기본 클래스입니다.

이 클래스는 Pydantic의 BaseModel을 확장해 객체 추적, 참조, 직렬화를 위한 Weave 전용 기능을 제공합니다. 객체에는 이름, 설명, 그리고 Weave 시스템에 저장하고 조회할 수 있도록 하는 참조가 포함될 수 있습니다.

**속성:**

* <b>`name`</b> (Optional\[str]):  객체를 사람이 읽기 쉬운 형태로 식별하는 이름입니다.
* <b>`description`</b> (Optional\[str]):  객체가 나타내는 내용을 설명합니다.
* <b>`ref`</b> (Optional\[ObjectRef]):  Weave 시스템 내 객체에 대한 참조입니다.

**예시:**

```python theme={null}
# 단순한 객체 생성
obj = Object(name="my_object", description="A test object")

# URI에서 객체 생성
obj = Object.from_uri("weave:///entity/project/object:digest")
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/object/obj.py#L60" />

### <kbd>클래스 메서드</kbd> `from_uri`

```python theme={null}
from_uri(uri: str, objectify: bool = True) → Self
```

Weave URI로부터 객체 인스턴스를 생성합니다.

**매개변수:**

* <b>`uri`</b> (str):  객체를 가리키는 Weave URI입니다.
* <b>`objectify`</b> (bool):  결과를 객체로 변환할지 여부입니다. 기본값은 True입니다.

**반환값:**

* <b>`Self`</b>:  URI로부터 생성된 클래스 인스턴스입니다.

**예외:**

* <b>`NotImplementedError`</b>:  클래스가 역직렬화에 필요한 메서드를 구현하지 않은 경우 발생합니다.

**예시:**

```python theme={null}
obj = MyObject.from_uri("weave:///entity/project/object:digest")
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/object/obj.py#L86" />

### <kbd>클래스 메서드</kbd> `handle_relocatable_object`

```python theme={null}
handle_relocatable_object(
    v: Any,
    handler: ValidatorFunctionWrapHandler,
    info: ValidationInfo
) → Any
```

ObjectRef 및 WeaveObject를 포함한 재배치 가능한 객체의 검증을 처리합니다.

이 검증기는 입력값이 ObjectRef 또는 WeaveObject일 때, 이를 표준 객체 인스턴스로 적절히 변환해야 하는 특수한 경우를 처리합니다. 또한 검증 과정에서 참조가 유지되고, 무시된 유형이 올바르게 처리되도록 보장합니다.

**매개변수:**

* <b>`v`</b> (Any):  검증할 값입니다.
* <b>`handler`</b> (ValidatorFunctionWrapHandler):  표준 pydantic 검증 핸들러입니다.
* <b>`info`</b> (ValidationInfo):  검증 컨텍스트 정보입니다.

**반환값:**

* <b>`Any`</b>:  검증된 객체 인스턴스입니다.

**예시:**
이 방법은 객체를 생성하고 검증하는 동안 자동으로 호출됩니다. 다음과 같은 경우를 처리합니다: \`\`\`python

<div id="when-an-objectref-is-passed">
  # ObjectRef를 전달하는 경우
</div>

obj = MyObject(some\_object\_ref)

<div id="when-a-weaveobject-is-passed">
  # WeaveObject가 전달된 경우
</div>

obj = MyObject(some\_weave\_object)

````

---

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L162" />

## <kbd>class</kbd> `ObjectRef`
ObjectRef(entity: 'str', project: 'str', name: 'str', _digest: 'str | Future[str]', _extra: 'tuple[str | Future[str], ...]' = ()) 

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/../../../../weave/trace/refs/__init__" />

### <kbd>method</kbd> `__init__`

```python
__init__(
    entity: 'str',
    project: 'str',
    name: 'str',
    _digest: 'str | Future[str]',
    _extra: 'tuple[str | Future[str], ]' = ()
) → None
````

***

#### <kbd>속성</kbd> digest

***

#### <kbd>속성</kbd> extra

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L170" />

### <kbd>방법</kbd> `as_param_dict`

```python theme={null}
as_param_dict() → dict
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L262" />

### <kbd>방법</kbd> `delete`

```python theme={null}
delete() → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L218" />

### <kbd>방법</kbd> `get`

```python theme={null}
get(objectify: 'bool' = True) → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L246" />

### <kbd>방법</kbd> `is_descended_from`

```python theme={null}
is_descended_from(potential_ancestor: 'ObjectRef') → bool
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L72" />

### <kbd>방법</kbd> `maybe_parse_uri`

```python theme={null}
maybe_parse_uri(s: 'str') → AnyRef | None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L269" />

### <kbd>방법</kbd> `parse_uri`

```python theme={null}
parse_uri(uri: 'str') → ObjectRef
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L152" />

### <kbd>방법</kbd> `with_attr`

```python theme={null}
with_attr(attr: 'str') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L144" />

### <kbd>방법</kbd> `with_extra`

```python theme={null}
with_extra(extra: 'tuple[str | Future[str], ]') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L155" />

### <kbd>방법</kbd> `with_index`

```python theme={null}
with_index(index: 'int') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L158" />

### <kbd>방법</kbd> `with_item`

```python theme={null}
with_item(item_digest: 'str | Future[str]') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/refs.py#L149" />

### <kbd>방법</kbd> `with_key`

```python theme={null}
with_key(key: 'str') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L83" />

## <kbd>class</kbd> `Prompt`

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L84" />

### <kbd>방법</kbd> `format`

```python theme={null}
format(**kwargs: Any) → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L496" />

## <kbd>class</kbd> `SavedView`

SavedView 객체를 다루기 위한 플루언트 스타일 클래스입니다.

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L502" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(view_type: 'str' = 'traces', label: 'str' = 'SavedView') → None
```

***

#### <kbd>속성</kbd> entity

***

#### <kbd>속성</kbd> 레이블

***

#### <kbd>속성</kbd> 프로젝트

***

#### <kbd>속성</kbd> view\_type

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L626" />

### <kbd>방법</kbd> `add_column`

```python theme={null}
add_column(path: 'str | ObjectPath', label: 'str | None' = None) → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L635" />

### <kbd>방법</kbd> `add_columns`

```python theme={null}
add_columns(*columns: 'str') → SavedView
```

그리드에 여러 열을 추가하는 편의 메서드입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L527" />

### <kbd>방법</kbd> `add_filter`

```python theme={null}
add_filter(
    field: 'str',
    operator: 'str',
    value: 'Any | None' = None
) → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L601" />

### <kbd>방법</kbd> `add_sort`

```python theme={null}
add_sort(field: 'str', direction: 'SortDirection') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L666" />

### <kbd>방법</kbd> `column_index`

```python theme={null}
column_index(path: 'int | str | ObjectPath') → int
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L581" />

### <kbd>방법</kbd> `filter_op`

```python theme={null}
filter_op(op_name: 'str | None') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L851" />

### <kbd>방법</kbd> `get_calls`

```python theme={null}
get_calls(
    limit: 'int | None' = None,
    offset: 'int | None' = None,
    include_costs: 'bool' = False,
    include_feedback: 'bool' = False,
    all_columns: 'bool' = False
) → CallsIter
```

이 저장된 뷰의 필터와 설정에 맞는 calls를 조회합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L909" />

### <kbd>방법</kbd> `get_known_columns`

```python theme={null}
get_known_columns(num_calls_to_query: 'int | None' = None) → list[str]
```

존재하는 것으로 확인된 열 집합을 조회합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L919" />

### <kbd>방법</kbd> `get_table_columns`

```python theme={null}
get_table_columns() → list[TableColumn]
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L620" />

### <kbd>방법</kbd> `hide_column`

```python theme={null}
hide_column(col_name: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L641" />

### <kbd>방법</kbd> `insert_column`

```python theme={null}
insert_column(
    idx: 'int',
    path: 'str | ObjectPath',
    label: 'str | None' = None
) → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L979" />

### <kbd>클래스 메서드</kbd> `load`

```python theme={null}
load(ref: 'str') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L744" />

### <kbd>방법</kbd> `page_size`

```python theme={null}
page_size(page_size: 'int') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L714" />

### <kbd>방법</kbd> `pin_column_left`

```python theme={null}
pin_column_left(col_name: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L724" />

### <kbd>방법</kbd> `pin_column_right`

```python theme={null}
pin_column_right(col_name: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L686" />

### <kbd>방법</kbd> `remove_column`

```python theme={null}
remove_column(path: 'int | str | ObjectPath') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L705" />

### <kbd>방법</kbd> `remove_columns`

```python theme={null}
remove_columns(*columns: 'str') → SavedView
```

저장된 뷰에서 열을 제거합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L550" />

### <kbd>방법</kbd> `remove_filter`

```python theme={null}
remove_filter(index_or_field: 'int | str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L565" />

### <kbd>방법</kbd> `remove_filters`

```python theme={null}
remove_filters() → SavedView
```

저장된 뷰의 모든 필터를 제거합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L523" />

### <kbd>방법</kbd> `rename`

```python theme={null}
rename(label: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L680" />

### <kbd>방법</kbd> `rename_column`

```python theme={null}
rename_column(path: 'int | str | ObjectPath', label: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L836" />

### <kbd>방법</kbd> `save`

```python theme={null}
save() → SavedView
```

저장된 뷰를 서버에 게시합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L660" />

### <kbd>방법</kbd> `set_columns`

```python theme={null}
set_columns(*columns: 'str') → SavedView
```

그리드에 표시할 열을 설정합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L614" />

### <kbd>방법</kbd> `show_column`

```python theme={null}
show_column(col_name: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L608" />

### <kbd>방법</kbd> `sort_by`

```python theme={null}
sort_by(field: 'str', direction: 'SortDirection') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L892" />

### <kbd>방법</kbd> `to_grid`

```python theme={null}
to_grid(limit: 'int | None' = None) → Grid
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L773" />

### <kbd>방법</kbd> `to_rich_table_str`

```python theme={null}
to_rich_table_str() → str
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L756" />

### <kbd>방법</kbd> `ui_url`

```python theme={null}
ui_url() → str | None
```

UI에서 이 저장된 뷰를 표시할 URL입니다.

참고로 이는 트레이스 등이 표시되는 "result" 페이지의 URL이며, 뷰 객체의 URL은 아닙니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/saved_view.py#L734" />

### <kbd>방법</kbd> `unpin_column`

```python theme={null}
unpin_column(col_name: 'str') → SavedView
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/scorer.py#L30" />

## <kbd>class</kbd> `Scorer`

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `column_map`: `dict[str, str] | None`

***

#### <kbd>속성</kbd> display\_name

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/scorer.py#L52" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/flow/scorer.py#L36" />

### <kbd>방법</kbd> `model_post_init`

```python theme={null}
model_post_init(_Scorer__context: Any) → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L44" />

### <kbd>방법</kbd> `score`

```python theme={null}
score(output: Any, **kwargs: Any) → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L48" />

### <kbd>방법</kbd> `summarize`

```python theme={null}
summarize(score_rows: list) → dict | None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L88" />

## <kbd>class</kbd> `StringPrompt`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L92" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(content: str)
```

**Pydantic 필드:**

* `name`: `str | None`
* `description`: `str | None`
* `ref`: `trace.refs.ObjectRef | None`
* `content`: `<class 'str'>`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L96" />

### <kbd>방법</kbd> `format`

```python theme={null}
format(**kwargs: Any) → str
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/prompt/prompt.py#L99" />

### <kbd>클래스 메서드</kbd> `from_obj`

```python theme={null}
from_obj(obj: WeaveObject) → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/table.py#L9" />

## <kbd>class</kbd> `Table`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/table.py#L12" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(rows: 'list[dict]') → None
```

***

#### <kbd>속성</kbd> 행

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/table.py#L50" />

### <kbd>방법</kbd> `append`

```python theme={null}
append(row: 'dict') → None
```

테이블에 행을 추가합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/table.py#L56" />

### <kbd>방법</kbd> `pop`

```python theme={null}
pop(index: 'int') → None
```

테이블에서 지정된 인덱스의 행을 제거합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L105" />

## <kbd>class</kbd> `ContextAwareThread`

호출자 컨텍스트로 함수를 실행하는 스레드입니다.

이 클래스는 스레드 내부에서 call이 예상대로 동작하도록 보장하는 `threading.Thread`의 대체 구현입니다. Weave는 특정 `contextvars`가 설정되어 있어야 하지만(`call&#95;context.py` 참조), 새 스레드는 부모의 컨텍스트를 자동으로 복사하지 않으므로 call 컨텍스트가 손실될 수 있습니다 -- 바람직하지 않습니다! 이 클래스는 `contextvars` 복사를 자동화하므로, 이 스레드를 사용하면 사용자가 기대하는 대로 "그냥 동작합니다".

이 클래스를 사용하지 않고도, 대신 다음과 같이 작성하면 같은 효과를 얻을 수 있습니다:

```python theme={null}
def run_with_context(func, *args, **kwargs):
     context = copy_context()
     def wrapper():
         context.run(func, *args, **kwargs)
     return wrapper

thread = threading.Thread(target=run_with_context(your_func, *args, **kwargs))
thread.start()
```

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L129" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(*args: 'Any', **kwargs: 'Any') → None
```

***

#### <kbd>속성</kbd> daemon

이 스레드가 데몬 스레드인지 여부를 나타내는 불리언 값입니다.

이 값은 start()가 호출되기 전에 설정해야 합니다. 그렇지 않으면 RuntimeError가 발생합니다. 초기값은 이 스레드를 만든 스레드에서 상속됩니다. 메인 스레드는 데몬 스레드가 아니므로, 메인 스레드에서 생성된 모든 스레드는 기본적으로 daemon = False입니다.

데몬 스레드만 남으면 Python 프로그램 전체가 종료됩니다.

***

#### <kbd>속성</kbd> ident

이 스레드의 식별자입니다. 아직 시작되지 않았다면 `None`입니다.

이는 0이 아닌 정수입니다. `get_ident()` 함수를 참조하세요. 스레드가 종료된 후 다른 스레드가 생성되면 스레드 식별자가 재사용될 수 있습니다. 이 식별자는 스레드가 종료된 후에도 계속 사용할 수 있습니다.

***

#### <kbd>속성</kbd> name

식별 목적으로만 사용되는 문자열입니다.

의미는 없습니다. 여러 스레드에 같은 이름이 부여될 수 있습니다. 초기 이름은 생성자에서 설정됩니다.

***

#### <kbd>속성</kbd> native\_id

이 스레드의 네이티브 정수형 스레드 ID이며, 아직 시작되지 않은 경우에는 None입니다.

이는 음수가 아닌 정수입니다. get\_native\_id() 함수를 참조하세요. 커널이 보고한 스레드 ID를 나타냅니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L133" />

### <kbd>방법</kbd> `run`

```python theme={null}
run() → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L438" />

## <kbd>class</kbd> `ThreadContext`

현재 스레드와 턴 정보에 접근할 수 있는 컨텍스트 객체입니다.

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L441" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(thread_id: 'str | None')
```

지정한 thread\_id로 ThreadContext를 초기화합니다.

**매개변수:**

***

#### <kbd>속성</kbd> thread\_id

이 컨텍스트의 thread\_id를 조회합니다.

* <b>`thread_id`</b>: 이 컨텍스트의 스레드 식별자입니다. 비활성화된 경우 None입니다.
  **반환값:**
  스레드 식별자입니다. 스레드 추적이 비활성화된 경우 None입니다.

***

#### <kbd>속성</kbd> turn\_id

활성 컨텍스트에서 현재 turn\_id를 조회합니다.

**반환값:**
설정된 경우 현재 turn\_id를 반환하고, 그렇지 않으면 None을 반환합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L45" />

## <kbd>class</kbd> `ContextAwareThreadPoolExecutor`

호출자의 컨텍스트로 함수를 실행하는 ThreadPoolExecutor입니다.

이 클래스는 concurrent.futures.ThreadPoolExecutor를 그대로 대체할 수 있으며, executor 내부에서 Weave calls가 예상대로 동작하도록 보장합니다. Weave는 특정 contextvars가 설정되어 있어야 하지만(`call&#95;context.py` 참조), 새 스레드는 부모의 컨텍스트를 자동으로 복사하지 않으므로 call 컨텍스트가 손실될 수 있습니다 -- 바람직하지 않습니다! 이 클래스는 contextvar 복사를 자동화하므로, 이 executor를 사용하면 사용자가 기대하는 대로 "그냥 동작합니다".

이 클래스를 사용하지 않고도 대신 다음과 같이 작성하면 같은 효과를 얻을 수 있습니다:

```python theme={null}
with concurrent.futures.ThreadPoolExecutor() as executor:
     contexts = [copy_context() for _ in range(len(vals))]

     def _wrapped_fn(*args):
         return contexts.pop().run(fn, *args)

     executor.map(_wrapped_fn, vals)
```

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L68" />

### <kbd>방법</kbd> `__init__`

```python theme={null}
__init__(*args: 'Any', **kwargs: 'Any') → None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L77" />

### <kbd>방법</kbd> `map`

```python theme={null}
map(
    fn: 'Callable',
    *iterables: 'Iterable[Any]',
    timeout: 'float | None' = None,
    chunksize: 'int' = 1
) → Iterator
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/util.py#L73" />

### <kbd>방법</kbd> `submit`

```python theme={null}
submit(fn: 'Callable', *args: 'Any', **kwargs: 'Any') → Any
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L200" />

### <kbd>함수</kbd> `add_tags`

```python theme={null}
add_tags(obj_ref: 'ObjectRef | str', tags: 'list[str]') → None
```

객체 버전에 태그를 추가합니다.

**인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L1421" />

### <kbd>함수</kbd> `as_op`

```python theme={null}
as_op(fn: 'Callable[P, R]') → Op[P, R]
```

@weave.op로 데코레이션된 함수가 주어지면 해당 Op를 반환합니다.

@weave.op로 데코레이션된 함수는 이미 Op의 인스턴스이므로, 이 함수는 런타임에 아무 작업도 하지 않습니다. 하지만 OpDef 속성에 타입 안전하게 접근해야 하는 경우 타입 검사기를 만족시키기 위해 이 함수를 사용할 수 있습니다.

* <b>`obj_ref`</b>: 객체 버전에 대한 레퍼런스로, weave.publish()가 반환하는 ObjectRef 또는 weave /// URI 문자열입니다.

* <b>`tags`</b>: 추가할 태그 문자열 목록입니다.
  **인수:**

* <b>`fn`</b>: @weave.op로 데코레이션된 함수입니다.
  **반환값:**
  함수의 Op입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/../../../../weave/trace/api/attributes#L365" />

### <kbd>함수</kbd> `attributes`

```python theme={null}
attributes(attributes: 'dict[str, Any]') → Iterator
```

call에 속성을 설정하는 컨텍스트 관리자입니다.

**예시:**

```python theme={null}
with weave.attributes({'env': 'production'}):
     print(my_function.call("World"))
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L515" />

### <kbd>함수</kbd> `finish`

```python theme={null}
finish() → None
```

Weave 로깅을 중지합니다.

종료 후에는 `weave.op` 데코레이터가 적용된 함수의 call이 더 이상 로깅되지 않습니다. 로깅을 재개하려면 `weave.init()`를 다시 실행해야 합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L339" />

### <kbd>함수</kbd> `get`

```python theme={null}
get(uri: 'str | ObjectRef') → Any
```

URI에서 객체를 조회하는 편의 함수입니다.

Weave에 로깅된 많은 객체는 자동으로 Weave 서버에 등록됩니다. 이 함수를 사용하면 해당 객체를 URI로 조회할 수 있습니다.

**인수:**

* <b>`uri`</b>: 완전 수식된 weave ref URI입니다.
  **반환값:**
  객체입니다.

**예시:**

```python theme={null}
weave.init("weave_get_example")
dataset = weave.Dataset(rows=[{"a": 1, "b": 2}])
ref = weave.publish(dataset)

dataset2 = weave.get(ref)  # dataset과 동일!
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L262" />

### <kbd>함수</kbd> `get_aliases`

```python theme={null}
get_aliases(obj_ref: 'ObjectRef | str') → list[str]
```

객체 버전의 별칭을 조회합니다.

**인수:**

* <b>`obj_ref`</b>: ObjectRef 또는 weave /// URI 문자열로 지정한 객체 버전에 대한 레퍼런스입니다.
  **반환값:**
  별칭 문자열 목록입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L114" />

### <kbd>함수</kbd> `get_client`

```python theme={null}
get_client() → WeaveClient | None
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/context/call_context.py#L119" />

### <kbd>함수</kbd> `get_current_call`

```python theme={null}
get_current_call() → Call | None
```

현재 실행 중인 Op 내부에서 해당 Op의 Call 객체를 조회합니다.

**반환값:**
현재 실행 중인 Op의 Call 객체를 반환합니다. tracking이 초기화되지 않았거나 이 방법이 Op 외부에서 호출된 경우에는 None을 반환합니다.

**참고:**

> 반환된 Call의 `attributes` 딕셔너리는 call이 시작되면 변경할 수 없게 됩니다. Op를 호출하기 전에 :func:`weave.attributes`를 사용해 call 메타데이터를 설정하세요. `summary` 필드는 Op가 실행되는 동안 업데이트될 수 있으며, call이 완료되면 계산된 summary 정보와 병합됩니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L224" />

### <kbd>함수</kbd> `get_tags`

```python theme={null}
get_tags(obj_ref: 'ObjectRef | str') → list[str]
```

객체 버전의 태그를 조회합니다.

**인수:**

* <b>`obj_ref`</b>: 객체 버전에 대한 레퍼런스입니다. `ObjectRef` 또는 weave /// URI 문자열일 수 있습니다.
  **반환값:**
  tag 문자열의 목록입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L276" />

### <kbd>함수</kbd> `get_tags_and_aliases`

```python theme={null}
get_tags_and_aliases(obj_ref: 'ObjectRef | str') → tuple[list[str], list[str]]
```

단일 Call로 객체 버전의 태그와 별칭를 모두 조회합니다.

**인수:**

* <b>`obj_ref`</b>: 객체 버전을 가리키는 레퍼런스입니다. `ObjectRef` 또는 `weave /// URI` 문자열일 수 있습니다.
  **반환값:**
  `(태그, 별칭)` 튜플입니다. 각 항목은 문자열 목록입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L42" />

### <kbd>함수</kbd> `init`

```python theme={null}
init(
    project_name: 'str',
    settings: 'UserSettings | dict[str, Any] | None' = None,
    autopatch_settings: 'AutopatchSettings | None' = None,
    global_postprocess_inputs: 'PostprocessInputsFunc | None' = None,
    global_postprocess_output: 'PostprocessOutputFunc | None' = None,
    global_attributes: 'dict[str, Any] | None' = None
) → WeaveClient
```

wandb 프로젝트에 로깅하도록 Weave 추적을 초기화합니다.

로깅은 전역으로 초기화되므로 `init`의 반환값을 따로 저장해 둘 필요가 없습니다.

`init` 이후에는 `weave.op`으로 데코레이팅된 함수의 call이 지정된 프로젝트에 로깅됩니다.

**인수:**

참고: 전역 후처리 설정은 각 op의 자체 후처리 이후에 모든 op에 적용됩니다. 순서는 항상 다음과 같습니다. 1. op별 후처리 2. 전역 후처리

* <b>`project_name`</b>: 로깅할 Weights & Biases team 및 프로젝트 이름입니다. team을 지정하지 않으면 기본 entity가 사용됩니다. 기본 entity를 확인하거나 업데이트하려면 W\&B Models 문서의 [User Settings](https://docs.wandb.ai/guides/models/app/settings-page/user-settings/#default-team)를 참고하세요.
* <b>`settings`</b>: 전반적인 Weave 클라이언트 설정입니다.
* <b>`autopatch_settings`</b>: (사용 중단) autopatch 인테그레이션용 설정입니다. 대신 명시적으로 패치하세요.
* <b>`global_postprocess_inputs`</b>: 모든 op의 모든 입력에 적용할 함수입니다.
* <b>`global_postprocess_output`</b>: 모든 op의 모든 출력에 적용할 함수입니다.
* <b>`global_attributes`</b>: 모든 트레이스에 적용할 속성 딕셔너리입니다.
  **반환값:**
  Weave 클라이언트입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L300" />

### <kbd>함수</kbd> `list_aliases`

```python theme={null}
list_aliases() → list[str]
```

프로젝트의 모든 고유한 alias를 나열합니다.

**반환값:**
프로젝트의 모든 alias 문자열을 정렬한 목록입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L290" />

### <kbd>함수</kbd> `list_tags`

```python theme={null}
list_tags() → list[str]
```

프로젝트에 있는 모든 고유한 태그를 나열합니다.

**반환값:**
프로젝트의 모든 tag 문자열을 정렬한 목록입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/log_call.py#L18" />

### <kbd>함수</kbd> `log_call`

```python theme={null}
log_call(
    op: 'str',
    inputs: 'dict[str, Any]',
    output: 'Any',
    parent: 'Call | None' = None,
    attributes: 'dict[str, Any] | None' = None,
    display_name: 'str | Callable[[Call], str] | None' = None,
    use_stack: 'bool' = True,
    exception: 'BaseException | None' = None
) → Call
```

데코레이터 패턴을 사용하지 않고 call을 Weave에 직접 로깅합니다.

이 함수는 오퍼레이션을 Weave에 로깅하기 위한 명령형 API를 제공합니다. 이미 실행된 후에 calls를 로깅해야 하거나 데코레이터 패턴이 사용 사례에 맞지 않을 때 유용합니다.

**매개변수:**

* <b>`op`</b> (str):  로깅할 오퍼레이션 이름입니다. 이 값은 call의 op\_name으로 사용됩니다. 익명 오퍼레이션(게시된 ops를 가리키지 않는 문자열)도 지원됩니다.
* <b>`inputs`</b> (dict\[str, Any]):  오퍼레이션의 입력 매개변수를 담은 딕셔너리입니다.
* <b>`output`</b> (Any):  오퍼레이션의 출력 또는 결과입니다.
* <b>`parent`</b> (Call | None):  이 call을 그 아래에 중첩할 상위 call(선택 사항)입니다. 제공하지 않으면 이 call은 루트 수준 call이 됩니다(또는 현재 call 컨텍스트가 있으면 그 아래에 중첩됩니다). 기본값은 None입니다.
* <b>`attributes`</b> (dict\[str, Any] | None):  call에 첨부할 메타데이터(선택 사항)입니다. 이 값은 call이 생성되면 고정됩니다. 기본값은 None입니다.
* <b>`display_name`</b> (str | Callable\[\[Call], str] | None):  UI에서 call에 표시할 이름(선택 사항)입니다. 문자열이거나, call을 받아 문자열을 반환하는 callable일 수 있습니다. 기본값은 None입니다.
* <b>`use_stack`</b> (bool):  call을 런타임 스택에 푸시할지 여부입니다. True이면 call을 call 컨텍스트에서 사용할 수 있으며 weave.require\_current\_call()을 통해 접근할 수 있습니다. False이면 call은 로깅되지만 call 스택에는 추가되지 않습니다. 기본값은 True입니다.
* <b>`exception`</b> (BaseException | None):  오퍼레이션이 실패했을 때 로깅할 예외(선택 사항)입니다. 기본값은 None입니다.

**반환값:**

* <b>`Call`</b>:  전체 트레이스 정보를 포함하는, 생성 및 완료된 Call 객체입니다.

**예시:**
기본 사용법:

````python theme={null}
import weave
    >>> weave.init('my-project')
    >>> call = weave.log_call(
    ...     op="my_function",
    ...     inputs={"x": 5, "y": 10},
    ...     output=15
    ... )

    속성 및 표시 이름으로 로깅:
    >>> call = weave.log_call(
    ...     op="process_data",
    ...     inputs={"data": [1, 2, 3]},
    ...     output={"mean": 2.0},
    ...     attributes={"version": "1.0", "env": "prod"},
    ...     display_name="Data Processing"
    ... )

    실패한 오퍼레이션 로깅:
    >>> try:
    ...     result = risky_operation()
    ... except Exception as e:
    ...     call = weave.log_call(
    ...         op="risky_operation",
    ...         inputs={},
    ...         output=None,
    ...         exception=e
    ...     )

    calls 중첩:
    >>> parent_call = weave.log_call("parent", {"input": 1}, 2)
    >>> child_call = weave.log_call(
    ...     "child",
    ...     {"input": 2},
    ...     4,
    ...     parent=parent_call
    ... )

    call 스택에 추가하지 않고 로깅:
    >>> call = weave.log_call(
    ...     op="background_task",
    ...     inputs={"task_id": 123},
    ...     output="completed",
    ...     use_stack=False  # call 스택에 푸시하지 않음
    ... )

---

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/op.py#L1220" />

### <kbd>함수</kbd> `op`

```python
op(
    func: 'Callable[P, R] | None' = None,
    name: 'str | None' = None,
    call_display_name: 'str | CallDisplayNameFunc | None' = None,
    postprocess_inputs: 'PostprocessInputsFunc | None' = None,
    postprocess_output: 'PostprocessOutputFunc | None' = None,
    tracing_sample_rate: 'float' = 1.0,
    enable_code_capture: 'bool' = True,
    accumulator: 'Callable[[Any | None, Any], Any] | None' = None,
    kind: 'OpKind | None' = None,
    color: 'OpColor | None' = None,
    eager_call_start: 'bool' = False
) → Callable[[Callable[P, R]], Op[P, R]] | Op[P, R]
````

함수나 방법을 Weave op로 변환하는 데코레이터입니다. 동기와 비동기 모두에서 작동합니다. 이터레이터 함수를 자동으로 감지해 적절한 동작을 적용합니다.

**인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L118" />

### <kbd>함수</kbd> `publish`

```python theme={null}
publish(
    obj: 'Any',
    name: 'str | None' = None,
    tags: 'list[str] | None' = None,
    aliases: 'list[str] | None' = None
) → ObjectRef
```

Python 객체를 저장하고 버전을 관리합니다.

객체 이름이 이미 존재하고 해당 객체의 콘텐츠 해시가 그 객체의 최신 버전과 일치하지 않으면 Weave가 객체의 새 버전을 생성합니다.

* <b>`func`</b>: 데코레이트할 함수입니다.

* <b>`name`</b>: op의 맞춤형 이름입니다. 기본값은 함수 이름입니다.

* <b>`call_display_name`</b>: calls에 표시할 이름으로, 문자열 또는 callable일 수 있습니다.

* <b>`postprocess_inputs`</b>: logging하기 전에 입력을 변환하는 함수입니다.

* <b>`postprocess_output`</b>: logging하기 전에 출력을 변환하는 함수입니다.

* <b>`tracing_sample_rate`</b>: 트레이스할 calls의 비율입니다(0.0\~1.0).

* <b>`enable_code_capture`</b>: 이 op의 소스 코드를 캡처할지 여부입니다.

* <b>`accumulator`</b>: 스트리밍 op의 결과를 누적하는 함수입니다.

* <b>`eager_call_start`</b>: True이면 call 시작이 배치 처리되지 않고 즉시 전송됩니다. UI에서 즉시 확인되어야 하는 evaluation 같은 장기 실행 오퍼레이션에 유용합니다.
  **인수:**

* <b>`obj`</b>: 저장하고 버전 관리할 객체입니다.

* <b>`name`</b>: 객체를 저장할 이름입니다.

* <b>`tags`</b>: 게시된 객체 버전에 추가할 선택적 태그 목록입니다.

* <b>`aliases`</b>: 게시된 객체 버전에 설정할 선택적 별칭 목록입니다.
  **반환값:**
  저장된 객체를 가리키는 Weave Ref입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L310" />

### <kbd>함수</kbd> `ref`

```python theme={null}
ref(location: 'str') → ObjectRef
```

기존 Weave 객체에 대한 Ref를 생성합니다. 객체를 직접 조회하지는 않지만, 다른 Weave API 함수에 전달할 수 있습니다.

**인수:**

* <b>`location`</b>: Weave Ref URI이거나, `weave.init()`가 호출된 경우 `name:version` 또는 `name`입니다. 버전이 지정되지 않으면 `latest`를 사용합니다.
  **반환값:**
  객체를 가리키는 Weave Ref입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L250" />

### <kbd>함수</kbd> `remove_aliases`

```python theme={null}
remove_aliases(obj_ref: 'ObjectRef | str', alias: 'str | list[str]') → None
```

객체에서 하나 이상의 별칭을 제거합니다.

**인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L212" />

### <kbd>함수</kbd> `remove_tags`

```python theme={null}
remove_tags(obj_ref: 'ObjectRef | str', tags: 'list[str]') → None
```

객체 버전에서 태그를 제거합니다.

* <b>`obj_ref`</b>: 객체를 가리키는 레퍼런스로, ObjectRef 또는 weave /// URI 문자열일 수 있습니다.
* <b>`alias`</b>: 제거할 alias 이름 또는 alias 이름 목록입니다.
  **인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/context/call_context.py#L70" />

### <kbd>함수</kbd> `require_current_call`

```python theme={null}
require_current_call() → Call
```

현재 실행 중인 Op 안에서 해당 Op의 Call 객체를 조회합니다.

이렇게 하면 실행 중인 동안 id나 피드백 같은 Call의 속성에 접근할 수 있습니다.

```python theme={null}
@weave.op
def hello(name: str) -> None:
     print(f"Hello {name}!")
     current_call = weave.require_current_call()
     print(current_call.id)
```

Op가 반환된 후에도 Call에 접근할 수 있습니다.

Call의 id가 있다면(예: UI에서 확인한 경우), `weave.init`가 반환한 `WeaveClient`의 `get_call` 방법을 사용해 Call 객체를 조회할 수 있습니다.

```python theme={null}
client = weave.init("<project>")
mycall = client.get_call("<call_id>")
```

또는 Op를 정의한 후 `call` 방법을 사용할 수 있습니다. 예를 들면 다음과 같습니다:

```python theme={null}
@weave.op
def add(a: int, b: int) -> int:
     return a + b

result, call = add.call(1, 2)
print(call.id)
```

* <b>`obj_ref`</b>: 객체 버전을 가리키는 레퍼런스로, ObjectRef 또는 weave /// URI 문자열입니다.
* <b>`tags`</b>: 제거할 태그 문자열의 목록입니다.
  **반환값:**
  현재 실행 중인 Op의 Call 객체

**예외:**

* <b>`NoCurrentCallError`</b>: tracking이 초기화되지 않았거나 이 메서드가 Op 외부에서 호출된 경우.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L238" />

### <kbd>함수</kbd> `set_aliases`

```python theme={null}
set_aliases(obj_ref: 'ObjectRef | str', alias: 'str | list[str]') → None
```

객체 버전에 하나 이상의 별칭을 설정합니다.

**인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/trace/api.py#L385" />

### <kbd>함수</kbd> `set_view`

```python theme={null}
set_view(
    name: 'str',
    content: 'Content | str',
    extension: 'str | None' = None,
    mimetype: 'str | None' = None,
    metadata: 'dict[str, Any] | None' = None,
    encoding: 'str' = 'utf-8'
) → None
```

현재 call summary의 `_weave.views.<name>`에 맞춤형 뷰를 추가합니다.

* <b>`obj_ref`</b>: 객체 버전에 대한 레퍼런스입니다. `ObjectRef` 또는 weave /// URI 문자열일 수 있습니다.

* <b>`alias`</b>: 설정할 별칭 이름 또는 별칭 이름 목록입니다(예: "production").
  **인수:**

* <b>`name`</b>: 뷰 이름입니다(`summary._weave.views` 아래의 키).

* <b>`content`</b>: `weave.Content` 인스턴스 또는 일반 문자열입니다. 문자열은 제공된 확장자 또는 MIME 유형을 사용해 `Content.from_text`를 통해 래핑됩니다.

* <b>`extension`</b>: `content`가 문자열일 때 사용할 선택적 파일 확장자입니다.

* <b>`mimetype`</b>: `content`가 문자열일 때 사용할 선택적 MIME 유형입니다.

* <b>`metadata`</b>: 텍스트에서 `Content`를 생성할 때 첨부할 선택적 메타데이터입니다.

* <b>`encoding`</b>: 텍스트에서 `Content`를 생성할 때 적용할 텍스트 인코딩입니다.
  **반환값:**
  없음

**예제:**
` import weave`

> > > weave.init("proj")
> > > @weave.op
> > > ... def foo():
> > > ...     weave.set\_view("readme", "# Hello", extension="md")
> > > ...     return 1
> > > foo()

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/../../../../weave/trace/api/thread#L468" />

### <kbd>함수</kbd> `thread`

```python theme={null}
thread(
    thread_id: 'str | None | object' = <object object at 0x7f9716a290d0>
) → Iterator[ThreadContext]
```

컨텍스트 내의 call에서 `thread_id`를 설정하기 위한 컨텍스트 관리자입니다.

**예시:**

```python theme={null}
# thread_id 자동 생성
with weave.thread() as t:
     print(f"Thread ID: {t.thread_id}")
     result = my_function("input")  # 이 call에는 자동 생성된 thread_id가 지정됩니다
     print(f"Current turn: {t.turn_id}")

# 명시적 thread_id
with weave.thread("custom_thread") as t:
     result = my_function("input")  # 이 call에는 thread_id="custom_thread"가 지정됩니다

# 스레딩 비활성화
with weave.thread(None) as t:
     result = my_function("input")  # 이 call에는 thread_id=None이 지정됩니다
```

**인수:**

* <b>`thread_id`</b>: 이 컨텍스트에서 call과 연결할 스레드 식별자입니다. 제공되지 않으면 UUID v7이 자동 생성됩니다. None이면 스레드 추적이 비활성화됩니다.
  **반환값:**

* <b>`ThreadContext`</b>: `thread_id`와 현재 `turn_id`에 접근할 수 있는 객체입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.35/weave/integrations/wandb/wandb.py#L9" />

### <kbd>함수</kbd> `wandb_init_hook`

```python theme={null}
wandb_init_hook() → None
```
