> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-sdk-testing-latest.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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/weave/flow/monitor.py#L187" />

## <kbd>class</kbd> `ClassifierMonitor`

여러 Scorer를 단일 분류기로 병합하는 모니터입니다.

분류기 모니터는 동일한 모델을 대상으로 하는 여러 LLMAsAJudgeScorer의 프롬프트를 하나의 점수화 call로 결합합니다.

**Pydantic 필드:**

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

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

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

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

모니터를 활성화합니다.

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

***

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

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

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

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

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

***

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

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

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

***

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

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

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

병합된 분류기 프롬프트 뒤에 추가할 텍스트입니다.

***

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

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

```python theme={null}
get_prompt_header(op_name: str) → str
```

병합된 분류기 프롬프트 앞에 앞서 추가할 텍스트입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/weave/dataset/dataset.py#L71" />

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

```python theme={null}
from_hf(hf_dataset: 'HFDataset | HFDatasetDict') → Self
```

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/weave/dataset/dataset.py#L220" />

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

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

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

**매개변수:**

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/weave/prompt/prompt.py#L192" />

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

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/weave/prompt/prompt.py#L455" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/weave/trace/op.py#L540" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/weave/evaluation/eval.py#L145" />

## <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 0x7f1615b1b600>, 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.42/weave/trace/op.py#L379" />

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

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

***

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

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

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

***

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

### <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.42/weave/evaluation/eval.py#L390" />

### <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.42/weave/evaluation/eval.py#L426" />

### <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.42/weave/evaluation/eval.py#L465" />

### <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.42/pydantic/_internal/_model_construction.py#L247" />

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

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

***

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

### <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.42/weave/trace/op.py#L304" />

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

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

***

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

## <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.42/weave/evaluation/eval_imperative.py#L684" />

### <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.42/weave/evaluation/eval_imperative.py#L1106" />

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

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

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

***

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

### <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.42/weave/evaluation/eval_imperative.py#L950" />

### <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.42/weave/evaluation/eval_imperative.py#L877" />

### <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.42/weave/evaluation/eval_imperative.py#L989" />

### <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나 점수를 더 이상 로깅할 수 없습니다.

***

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

### <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.42/weave/type_handlers/File/file.py#L30" />

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

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

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/weave/session/session.py#L277" />

## <kbd>class</kbd> `LLM`

LLM API Call 1건입니다. 채팅 OTel span에 해당합니다.

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

* `model`: `<class 'str'>`

* `provider_name`: `<class 'str'>`

* `response_id`: `<class 'str'>`

* `response_model`: `<class 'str'>`

* `output_type`: `<class 'str'>`

* `system_instructions`: `list[str]`

* `usage`: `<class 'session.types.Usage'>`

* `reasoning`: `<class 'session.types.Reasoning'>`

* `finish_reasons`: `list[str]`

* `input_messages`: `list[session.types.Message]`

* `output_messages`: `list[session.types.Message]`

* `media_attachments`: `list[session.types.MediaAttachment]`

* `request_temperature`: `float | None`

* `request_max_tokens`: `int | None`

* `request_top_p`: `float | None`

* `request_frequency_penalty`: `float | None`

* `request_presence_penalty`: `float | None`

* `request_seed`: `int | None`

* `request_stop_sequences`: `list[str]`

* `request_choice_count`: `int | None`

* `started_at`: `datetime.datetime | None`

