> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-feature-automate-reference-docs-generation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Weave client

The `WeaveClient` 클래스는 Weave 서비스와 상호 작용하기 위한 주요 인터페이스입니다. 호출, 데이터셋, 모델 및 기타 Weave 객체를 관리하는 메서드를 제공합니다.

## 생성자

```python
from weave import WeaveClient

client = WeaveClient(project: str)
```

### 매개변수

* **project** (`str`) - "entity/project" 형식의 프로젝트 식별자

## 메서드

### add\_cost

호출에 사용자 정의 비용 추적을 추가합니다.

```python
client.add_cost(
    costs: Dict[str, float],
    call_id: Optional[str] = None
) -> None
```

### 매개변수

* **costs** (`Dict[str, float]`) - 비용 메트릭 사전 (예: `{"prompt_tokens": 100, "completion_tokens": 50}`)
* **call\_id** (`Optional[str]`) - 비용을 추가할 호출 ID. None인 경우 현재 호출 컨텍스트를 사용합니다.

### 예시

```python
client.add_cost({
    "prompt_tokens": 100,
    "completion_tokens": 50,
    "total_cost": 0.002
})
```

### query\_costs

다양한 필터로 호출 비용을 조회합니다.

```python
client.query_costs(
    project_id: Optional[str] = None,
    filters: Optional[Dict] = None
) -> List[Dict]
```

### purge\_costs

ID로 사용자 정의 비용을 제거합니다.

```python
client.purge_costs(cost_ids: List[str]) -> None
```

### get\_call

ID로 특정 호출을 검색합니다.

```python
call = client.get_call(call_id: str) -> Call
```

### 매개변수

* **call\_id** (`str`) - 호출의 고유 식별자

### 반환

* **Call** - 호출 세부 정보가 포함된 Call 객체

### 예시

```python
call = client.get_call("call_123456")
print(call.inputs)
print(call.output)
```

### get\_calls

필터를 사용하여 여러 호출을 조회합니다.

```python
calls = client.get_calls(
    filter: Optional[CallsFilter] = None,
    limit: Optional[int] = None,
    offset: Optional[int] = None
) -> List[Call]
```

### 매개변수

* **filter** (`Optional[CallsFilter]`) - 호출에 대한 필터 기준
* **limit** (`Optional[int]`) - 반환할 최대 호출 수
* **offset** (`Optional[int]`) - 건너뛸 호출 수

### delete

호출을 삭제합니다.

```python
# Delete a single call
call.delete()

# Delete multiple calls
client.delete_calls(call_ids: List[str])
```

### set\_display\_name

호출의 표시 이름을 설정하거나 업데이트합니다.

```python
call.set_display_name(display_name: str) -> None
```

## 데이터셋 작업하기

### save

데이터셋을 Weave에 저장합니다.

```python
dataset = weave.Dataset(rows=[...])
weave.publish(dataset, "my-dataset")
```

### get

이름으로 데이터셋을 검색합니다.

```python
dataset = weave.ref("my-dataset").get()
```

## 모델 작업하기

### save

모델을 Weave에 저장합니다.

```python
model = MyModel(...)
weave.publish(model, "my-model")
```

### get

참조로 모델을 검색합니다.

```python
model = weave.ref("my-model").get()
```

<Note>
  전체 예제와 고급 사용법은 다음을 참조하세요 [Weave 문서](https://weave-docs.wandb.ai/).
</Note>