* `ended_at`: `datetime.datetime | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L320" />

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

```python theme={null}
attach_media(
    content: 'bytes | str' = '',
    uri: 'str' = '',
    file_id: 'str' = '',
    mime_type: 'str' = '',
    modality: 'str' = ''
) → LLM
```

이 LLM Call에 미디어를 첨부합니다.

content, uri 또는 file\_id 중 정확히 하나만 제공해야 합니다. 명시적으로 설정하지 않으면 mime\_type을 기준으로 Modality를 추론합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L362" />

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

```python theme={null}
attach_media_url(url: 'str', modality: 'str' = '') → LLM
```

이 LLM Call에 미디어 URL을 첨부합니다.

호출자에게 업스트림 메시지에서 받은 URL string이 있고 이를 직접 확인하고 싶지 않은 일반적인 경우에는 `attach_media`보다 더 편리합니다. `data:` URL은 `mime_type` + 인라인 콘텐츠(kind=blob)로 파싱되며, 일반 URI는 `kind=uri`가 됩니다. 빈 URL은 무시됩니다. 체이닝할 수 있도록 `self`를 반환합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L492" />

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

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

***

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L310" />

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

```python theme={null}
output(content: 'str') → LLM
```

output\_messages에 assistant 메시지를 추가합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L380" />

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

```python theme={null}
record(
    input_messages: 'list[Message] | None' = None,
    output_messages: 'list[Message] | None' = None,
    media_attachments: 'list[MediaAttachment] | None' = None,
    usage: 'Usage | None' = None,
    reasoning: 'Reasoning | str | None' = None,
    response_id: 'str | None' = None,
    response_model: 'str | None' = None,
    finish_reasons: 'list[str] | None' = None,
    output_type: 'str | None' = None
) → LLM
```

한 번의 호출로 여러 LLM 호출 필드를 설정합니다.

수동으로 계측한 에이전트는 일반적으로 LLM 호출이 끝날 때 여덟 개 이상의 개별 필드(`input_messages`, `output_messages`, `usage`, `response_id` 등)에 값을 설정해 채팅 span을 구성합니다. `record(...)`는 이를 하나의 키워드 호출로 묶어 기록하는 코드를 간결하게 유지합니다.

명시적으로 전달된 필드(non-`None`)만 적용되며, 기존 값은 유지됩니다. `reasoning`은 `Reasoning` 인스턴스 또는 일반 string을 받을 수 있으며(자동으로 래핑됨), 체이닝할 수 있도록 `self`를 반환합니다.

***

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

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

```python theme={null}
think(content: 'str') → LLM
```

추론/사고 과정 내용을 설정합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L254" />

## <kbd>class</kbd> `LogResult`

배치 `log_*` 호출 결과입니다.

**Pydantic 필드:**

* `session_id`: `<class 'str'>`
* `trace_ids`: `list[str]`
* `root_span_ids`: `list[str]`
* `span_count`: `<class 'int'>`

***

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

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

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

**매개변수:**

* <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.42/rich/markdown.py#L549" />

### <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.42/weave/session/types.py#L243" />

## <kbd>class</kbd> `MediaAttachment`

LLM Call에 포함된 미디어 첨부입니다.

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

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

* `kind`: `typing.Literal['blob', 'uri', 'file']`

* `modality`: `<class 'str'>`

* `mime_type`: `<class 'str'>`

* `content`: `bytes | str`

* `uri`: `<class 'str'>`

* `file_id`: `<class 'str'>`

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L158" />

## <kbd>class</kbd> `Message`

대화에서 사용하는 단일 메시지입니다.

두 가지 생성 방식이 지원됩니다.

1. Flat(이전 버전과의 호환성을 위한 방식으로, 일반 텍스트에 사용하기 편리):  `Message(role="assistant", content="Hi there")`

2. 명시적 parts(더 풍부한 표현 지원 — 도구 Call, 추론+텍스트 혼합, 인라인 미디어):  `Message(role="assistant", parts=[TextPart(content="Let me check"),  ToolCallPart(id="c1", name="get_weather", arguments='{...}')])`

`parts`가 비어 있지 않으면 이것이 표준 표현입니다. 비어 있으면 serializer가 flat 필드에서 단일 TextPart(또는 `role="tool"`인 경우 ToolCallResponsePart)를 생성합니다.

**Pydantic 필드:**

* `role`: `typing.Literal['user', 'assistant', 'system', 'tool']`
* `content`: `<class 'str'>`
* `tool_call_id`: `<class 'str'>`
* `tool_name`: `<class 'str'>`
* `parts`: `list[typing.Annotated[session.types.TextPart | session.types.ReasoningPart | session.types.ToolCallPart | session.types.ToolCallResponsePart | session.types.BlobPart | session.types.UriPart | session.types.FilePart, FieldInfo(annotation=NoneType, required=True, discriminator='type')]]`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L192" />

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

```python theme={null}
assistant(
    text: 'str' = '',
    tool_calls: 'list[ToolCallPart] | None' = None
) → Message
```

선택적 텍스트와 도구 Call을 포함하는 어시스턴트 메시지를 구축합니다.

단순한 응답에는 일반 텍스트를 사용하고, 어시스턴트가 하나 이상의 도구를 요청하는 경우 `tool_calls`를 전달하세요. 둘 다 있으면 텍스트가 앞부분의 `TextPart`로 출력되고, 이어서 각 `ToolCallPart`가 따라와 채팅 뷰에 인라인으로 렌더링됩니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L187" />

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

```python theme={null}
system(text: 'str') → Message
```

일반 텍스트로 시스템 메시지를 구축합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L214" />

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

```python theme={null}
tool_result(call_id: 'str', output: 'Any') → Message
```

이전에 요청된 도구 Call에 대한 도구 결과 메시지를 구축합니다.

`output`은 string, dict, list, scalar 또는 `None`일 수 있으며, 내부적으로 `ToolCallResponsePart`는 string이 아닌 값을 JSON으로 인코딩합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L182" />

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

```python theme={null}
user(text: 'str') → Message
```

일반 텍스트에서 사용자 메시지를 생성합니다.

***

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

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

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

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

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

**Pydantic 필드:**

* `name`: `str | None`

* `description`: `str | None`

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

* `messages`: `list[dict]`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/weave/flow/monitor.py#L43" />

## <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[typing.Union[typing.Literal['genai.turn_ended'], 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.42/weave/flow/monitor.py#L92" />

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

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

모니터를 활성화합니다.

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

***

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

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

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

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

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

***

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

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

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

***

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

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

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

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

**속성:**

* <b>`name`</b> (str | None):  객체를 사람이 읽기 쉬운 형태로 식별하는 이름입니다.
* <b>`description`</b> (str | None):  객체가 나타내는 내용을 설명합니다.
* <b>`ref`</b> (ObjectRef | None):  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.42/weave/object/obj.py#L65" />

### <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.42/weave/object/obj.py#L108" />

### <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.42/weave/object/obj.py#L91" />

### <kbd>classmethod</kbd> `strip_weave_serialization_metadata`

```python
strip_weave_serialization_metadata(data: Any) → Any
````

dict 입력에서 Weave 직렬화 메타데이터를 제거합니다.

Weave 직렬화는 유형 재구성을 위해 dict에 \_type, \_class\_name, \_bases를 추가합니다. 이는 실제 모델 필드가 아니므로 extra="forbid"를 사용하는 Pydantic 검증 전에 제거해야 합니다.

***

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

## <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.42/../../../../weave/trace/refs/__init__" />

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

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

***

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

***

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

***

#### <kbd>속성</kbd> is\_digest\_resolved

***

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

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

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

***

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

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

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

***

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

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

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

***

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

### <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.42/weave/trace/refs.py#L93" />

### <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.42/weave/trace/refs.py#L294" />

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

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

***

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

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

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

***

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

### <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.42/weave/trace/refs.py#L176" />

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

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

***

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

### <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.42/weave/trace/refs.py#L170" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/weave/flow/saved_view.py#L496" />

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

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

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/weave/flow/saved_view.py#L836" />

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/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.42/weave/flow/scorer.py#L57" />

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

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

***

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

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

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

***

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

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

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

***

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L763" />

## <kbd>class</kbd> `Session`

대화 세션입니다. conversation\_id를 기준으로 turn을 그룹화합니다(span 없음).

`continue_parent_trace`는 이 세션이 생성하는 turn의 트레이스 격리 여부를 제어합니다. 기본값 `False`는 각 turn이 자체 OTel 트레이스를 시작한다는 의미입니다(독립형 Agents 탭 뷰에 적합한 선택). 애플리케이션에 에이전트 호출을 포함해야 하는 외부 트레이스(예: fastapi-instrumented request)가 있는 경우에는 `True`로 설정하세요.

**Pydantic 필드:**

* `session_id`: `<class 'str'>`
* `session_name`: `<class 'str'>`
* `agent_name`: `<class 'str'>`
* `model`: `<class 'str'>`
* `include_content`: `<class 'bool'>`
* `continue_parent_trace`: `<class 'bool'>`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L816" />

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

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

***

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L790" />

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

```python theme={null}
start_turn(
    user_message: 'str' = '',
    model: 'str' = '',
    agent_name: 'str' = ''
) → Turn
```

새 turn을 생성합니다. 이전 turn이 아직 열려 있으면 자동으로 종료합니다.

컨텍스트 관리자 사용 여부와 관계없이 `get_current_turn()`를 통해 turn이 표시되도록 `_current_turn` contextvar를 설정합니다. 이 세션의 `continue_parent_trace`를 전파합니다.

***

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

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

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/weave/session/session.py#L533" />

## <kbd>class</kbd> `SubAgent`

turn 내에서 위임된 에이전트 호출입니다.

같은 트레이스 내의 중첩된 `invoke_agent` OTel span에 해당합니다.

**Pydantic 필드:**

* `name`: `<class 'str'>`
* `model`: `<class 'str'>`
* `agent_id`: `<class 'str'>`
* `agent_description`: `<class 'str'>`
* `agent_version`: `<class 'str'>`
* `started_at`: `datetime.datetime | None`
* `ended_at`: `datetime.datetime | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L592" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L549" />

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

```python theme={null}
llm(
    model: 'str' = '',
    provider_name: 'str' = '',
    system_instructions: 'list[str] | None' = None
) → LLM
```

이 하위 에이전트 내에서 LLM 호출을 시작합니다.

`_current_llm` contextvar를 설정하여 컨텍스트 관리자를 사용하든 사용하지 않든 `get_current_llm()`를 통해 LLM에 접근할 수 있도록 합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L569" />

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

```python theme={null}
tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
```

이 하위 에이전트에서 도구 실행을 시작합니다.

***

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

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

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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.42/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.42/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.42/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.42/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.42/weave/trace/util.py#L133" />

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

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

***

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

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

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

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

### <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.42/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.42/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.42/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.42/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.42/weave/session/session.py#L187" />

## <kbd>class</kbd> `Tool`

도구 실행 한 건을 나타냅니다. `execute_tool` OTel span에 매핑됩니다.

`arguments` 및 `result`는 `JSONString` annotation을 사용합니다. 호출자는 dict / list / scalar를 부여할 수 있으며, SDK는 생성 시점이나 값 부여 시점에 이를 JSON으로 인코딩합니다. 저장되는 값은 항상 string이며, GenAI semconv의 wire format과 일치합니다.

**Pydantic 필드:**

* `name`: `<class 'str'>`
* `arguments`: `<class 'str'>`
* `result`: `<class 'str'>`
* `tool_call_id`: `<class 'str'>`
* `tool_type`: `<class 'str'>`
* `tool_description`: `<class 'str'>`
* `tool_definitions`: `<class 'str'>`
* `duration_ms`: `<class 'int'>`
* `started_at`: `datetime.datetime | None`
* `ended_at`: `datetime.datetime | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L241" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L627" />

## <kbd>class</kbd> `Turn`

사용자와 에이전트가 한 차례 주고받는 상호작용입니다. `invoke_agent` OTel span에 매핑됩니다.

기본적으로 각 턴은 자체 OTel 트레이스를 시작하므로(`continue_parent_trace=False`) Agents 탭에는 턴마다 하나의 트레이스가 표시됩니다. 외부 트레이스가 이미 활성화되어 있고 에이전트 호출을 그 안에 중첩하려면 Session(또는 Turn에 직접)에서 `continue_parent_trace=True`를 설정하세요. 예를 들어 fastapi-instrumented request 내부에서 사용하는 경우입니다.

**Pydantic Fields:**

* `agent_name`: `<class 'str'>`
* `model`: `<class 'str'>`
* `agent_id`: `<class 'str'>`
* `agent_description`: `<class 'str'>`
* `agent_version`: `<class 'str'>`
* `messages`: `list[session.types.Message]`
* `spans`: `list[session.session.LLM | session.session.Tool | session.session.SubAgent]`
* `continue_parent_trace`: `<class 'bool'>`
* `started_at`: `datetime.datetime | None`
* `ended_at`: `datetime.datetime | None`

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L717" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L660" />

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

```python theme={null}
llm(
    model: 'str' = '',
    provider_name: 'str' = '',
    system_instructions: 'list[str] | None' = None
) → LLM
```

LLM Call을 시작합니다(채팅 span, 이 턴의 하위 span).

컨텍스트 관리자를 사용하는지와 관계없이 `get_current_llm()`을 통해 LLM을 확인할 수 있도록 `_current_llm` contextvar를 설정합니다.

***

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L684" />

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

```python theme={null}
subagent(name: 'str', model: 'str' = '') → SubAgent
```

하위 에이전트 호출을 시작합니다(중첩된 invoke\_agent span, 동일한 트레이스).

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L680" />

### <kbd>방법</kbd> `도구`

```python theme={null}
tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
```

도구 실행을 시작합니다(`execute&#95;tool` span, 이 턴의 하위 span).

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L655" />

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

```python theme={null}
user(content: 'str') → Turn
```

턴 중간에 사용자 메시지를 추가합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/types.py#L227" />

## <kbd>class</kbd> `Usage`

LLM Call의 토큰 사용량입니다.

**Pydantic Fields:**

* `input_tokens`: `<class 'int'>`
* `output_tokens`: `<class 'int'>`
* `reasoning_tokens`: `<class 'int'>`
* `cache_creation_input_tokens`: `<class 'int'>`
* `cache_read_input_tokens`: `<class 'int'>`

***

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

### <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.42/weave/trace/op.py#L1460" />

### <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.42/../../../../weave/trace/api/attributes#L460" />

### <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.42/weave/session/session.py#L968" />

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

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

contextvar의 현재 LLM Call을 종료합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L954" />

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

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

contextvar에서 현재 세션을 종료합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L961" />

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

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

contextvar의 현재 턴을 종료합니다.

***

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

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

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

Weave 로깅을 중지합니다.

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

***

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

### <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.42/weave/trace/api.py#L330" />

### <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.42/weave/trace/api.py#L182" />

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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 객체를 반환합니다. 추적이 초기화되지 않았거나 이 방법이 Op 외부에서 호출된 경우에는 None을 반환합니다.

**참고:**

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L985" />

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

```python theme={null}
get_current_llm() → LLM | None
```

contextvar에서 활성 상태의 LLM Call을 반환하거나, 없으면 None을 반환합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L975" />

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

```python theme={null}
get_current_session() → Session | None
```

contextvar에서 활성 세션을 반환하며, 없으면 None을 반환합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L980" />

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

```python theme={null}
get_current_turn() → Turn | None
```

contextvar의 활성 턴을 반환하거나, 없으면 None을 반환합니다.

***

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

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

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

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

**인수:**

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

***

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

### <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.42/weave/trace/api.py#L41" />

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

```python theme={null}
init(
    project_name: 'str',
    settings: 'UserSettings | dict[str, Any] | None' = None,
    autopatch_settings: 'AutopatchSettings | None' = None,
    postprocess_inputs: 'PostprocessInputsFunc | None' = None,
    postprocess_output: 'PostprocessOutputFunc | None' = None,
    attributes: 'dict[str, Any] | 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의 자체 후처리 이후에 실행됩니다. 순서는 항상 다음과 같습니다. 1. op별 후처리 2. 클라이언트 수준 후처리

* <b>`project_name`</b>: 로그를 기록할 Weights & Biases 팀과 프로젝트 이름입니다. 팀을 지정하지 않으면 기본 엔터티가 사용됩니다. 기본 엔터티를 확인하거나 업데이트하려면 W\&B Models 문서의 [User Settings](https://docs.wandb.ai/platform/app/settings-page/user-settings#default-team)를 참고하세요.
* <b>`settings`</b>: 전반적인 Weave 클라이언트 설정입니다. `UserSettings` 인스턴스이거나, 다음 키 중 원하는 항목을 포함하는 dict일 수 있습니다(모두 선택 사항). 모든 설정은
  접두사 WEAVE\_를 사용하는 환경 변수를 통해서도 구성할 수 있습니다(예: WEAVE\_DISABLED=true). 사용 가능한 설정: - `disabled` (bool): 모든 함수의 트레이스를 비활성화합니다. 기본값: `False` - `print_call_link`
  (bool): ops에 대한 Weave UI 링크를 터미널에 출력합니다. 기본값: `True` - `log_level` (str): 로그로 남길 정보 유형을 설정합니다(`DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`). 기본값: `INFO` -
  `display_viewer` (str): Weave가 콘솔에 객체를 표시하는 방식을 제어합니다(`auto`, `rich`, `print`). 기본값: `auto` - `capture_code` (bool): 트레이스된 ops의 코드를 Weave 프로젝트에 캡처합니다.
  기본값: `True` - `implicitly_patch_integrations` (bool): 지원되는 라이브러리에 자동으로 패치를 적용합니다. 기본값: `True` - `redact_pii` (bool): 이메일, 전화번호,
  신용카드 같은 민감한 정보를 모든 트레이스 데이터에서 스캔한 뒤, 서버로 전송하기 전에 플레이스홀더 값으로 대체합니다. `presidio-analyzer` 및 `presidio-anonymizer` 패키지가 필요합니다.
* <b>`Default`</b>: `False` - `redact_pii_fields` (list\[str]): `redact_pii`가 True일 때 마스킹할 PII 엔터티 유형을 지정합니다. 비어 있으면 Presidio의 기본 집합을 사용합니다. 예시  \['EMAIL','PHONE\_NUMBER','CREDIT\_CARD','US\_SSN']. 전체 목록은  [https://microsoft.github.io/presidio/supported\_entities/](https://microsoft.github.io/presidio/supported_entities/)에서 확인하세요.
* <b>`Default`</b>: `[]` - `redact_pii_exclude_fields` (list\[str]): 제외할 PII 엔터티 유형입니다. Default: `[]` - `capture_client_info` (bool): Python/SDK 버전 정보를 캡처합니다. Default: `True` -
  `capture_system_info` (bool): OS 정보를 캡처합니다. Default: `True` - `client_parallelism` (int): 백그라운드 작업용 워커 수입니다. Default: `auto` - `use_server_cache` (bool): 서버 응답의 로컬
  디스크 캐싱을 활성화합니다. - `server_cache_size_limit` (int): 바이트 단위 캐시 크기 한도입니다. Default: `1_000_000_000` - `server_cache_dir` (str): 서버 캐시 디렉터리입니다. Default: `temporary` -
  `scorers_dir` (str): Scorer 모델 checkpoint 디렉터리입니다. Default: `~/.cache/wandb/weave-scorers` - `max_calls_queue_size` (int): 최대 큐 크기입니다(0 = 무제한). Default: `100_000` -
  `retry_max_interval` (float): 초 단위 최대 재시도 간격입니다. Default: `300` - `retry_max_attempts` (int): 최대 재시도 횟수입니다. Default: `3` - `enable_disk_fallback` (bool): 누락된
  항목을 디스크에 기록합니다. Default: `True` - `use_parallel_table_upload` (bool): 큰 테이블에 대해 병렬 청크 업로드를 활성화합니다. False이면 테이블은 더 작은 청크로 순차적으로 업로드됩니다.
* <b>`기본값`</b>: `True` - `http_timeout` (float): HTTP 요청이 완료될 때까지 기다리는 최대 시간(초)입니다. 여기에는 연결 시간, 데이터 전송 시간, 서버 처리 시간이 포함됩니다. 네트워크가 느리거나 큰 페이로드를 처리하는 경우 값을 늘리세요.
* <b>`기본값`</b>: `30.0` - `use_stainless_server` (bool): 더 나은 타입 안전성, 자동 재시도, 향상된 오류 처리를 제공하는 Stainless에서 생성한 HTTP 클라이언트를 사용합니다. 이는 실험적 기능이며 향후 버전에서 기본값이 될 수 있습니다.
* <b>`기본값`</b>: `False` - `use_calls_complete` (bool): 별도의 시작/종료 Request 대신, 완료된 Call 데이터(시작 및 종료)를 하나의 Request로 일괄 처리하는 최적화된 쓰기 경로를 사용합니다. 이렇게 하면 서버 부하를 줄이고 성능을 개선할 수 있으며, 특히 수명이 짧은 Ops에서 효과적입니다.
* <b>`기본값`</b>: `True`
* <b>`autopatch_settings`</b>: (사용 중단) autopatch 인테그레이션용 설정입니다. 대신 명시적으로 패칭하세요.
* <b>`postprocess_inputs`</b>: 이 클라이언트에서 트레이스되는 모든 op의 입력에 적용되는 함수입니다.
* <b>`postprocess_output`</b>: 이 클라이언트에서 트레이스한 모든 op의 출력에 적용되는 함수입니다.
* <b>`attributes`</b>: 이 클라이언트에서 생성되는 모든 트레이스에 적용되는 속성 딕셔너리입니다.
  **반환값:**
  Weave 클라이언트입니다.

***

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

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

```python theme={null}
link_prompt_to_registry(
    prompt: 'LinkablePrompt',
    target_path: 'str',
    aliases: 'Sequence[str] | None' = None
) → LinkAssetToRegistryRes
```

게시된 prompt 버전을 레지스트리에 연결합니다.

**인수:**

* <b>`prompt`</b>: 게시된 prompt, `ObjectRef`, 또는 정규화된 weave ///... URI string입니다.

* <b>`target_path`</b>: `<registry_project>/<portfolio_name>` 형식의 레지스트리 대상 경로입니다. 예: `wandb-registry-prompts/my-prompt-collection`.

* <b>`aliases`</b>: 생성된 레지스트리 버전에 연결할 선택 사항인 별칭입니다.
  **반환값:**

* <b>`LinkAssetToRegistryRes`</b>: registry-link 엔드포인트에서 파싱한 응답입니다.

***

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

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

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

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

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

***

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

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

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

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

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

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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
    ... )

    Logging with attributes and display name:
    >>> 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"
    ... )

    Logging a failed operation:
    >>> try:
    ...     result = risky_operation()
    ... except Exception as e:
    ...     call = weave.log_call(
    ...         op="risky_operation",
    ...         inputs={},
    ...         output=None,
    ...         exception=e
    ...     )

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

    Logging without adding to call stack:
    >>> 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.42/weave/session/session.py#L1166" />

### <kbd>function</kbd> `log_session`

```python
log_session(
    turns: 'list[Turn]',
    session_id: 'str' = '',
    session_name: 'str' = '',
    agent_name: 'str' = '',
    model: 'str' = '',
    include_content: 'bool' = True,
    continue_parent_trace: 'bool' = False
) → LogResult
````

명령형 방식으로 전체 세션을 내보냅니다.

각 턴의 `.spans` 속성은 해당 턴의 하위 span을 제공합니다. `session_id`가 비어 있으면 자동으로 생성됩니다. 기본적으로 각 턴에는 자체 OTel 트레이스가 할당됩니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L1085" />

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

```python theme={null}
log_turn(
    session_id: 'str',
    agent_name: 'str' = '',
    session_name: 'str' = '',
    model: 'str' = '',
    messages: 'list[Message] | None' = None,
    spans: 'list[LLM | Tool | SubAgent] | None' = None,
    started_at: 'datetime | None' = None,
    ended_at: 'datetime | None' = None,
    include_content: 'bool' = True,
    continue_parent_trace: 'bool' = False
) → LogResult
```

명령형 방식으로 하나의 턴과 해당 하위 span들을 OTel로 내보냅니다.

컨텍스트 관리자를 사용할 수 없는 경우(상태를 유지하지 않는 컨테이너, 콜백, 큐 워커)에 사용하세요. 전달되는 각 하위 span에는 `started_at` / `ended_at`가 설정되어 있어야 하며, 내보내는 OTel span의 타임스탬프는 이 필드에서 가져옵니다. 턴이 자체 값을 제공하지 않으면 가장 이른/가장 늦은 하위 span의 타임스탬프를 사용하고, 그것도 없으면 `now()`를 사용합니다.

***

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

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

```python theme={null}
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.42/weave/trace/urls.py#L14" />

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

```python theme={null}
otel_traces_endpoint(base_url: str | None = None) → str
```

Weave GenAI 트레이스 수집을 위한 전체 OTLP HTTP 엔드포인트 URL을 반환합니다.

외부 호출자(예: BatchSpanProcessor가 export를 자동으로 삭제하는 동작에 의존하기 전에 수집 엔드포인트에 도달할 수 있는지 확인하려는 부팅 시점 프로브)는 URL을 직접 구성하지 말고 이것을 호출해야 합니다. 경로는 SDK가 관리하며 변경될 수 있습니다.

* <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 같은 장기 실행 오퍼레이션에 유용합니다.
  **인수:**

***

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

### <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>`base_url`</b>: 트레이스 서버의 기본 URL입니다. 기본값은  `weave_trace_server_url()`입니다.
  **인수:**

* <b>`obj`</b>: 저장하고 버전 관리할 객체입니다.

* <b>`name`</b>: 객체를 저장할 이름입니다.

* <b>`tags`</b>: 게시된 객체 버전에 추가할 선택적 태그 목록입니다.

* <b>`aliases`</b>: 게시된 객체 버전에 설정할 선택적 별칭 목록입니다.
  **반환값:**
  저장된 객체를 가리키는 Weave Ref입니다.

***

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

### <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.42/weave/trace/api.py#L318" />

### <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.42/weave/trace/api.py#L280" />

### <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>: 제거할 별칭 이름 또는 별칭 이름 목록입니다.
  **인수:**

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/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>: 추적이 초기화되지 않았거나 이 메서드가 Op 외부에서 호출된 경우.

***

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

### <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.42/weave/trace/api.py#L480" />

### <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.42/weave/session/session.py#L903" />

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

```python theme={null}
start_llm(
    model: 'str' = '',
    provider_name: 'str' = '',
    system_instructions: 'list[str] | None' = None
) → LLM
```

LLM Call을 생성하고 활성화합니다. 사용 가능하면 현재 턴을 사용합니다.

활성 턴이 없으면 분리된 LLM을 반환합니다(contextvar가 설정되지 않음).

`provider_name`을 명시적으로 전달하세요. SDK는 모델 식별자에서 이를 추론하지 않습니다. 접두사 기반 추측은 사용자 파인튜닝을 잘못된 대상으로 귀속시키고(예: 이름이 `text-...`인 모델), 나중에 수정 비용이 큰 가정을 향후 모델 이름에 대해 telemetry에 내장하게 됩니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L857" />

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

```python theme={null}
start_session(
    agent_name: 'str' = '',
    model: 'str' = '',
    session_id: 'str' = '',
    session_name: 'str' = '',
    include_content: 'bool' = True,
    continue_parent_trace: 'bool' = False
) → Session
```

세션을 생성하고 활성화합니다. 모듈 간에 액세스할 수 있도록 contextvar를 설정합니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L943" />

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

```python theme={null}
start_subagent(name: 'str', model: 'str' = '') → SubAgent
```

하위 에이전트 호출 span을 생성합니다.

SubAgent의 OTel span은 OTel 컨텍스트에서 현재 활성 span의 자식으로 자동 설정됩니다. 일반적으로 활성화된 Turn span이 있으면 그 자식 span이 됩니다. 형태는 `start_tool`과 같으며, 부모-자식 전파는 OTel 컨텍스트가 처리하므로 명시적으로 위임할 필요가 없습니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L932" />

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

```python theme={null}
start_tool(name: 'str', arguments: 'str' = '', tool_call_id: 'str' = '') → Tool
```

도구 실행 span을 생성합니다.

도구의 OTel span은 OTel 컨텍스트에서 현재 활성화된 span의 하위 span으로 자동 설정됩니다. 일반적으로 활성화된 턴 span이 있으면 그 하위 span이 됩니다. 턴을 명시적으로 위임할 필요는 없습니다. 부모-자식 전파는 Session SDK의 contextvars가 아니라 OTel 컨텍스트를 통해 이루어집니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/session/session.py#L879" />

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

```python theme={null}
start_turn(
    user_message: 'str' = '',
    model: 'str' = '',
    agent_name: 'str' = ''
) → Turn
```

턴을 생성하고 활성화합니다. 사용 가능한 경우 현재 세션을 사용합니다.

활성 세션이 없으면 contextvar에 설정되지 않은, 연결이 끊긴 Turn을 반환합니다. 즉, `get_current_turn()`은 None을 반환합니다. contextvar 기반으로 모듈 간 액세스가 필요하다면 대신 `session.start_turn()`을 사용하세요.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/../../../../weave/trace/api/thread#L563" />

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

```python theme={null}
thread(
    thread_id: 'str | object | None' = <object object at 0x7f1615fc8990>
) → Iterator[ThreadContext]
```

컨텍스트 내의 call에서 `thread&#95;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&#95;id`와 현재 `turn&#95;id`에 접근할 수 있는 객체입니다.

***

<SourceLink url="https://github.com/wandb/weave/blob/v0.52.42/weave/integrations/wandb/wandb.py#L9" />

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

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