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

# Api

export const GitHubLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="github-source-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub 소스 코드
  </a>;

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/apis/public/api.py" />

## <kbd>class</kbd> `Api`

W\&B 서버를 쿼리할 때 사용됩니다.

**예시:**

```python theme={null}
import wandb

wandb.Api()
```

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

```python theme={null}
__init__(
    overrides: 'dict[str, Any] | None' = None,
    timeout: 'int | None' = None,
    api_key: 'str | None' = None
) → None
```

API를 초기화합니다.

**매개변수:**

* `overrides`:  `base_url`을 설정할 수 있습니다.
* `https`: //api.wandb.ai`가 아닌 다른 W&B 서버를 `using`하는 경우입니다. `entity`, `프로젝트`, `run\`의 기본값도 설정할 수 있습니다.
* `timeout`:  API 요청의 HTTP 타임아웃(초)입니다. 지정하지 않으면 기본 타임아웃이 사용됩니다.
* `api_key`:  인증에 사용할 API 키입니다. 제공하지 않으면 현재 환경 또는 설정의 API 키를 사용합니다. 제공되었거나 환경에 설정된 API 키가 없으면 API 키 입력을 요청합니다.

***

### <kbd>속성</kbd> Api.client

클라이언트 객체를 반환합니다.

**반환값:**

* `RetryingClient`: 클라이언트 속성 값입니다.

***

### <kbd>속성</kbd> Api.default\_entity

기본 W\&B entity를 반환합니다.

**반환값:**

* `str | None`: default\_entity 속성의 값입니다.

***

### <kbd>속성</kbd> Api.user\_agent

W\&B의 공개 사용자 에이전트를 반환합니다.

**반환값:**

* `str`: `user_agent` 속성 값.

***

### <kbd>속성</kbd> Api.viewer

viewer 객체를 반환합니다.

**예외:**

* `ValueError`: W\&B에서 viewer 데이터를 가져올 수 없는 경우.
* `requests.RequestException`: GraphQL 요청 중 오류가 발생한 경우.

**반환값:**

* `User`: viewer 속성 값.

***

### <kbd>방법</kbd> `Api.artifact`

```python theme={null}
artifact(name: 'str', type: 'str | None' = None)
```

단일 artifact를 반환합니다.

**인수:**

* `name`:  artifact의 이름입니다. artifact 이름은 최소한 artifact가 로깅된 프로젝트 이름, artifact 이름, 그리고 artifact의 버전 또는 alias로 구성된 filepath와 유사합니다. 선택적으로 artifact를 로깅한 entity를 접두사로 추가한 뒤 슬래시(`/`)를 붙일 수 있습니다. 이름에 entity를 지정하지 않으면 Run 또는 API 설정의 entity가 사용됩니다.
* `type`:  가져올 artifact의 유형입니다.

**반환값:**
`Artifact` 객체입니다.

**예외:**

* `ValueError`:  artifact 이름이 지정되지 않은 경우.
* `ValueError`:  artifact 유형이 지정되었지만 가져온 artifact의 유형과 일치하지 않는 경우.

**예시:**
다음 코드 스니펫에서 "entity", "project", "artifact", "version", 및 "alias"는 각각 W\&B entity, artifact가 속한 프로젝트 이름, artifact 이름, 그리고 artifact의 버전을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

# 프로젝트, artifact 이름, artifact의 alias를 지정합니다
wandb.Api().artifact(name="project/artifact:alias")

# 프로젝트, artifact 이름, 특정 artifact 버전을 지정합니다
wandb.Api().artifact(name="project/artifact:version")

# entity, 프로젝트, artifact 이름, artifact의 alias를 지정합니다
wandb.Api().artifact(name="entity/project/artifact:alias")

# entity, 프로젝트, artifact 이름, 특정 artifact 버전을 지정합니다
wandb.Api().artifact(name="entity/project/artifact:version")
```

**참고:**

> 이 메서드는 외부에서만 사용하도록 되어 있습니다. wandb 저장소 코드 내부에서 `api.artifact()`를 호출하지 마세요.

***

### <kbd>방법</kbd> `Api.artifact_collection`

```python theme={null}
artifact_collection(type_name: 'str', name: 'str') → ArtifactCollection
```

유형별 단일 artifact 컬렉션을 반환합니다.

반환된 `ArtifactCollection` 객체를 사용해 해당 컬렉션의 특정 artifact에 대한 정보를 조회하는 등 추가 작업을 수행할 수 있습니다.

**인수:**

* `type_name`: 가져올 artifact 컬렉션의 유형입니다.
* `name`: artifact 컬렉션 이름입니다. 필요에 따라 artifact를 로깅한 entity를 접두사로 추가한 뒤 슬래시(`/`)를 붙일 수 있습니다.

**반환값:**
`ArtifactCollection` 객체입니다.

**예시:**
다음 코드 스니펫에서 "type", "entity", "project", "artifact\_name"는 각각 컬렉션 유형, 사용자의 W\&B entity, artifact가 속한 프로젝트 이름, artifact 이름을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

collections = wandb.Api().artifact_collection(
    type_name="type", name="entity/project/artifact_name"
)

# 컬렉션의 첫 번째 artifact를 가져옵니다.
artifact_example = collections.artifacts()[0]

# artifact의 내용을 지정된 루트 디렉터리에 다운로드합니다.
artifact_example.download()
```

***

### <kbd>방법</kbd> `Api.artifact_collection_exists`

```python theme={null}
artifact_collection_exists(name: 'str', type: 'str') → bool
```

지정된 프로젝트와 entity 내에 artifact collection이 존재하는지 여부입니다.

**매개변수:**

* `name`:  artifact collection 이름입니다. 선택적으로 artifact를 로깅한 entity를 접두사로 붙인 다음 슬래시(`/`)를 추가할 수 있습니다. entity 또는 프로젝트를 지정하지 않으면 override 매개변수가 있는 경우 이를 바탕으로 collection을 추론합니다. 그렇지 않으면 entity는 User Settings에서 가져오고 프로젝트는 기본적으로 "uncategorized"로 설정됩니다.
* `type`:  artifact collection의 유형입니다.

**반환값:**
artifact collection이 존재하면 True, 그렇지 않으면 False를 반환합니다.

**예시:**
다음 코드 스니펫에서 "type"과 "collection\_name"은 각각 artifact collection의 유형과 collection의 이름을 의미합니다.

```python theme={null}
import wandb

wandb.Api.artifact_collection_exists(type="type", name="collection_name")
```

***

### <kbd>방법</kbd> `Api.artifact_collections`

```python theme={null}
artifact_collections(
    project_name: 'str',
    type_name: 'str',
    per_page: 'int' = 50,
    start: 'str | None' = None
) → ArtifactCollections
```

조건에 맞는 아티팩트 컬렉션 목록을 반환합니다.

**매개변수:**

* `project_name`:  필터링할 프로젝트 이름입니다.
* `type_name`:  필터링할 artifact 유형 이름입니다.
* `per_page`:  쿼리 페이지네이션의 페이지 크기를 설정합니다.  일반적으로 이 값을 변경할 이유는 없습니다.
* `start`:  이전 paginator의 `.cursor` 속성에서 캡처한 값을 사용해 이전 쿼리를 다시 이어가기 위한 페이지네이션 커서입니다.

**반환값:**
반복 가능한 `ArtifactCollections` 객체입니다.

***

### <kbd>방법</kbd> `Api.artifact_exists`

```python theme={null}
artifact_exists(name: 'str', type: 'str | None' = None) → bool
```

지정된 프로젝트와 entity 내에 artifact 버전이 존재하는지 여부입니다.

**매개변수:**

* `name`:  artifact의 이름입니다. artifact의 entity와 프로젝트를 접두사로 추가합니다. artifact의 버전 또는 alias를 콜론(:)과 함께 뒤에 붙입니다. entity 또는 프로젝트를 지정하지 않으면, 값이 설정되어 있는 경우 W\&B가 override 매개변수를 사용합니다. 그렇지 않으면 entity는 User Settings에서 가져오고 프로젝트는 "Uncategorized"로 설정됩니다.
* `type`:  artifact의 유형입니다.

**반환값:**
artifact 버전이 존재하면 True, 그렇지 않으면 False입니다.

**예시:**
다음 코드 스니펫에서 "entity", "project", "artifact", "version", "alias"는 각각 W\&B entity, artifact가 속한 프로젝트 이름, artifact 이름, 그리고 artifact 버전을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

wandb.Api().artifact_exists("entity/project/artifact:version")
wandb.Api().artifact_exists("entity/project/artifact:alias")
```

***

### <kbd>방법</kbd> `Api.artifact_type`

```python theme={null}
artifact_type(type_name: 'str', project: 'str | None' = None) → ArtifactType
```

일치하는 `ArtifactType`을 반환합니다.

**매개변수:**

* `type_name`:  조회할 artifact 유형의 이름입니다.
* `project`:  지정한 경우, 필터링할 프로젝트 이름 또는 경로입니다.

**반환값:**
`ArtifactType` 객체입니다.

***

### <kbd>방법</kbd> `Api.artifact_types`

```python theme={null}
artifact_types(
    project: 'str | None' = None,
    start: 'str | None' = None
) → ArtifactTypes
```

일치하는 artifact 유형 모음을 반환합니다.

**매개변수:**

* `project`:  필터링할 프로젝트 이름 또는 경로입니다.
* `start`:  이전 paginator의 `.cursor` 속성에서 캡처한 값으로, 이전 쿼리를 이어서 실행하기 위한 페이지네이션 커서입니다.

**반환값:**
반복 가능한 `ArtifactTypes` 객체입니다.

***

### <kbd>방법</kbd> `Api.artifact_versions`

```python theme={null}
artifact_versions(type_name, name, per_page=50)
```

사용 중단되었습니다. 대신 `Api.artifacts(type_name, name)` 방법을 사용하세요.

***

### <kbd>방법</kbd> `Api.artifacts`

```python theme={null}
artifacts(
    type_name: 'str',
    name: 'str',
    per_page: 'int' = 50,
    tags: 'list[str] | None' = None,
    start: 'str | None' = None
) → Artifacts
```

`Artifacts` 컬렉션을 반환합니다.

**매개변수:**

* `type_name`: 가져올 artifact의 유형입니다.
* `name`: artifact의 컬렉션 이름입니다. 선택적으로 artifact를 로깅한 entity를 접두사로 추가하고 그 뒤에 슬래시를 붙일 수 있습니다.
* `per_page`: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로 이 값을 변경할 이유는 없습니다.
* `tags`: 지정한 tags를 모두 가진 artifact만 반환합니다.
* `start`: 이전 paginator의 `.cursor` 속성에서 캡처한 값으로, 이전 쿼리를 다시 이어서 실행하기 위한 페이지네이션 커서입니다.

**반환값:**
반복 가능한 `Artifacts` 객체입니다.

**예시:**
다음 코드 스니펫에서 "type", "entity", "project", "artifact\_name"은 각각 artifact 유형, W\&B entity, artifact가 로깅된 프로젝트 이름, artifact 이름을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

wandb.Api().artifacts(type_name="type", name="entity/project/artifact_name")
```

paginator의 `.cursor`를 저장해 두고 이를 `start=`로 전달하면, 반복을 일시 중지한 뒤 나중에 같은 위치에서 재개할 수 있습니다:

```python theme={null}
from itertools import islice

import wandb

api = wandb.Api()

# 첫 번째 페이지의 결과를 가져온 후 커서를 저장합니다.
page_size = 10
artifacts = api.artifacts(
    type_name="type",
    name="entity/project/artifact_name",
    per_page=page_size,
)
first_page = list(islice(artifacts, page_size))

saved_cursor = artifacts.cursor

# 나중에 (예: 새 프로세스에서) 저장된 커서로부터 반복을 재개합니다.
remaining_artifacts = api.artifacts(
    type_name="type",
    name="entity/project/artifact_name",
    per_page=page_size,
    start=saved_cursor,
)
```

***

### <kbd>방법</kbd> `Api.automation`

```python theme={null}
automation(name: 'str', entity: 'str | None' = None) → Automation
```

매개변수와 일치하는 유일한 Automation을 반환합니다.

**매개변수:**

* `name`:  조회할 Automation의 이름입니다.
* `entity`:  해당 Automation을 조회할 entity입니다.

**예외:**

* `ValueError`:  검색 조건과 일치하는 Automation이 없거나 여러 개인 경우.

**예시:**
"my-automation"이라는 이름의 기존 Automation 조회:

```python theme={null}
import wandb

api = wandb.Api()
automation = api.automation(name="my-automation")
```

entity "my-team"에서 "other-automation"이라는 이름의 기존 automation을 조회합니다:

```python theme={null}
automation = api.automation(name="other-automation", entity="my-team")
```

***

### <kbd>방법</kbd> `Api.automations`

```python theme={null}
automations(
    entity: 'str | None' = None,
    name: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[Automation]
```

지정된 매개변수와 일치하는 모든 Automations에 대한 이터레이터를 반환합니다.

매개변수가 제공되지 않으면 반환된 이터레이터에는 사용자가 접근할 수 있는 모든 Automations가 포함됩니다.

**매개변수:**

* `entity`:  Automations를 가져올 entity입니다.
* `name`:  가져올 automation의 이름입니다.
* `per_page`:  페이지당 가져올 automations의 수입니다.  기본값은 50입니다.  일반적으로 이 값을 변경할 필요는 없습니다.
* `start`:  이전 paginator의 `.cursor` 속성에서 캡처한, 이전 쿼리를 다시 이어서 진행하기 위한 페이지네이션 커서입니다.

**반환값:**
automations의 목록입니다.

**예시:**
entity "my-team"의 기존 automations를 모두 가져옵니다:

```python theme={null}
import wandb

api = wandb.Api()
automations = api.automations(entity="my-team")
```

***

### <kbd>방법</kbd> `Api.create_automation`

```python theme={null}
create_automation(
    obj: 'NewAutomation',
    fetch_existing: 'bool' = False,
    **kwargs: 'Unpack[WriteAutomationsKwargs]'
) → Automation
```

새 Automation을 생성합니다.

**인수:**
obj:  생성할 automation입니다.  fetch\_existing:  True이고 충돌하는 automation이 이미 존재하는 경우, 오류를 발생시키는 대신 기존 automation을 가져오도록 시도합니다.  \*\*kwargs:  생성 전에 automation에 부여할 추가 값입니다.  제공되면 automation에 이미 설정되어 있을 수 있는 값을 재정의합니다:

* `name`: automation의 이름입니다.
  * `description`: automation의 설명입니다.
  * `enabled`: automation의 활성화 여부입니다.
  * `scope`: automation의 범위입니다.
  * `event`: automation을 트리거하는 이벤트입니다.
  * `action`: automation에 의해 트리거되는 액션입니다.

**반환값:**
저장된 Automation입니다.

**예시:**
특정 프로젝트 내의 run이 맞춤형 임계값을 초과하는 metric을 기록할 때 Slack 알림을 보내는 "my-automation"이라는 새 automation을 생성합니다:

```python theme={null}
import wandb
from wandb.automations import OnRunMetric, RunEvent, SendNotification

api = wandb.Api()

project = api.project("my-project", entity="my-team")

# 팀의 첫 번째 Slack 인테그레이션 사용
slack_hook = next(api.slack_integrations(entity="my-team"))

event = OnRunMetric(
     scope=project,
     filter=RunEvent.metric("custom-metric") > 10,
)
action = SendNotification.from_integration(slack_hook)

automation = api.create_automation(
     event >> action,
     name="my-automation",
     description="Send a Slack message whenever 'custom-metric' exceeds 10.",
)
```

***

### <kbd>방법</kbd> `Api.create_custom_chart`

```python theme={null}
create_custom_chart(
    entity: 'str',
    name: 'str',
    display_name: 'str',
    spec_type: "Literal['vega2']",
    access: "Literal['private', 'public']",
    spec: 'str | dict'
) → str
```

맞춤형 차트 프리셋을 만들고 해당 ID를 반환합니다.

**인수:**

* `entity`:  차트를 소유한 entity(사용자 또는 팀)
* `name`:  차트 프리셋의 고유 식별자
* `display_name`:  UI에 표시되는 사람이 읽기 쉬운 이름
* `spec_type`:  사양의 유형입니다. Vega-Lite v2 사양의 경우 반드시 "vega2"여야 합니다.
* `access`:  차트의 액세스 수준:
  * "private": 차트를 만든 entity만 차트에 액세스할 수 있습니다
  * "public": 누구나 차트에 액세스할 수 있습니다
* `spec`:  딕셔너리 또는 JSON 문자열 형식의 Vega/Vega-Lite 사양

**반환값:**
생성된 차트 프리셋의 ID입니다. 형식은 "entity/name"입니다.

**예외:**

* `wandb.Error`:  차트 생성에 실패한 경우
* `UnsupportedError`:  서버가 맞춤형 차트를 지원하지 않는 경우

**예시:**

```python theme={null}
    import wandb

    api = wandb.Api()

    # 단순한 막대 차트 사양 정의
    vega_spec = {
         "$schema": "https://vega.github.io/schema/vega-lite/v6.json",
         "mark": "bar",
         "data": {"name": "wandb"},
         "encoding": {
             "x": {"field": "${field:x}", "type": "ordinal"},
             "y": {"field": "${field:y}", "type": "quantitative"},
         },
    }

    # 맞춤형 차트 생성
    chart_id = api.create_custom_chart(
         entity="my-team",
         name="my-bar-chart",
         display_name="My Custom Bar Chart",
         spec_type="vega2",
         access="private",
         spec=vega_spec,
    )

    # wandb.plot_table()과 함께 사용
    chart = wandb.plot_table(
         vega_spec_name=chart_id,
         data_table=my_table,
         fields={"x": "category", "y": "value"},
    )
```

***

### <kbd>방법</kbd> `Api.create_project`

```python theme={null}
create_project(name: 'str', entity: 'str') → None
```

새 프로젝트를 생성합니다.

**매개변수:**

* `name`:  새 프로젝트의 이름입니다.
* `entity`:  새 프로젝트가 속한 entity입니다.

***

### <kbd>방법</kbd> `Api.create_registry`

```python theme={null}
create_registry(
    name: 'str',
    visibility: "Literal['organization', 'restricted']",
    organization: 'str | None' = None,
    description: 'str | None' = None,
    artifact_types: 'list[str] | None' = None
) → Registry
```

새 레지스트리를 생성합니다.

**매개변수:**

* `name`:  레지스트리 이름입니다. 이름은 조직 내에서 고유해야 합니다.
* `visibility`:  레지스트리의 공개 범위입니다.
* `organization`:  조직의 모든 사용자가 이 레지스트리를 볼 수 있습니다. 각 사용자의 역할은 나중에 UI의 Settings에서 수정할 수 있습니다.
* `restricted`:  UI를 통해 초대된 멤버만 이 레지스트리에 액세스할 수 있습니다. 공개 공유는 비활성화됩니다.
* `organization`:  레지스트리가 속한 조직입니다. Settings에 조직이 설정되어 있지 않으면, entity가 하나의 조직에만 속한 경우 해당 조직을 entity에서 가져옵니다.
* `description`:  레지스트리 설명입니다.
* `artifact_types`:  레지스트리에서 허용하는 artifact 유형입니다. 유형은
* `128자를 초과할 수 없고 `/` 또는 ``:`를 포함할 수 없습니다. 지정하지 않으면 모든 유형이 허용됩니다. 레지스트리에 추가된 허용 유형은 나중에 제거할 수 없습니다.

**반환값:**
레지스트리 객체입니다.

**예시:**

```python theme={null}
import wandb

api = wandb.Api()
registry = api.create_registry(
    name="my-registry",
    visibility="restricted",
    organization="my-org",
    description="This is a test registry",
    artifact_types=["model"],
)
```

***

### <kbd>방법</kbd> `Api.create_run`

```python theme={null}
create_run(
    run_id: 'str | None' = None,
    project: 'str | None' = None,
    entity: 'str | None' = None
) → public.Run
```

새 run을 생성합니다.

**매개변수:**

* `run_id`:  run에 할당할 ID입니다. 지정하지 않으면 W\&B가 임의의 ID를 생성합니다.
* `project`:  run을 기록할 프로젝트입니다. 프로젝트를 지정하지 않으면 "Uncategorized"라는 프로젝트에 run을 기록합니다.
* `entity`:  프로젝트를 소유한 entity입니다. entity를 지정하지 않으면 기본 entity에 run을 기록합니다.

**반환값:**
새로 생성된 `Run`입니다.

***

### <kbd>방법</kbd> `Api.create_run_queue`

```python theme={null}
create_run_queue(
    name: 'str',
    type: 'public.RunQueueResourceType',
    entity: 'str | None' = None,
    prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None,
    config: 'dict | None' = None,
    template_variables: 'dict | None' = None
) → public.RunQueue
```

W\&B Launch에서 새 run 큐를 생성합니다.

**매개변수:**

* `name`:  생성할 큐의 이름
* `type`:  큐에 사용할 리소스 유형입니다. "local-container", "local-process", "kubernetes", "sagemaker", 또는 "gcp-vertex" 중 하나입니다.
* `entity`:  큐를 생성할 entity의 이름입니다. `None`이면 설정된 entity 또는 기본 entity를 사용합니다.
* `prioritization_mode`:  사용할 우선순위 지정 버전입니다. "V0" 또는 `None`입니다.
* `config`:  큐에 사용할 기본 리소스 설정입니다. 템플릿 변수를 지정하려면 handlebars(예: `{{var}}`)를 사용하세요.
* `template_variables`:  config와 함께 사용할 템플릿 변수 스키마의 사전입니다.

**반환값:**
새로 생성된 `RunQueue`.

**예외:**
매개변수 중 하나라도 유효하지 않으면 `ValueError`, wandb API 오류가 발생하면 `wandb.Error`

***

### <kbd>방법</kbd> `Api.create_team`

```python theme={null}
create_team(team: 'str', admin_username: 'str | None' = None) → Team
```

새 Team을 생성합니다.

**매개변수:**

* `team`:  팀 이름
* `admin_username`:  Team의 관리자 사용자 이름입니다. 기본값은 현재 사용자입니다.

**반환값:**
`Team` 객체입니다.

***

### <kbd>방법</kbd> `Api.create_user`

```python theme={null}
create_user(email: 'str', admin: 'bool | None' = False) → User
```

새 사용자를 생성합니다.

**매개변수:**

* `email`:  사용자의 이메일 주소입니다.
* `admin`:  사용자를 인스턴스 전체 관리자으로 설정합니다.

**반환값:**
`User` 객체입니다.

***

### <kbd>방법</kbd> `Api.delete_automation`

```python theme={null}
delete_automation(obj: 'Automation | str') → Literal[True]
```

자동화를 삭제합니다.

**매개변수:**

* `obj`: 삭제할 자동화 또는 그 ID입니다.

**반환값:**
자동화가 성공적으로 삭제되면 True를 반환합니다.

***

### <kbd>방법</kbd> `Api.flush`

```python theme={null}
flush()
```

로컬 캐시를 초기화합니다.

api 객체는 run의 로컬 캐시를 유지하므로, 스크립트 실행 중 run 상태가 변경될 수 있다면 run에 연결된 최신 값을 가져오기 위해 `api.flush()`로 로컬 캐시를 초기화해야 합니다.

***

### <kbd>방법</kbd> `Api.from_path`

```python theme={null}
from_path(path: 'str')
```

경로로부터 run, sweep, 프로젝트 또는 리포트를 반환합니다.

**매개변수:**

* `path`: 프로젝트, run, sweep 또는 리포트의 경로

**반환값:**
`Project`, `Run`, `Sweep` 또는 `BetaReport` 인스턴스입니다.

**예외:**
경로가 잘못되었거나 객체가 존재하지 않으면 `wandb.Error` 예외가 발생합니다.

**예시:**
다음 코드 스니펫에서 "project", "team", "run\_id", "sweep\_id", "report\_name"은 각각 프로젝트, 팀, run ID, sweep ID, 특정 리포트 이름을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

api = wandb.Api()

project = api.from_path("project")
team_project = api.from_path("team/project")
run = api.from_path("team/project/runs/run_id")
sweep = api.from_path("team/project/sweeps/sweep_id")
report = api.from_path("team/project/reports/report_name")
```

***

### <kbd>방법</kbd> `Api.integrations`

```python theme={null}
integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[Integration]
```

entity에 대한 모든 인테그레이션의 이터레이터를 반환합니다.

**매개변수:**

* `entity`:  인테그레이션을 가져올 대상 entity입니다(예: 팀 이름). 제공하지 않으면 사용자의 기본 entity를 사용합니다.
* `per_page`:  페이지별로 가져올 인테그레이션 수입니다. 기본값은 50입니다. 일반적으로 이 값을 변경할 필요는 없습니다.

**Yields:**

* `Iterator[SlackIntegration | WebhookIntegration]`:  지원되는 인테그레이션의 이터레이터입니다.

***

### <kbd>방법</kbd> `Api.job`

```python theme={null}
job(name: 'str | None', path: 'str | None' = None) → public.Job
```

`Job` 객체를 반환합니다.

**매개변수:**

* `name`:  작업 이름입니다.
* `path`:  작업 artifact를 다운로드할 루트 경로입니다.

**반환값:**
`Job` 객체입니다.

***

### <kbd>방법</kbd> `Api.list_jobs`

```python theme={null}
list_jobs(entity: 'str', project: 'str') → list[dict[str, Any]]
```

주어진 entity와 프로젝트에 대해, 해당하는 작업이 있으면 작업 목록을 반환합니다.

**매개변수:**

* `entity`:  작업을 조회할 entity입니다.
* `project`:  작업을 조회할 프로젝트입니다.

**반환값:**
조건에 일치하는 작업 목록입니다.

***

### <kbd>방법</kbd> `Api.project`

```python theme={null}
project(name: 'str', entity: 'str | None' = None) → public.Project
```

주어진 이름의 `Project`를 반환합니다(`entity`가 지정된 경우 해당 `entity`에서 반환).

**매개변수:**

* `name`:  프로젝트 이름입니다.
* `entity`:  요청한 entity의 이름입니다. `None`이면 `Api`에 전달된 기본 entity를 사용합니다. 기본 entity가 없으면 `ValueError`를 발생시킵니다.

**반환값:**
`Project` 객체입니다.

***

### <kbd>방법</kbd> `Api.projects`

```python theme={null}
projects(entity: 'str | None' = None, per_page: 'int' = 200) → public.Projects
```

주어진 entity의 Projects를 조회합니다.

**매개변수:**

* `entity`: 요청할 entity의 이름입니다. `None`이면 `Api`에 전달된 기본 entity를 사용합니다. 기본 entity도 없으면 `ValueError`가 발생합니다.
* `per_page`: 쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로는 이 값을 변경할 필요가 없습니다.

**반환값:**
반복 가능한 컬렉션인 `Projects` 객체를 반환합니다. 이 객체의 각 항목은 `Project` 객체입니다.

***

### <kbd>방법</kbd> `Api.queued_run`

```python theme={null}
queued_run(
    entity: 'str',
    project: 'str',
    queue_name: 'str',
    run_queue_item_id: 'str',
    project_queue=None,
    priority=None
)
```

경로를 기준으로 큐에 대기 중인 단일 run을 반환합니다.

`entity/project/queue_id/run_queue_item_id` 형식의 경로를 파싱합니다.

***

### <kbd>방법</kbd> `Api.registries`

```python theme={null}
registries(
    organization: 'str | None' = None,
    filter: 'dict[str, Any] | None' = None,
    per_page: 'int' = 100,
    start: 'str | None' = None
) → Registries
```

`Registry` 객체의 lazy 이터레이터를 반환합니다.

이 이터레이터를 사용하면 조직의 레지스트리 전체에서 레지스트리, 컬렉션 또는 아티팩트 버전을 검색하고 필터링할 수 있습니다.

**매개변수:**

* `organization`: (str, 선택 사항) 가져올 레지스트리의 조직입니다. 지정하지 않으면 사용자 설정에 지정된 조직을 사용합니다.
* `filter`: (dict, 선택 사항) lazy 레지스트리 이터레이터의 각 객체에 적용할 MongoDB 스타일 필터입니다. 레지스트리에 대해 필터링할 수 있는 필드는 `name`, `description`, `created_at`, `updated_at`입니다. 컬렉션에 대해 필터링할 수 있는 필드는 `name`, `tag`, `description`, `created_at`, `updated_at`입니다. 버전에 대해 필터링할 수 있는 필드는 `tag`, `alias`, `created_at`, `updated_at`, `metadata`입니다.
* `per_page`: 쿼리 페이지네이션의 페이지 크기를 설정합니다.
* `start`: 이전 paginator의 `.cursor` 속성에서 캡처한 값으로 이전 쿼리를 이어서 수행하기 위한 페이지네이션 커서입니다.

**반환값:**
`Registry` 객체의 lazy 이터레이터입니다.

**예시:**
이름에 "model"이 포함된 모든 레지스트리 찾기

```python theme={null}
import wandb

api = wandb.Api()  # entity가 여러 org에 속한 경우 org를 지정하십시오
api.registries(filter={"name": {"$regex": "model"}})
```

레지스트리에서 이름이 "my\_collection"이고 태그가 "my\_tag"인 모든 컬렉션을 찾습니다.

```python theme={null}
api.registries().collections(filter={"name": "my_collection", "tag": "my_tag"})
```

"my\_collection"을 포함하는 컬렉션 이름과 "best" 별칭을 가진 버전이 있는 레지스트리에서 모든 아티팩트 버전을 찾습니다.

```python theme={null}
api.registries().collections(
    filter={"name": {"$regex": "my_collection"}}
).versions(filter={"alias": "best"})
```

레지스트리에서 "model"을 포함하고 태그 "prod" 또는 별칭 "best"가 있는 모든 아티팩트 버전을 찾습니다

```python theme={null}
api.registries(filter={"name": {"$regex": "model"}}).versions(
    filter={"$or": [{"tag": "prod"}, {"alias": "best"}]}
)
```

페이지네이터의 `.cursor`를 저장하고 이를 `start=`로 전달해 반복을 일시 중지한 뒤, 나중에 같은 위치에서 재개하세요:

```python theme={null}
from itertools import islice

import wandb

api = wandb.Api()

# 첫 번째 페이지의 결과를 가져온 후 커서를 저장합니다.
page_size = 10
registries = api.registries(per_page=page_size)
first_page = list(islice(registries, page_size))

saved_cursor = registries.cursor

# 나중에 (예: 새 프로세스에서) 저장된 커서부터 반복을 재개합니다.
remaining_registries = api.registries(per_page=page_size, start=saved_cursor)
```

***

### <kbd>방법</kbd> `Api.registry`

```python theme={null}
registry(name: 'str', organization: 'str | None' = None) → Registry
```

레지스트리 이름으로 해당 레지스트리를 반환합니다.

**매개변수:**

* `name`:  레지스트리 이름입니다. `wandb-registry-` 접두사는 포함하지 않습니다.
* `organization`:  레지스트리의 조직입니다. 설정에 조직이 지정되어 있지 않으면, entity가 하나의 조직에만 속한 경우 해당 조직을 entity에서 가져옵니다.

**반환값:**
레지스트리 객체입니다.

**예시:**
레지스트리 가져오기 및 업데이트

```python theme={null}
import wandb

api = wandb.Api()
registry = api.registry(name="my-registry", organization="my-org")
registry.description = "This is an updated description"
registry.save()
```

***

### <kbd>방법</kbd> `Api.reports`

```python theme={null}
reports(
    path: 'str' = '',
    name: 'str | None' = None,
    per_page: 'int' = 50
) → public.Reports
```

주어진 프로젝트 경로의 리포트를 조회합니다.

참고: `wandb.Api.reports()` API는 베타 버전이며, 향후 릴리스에서 변경될 수 있습니다.

**매개변수:**

* `path`:  리포트가 있는 프로젝트의 경로입니다. 프로젝트를 만든 entity를 접두사로 지정한 뒤 슬래시(`/`)를 붙이세요.
* `name`:  요청한 리포트의 이름입니다.
* `per_page`:  쿼리 페이지네이션의 페이지 크기를 설정합니다. 일반적으로는 이를 변경할 이유가 없습니다.

**반환값:**
반복 가능한 `BetaReport` 객체 모음인 `Reports` 객체입니다.

**예시:**

```python theme={null}
import wandb

wandb.Api.reports("entity/project")
```

***

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

```python theme={null}
run(path='')
```

`entity/project/run_id` 형식의 경로를 해석해 단일 run을 반환합니다.

**매개변수:**

* `path`: `entity/project/run_id` 형식의 run 경로입니다. `api.entity`가 설정되어 있으면 `project/run_id` 형식도 사용할 수 있으며, `api.project`가 설정되어 있으면 run\_id만 지정하면 됩니다.

**반환값:**
`Run` 객체입니다.

***

### <kbd>방법</kbd> `Api.run_queue`

```python theme={null}
run_queue(entity: 'str', name: 'str')
```

entity의 지정된 `RunQueue`를 반환합니다.

run 큐를 생성하는 방법에 대한 자세한 내용은 `Api.create_run_queue`를 참조하세요.

***

### <kbd>방법</kbd> `Api.runs`

```python theme={null}
runs(
    path: 'str | None' = None,
    filters: 'dict[str, Any] | None' = None,
    order: 'str' = '+created_at',
    per_page: 'int' = 50,
    include_sweeps: 'bool' = True,
    lazy: 'bool' = True
)
```

`Run` 객체를 lazy 방식으로 순회하는 `Runs` 객체를 반환합니다.

필터링할 수 있는 필드는 다음과 같습니다:

* `createdAt`: run이 생성된 Timestamp입니다. (ISO 8601 형식, 예: "2023-01-01T12:00:00Z")
* `displayName`: 사람이 읽기 쉬운 run의 Display name입니다. (예: "eager-fox-1")
* `duration`: run의 총 실행 시간(초)입니다.
* `group`: 관련 run들을 함께 구성하는 데 사용하는 그룹 이름입니다.
* `host`: run이 실행된 호스트 이름입니다.
* `jobType`: run의 작업 유형 또는 목적입니다.
* `name`: run의 고유 식별자입니다. (예: "a1b2cdef")
* `state`: run의 현재 상태입니다.
* `tags`: run에 연결된 tags입니다.
* `username`: run을 시작한 사용자의 사용자 이름입니다

또한 run 설정이나 summary 메트릭의 항목으로도 필터링할 수 있습니다. 예를 들어 `config.experiment_name`, `summary_metrics.loss` 등이 있습니다.

더 복잡한 필터링이 필요하면 MongoDB 쿼리 Operator를 사용할 수 있습니다. 자세한 내용은 [https://docs.mongodb.com/manual/reference/operator/query](https://docs.mongodb.com/manual/reference/operator/query) 를 참조하세요. 지원되는 오퍼레이션은 다음과 같습니다:

* `$and`
* `$or`
* `$nor`
* `$eq`
* `$ne`
* `$gt`
* `$gte`
* `$lt`
* `$lte`
* `$in`
* `$nin`
* `$exists`
* `$regex`

**매개변수:**

* `path`: (str) 프로젝트 경로로, "entity/project" 형식이어야 합니다.
* `filters`: (dict) MongoDB 쿼리 언어를 사용해 특정 run을 쿼리합니다. `config.key`, `summary_metrics.key`, `state`, `entity`, `createdAt` 등의 run 속성으로 필터링할 수 있습니다.
* `For example`: `{"config.experiment_name": "foo"}` 는 실험 이름이 "foo"로 설정된 설정 항목이 있는 run을 찾습니다
* `order`: (str) 정렬 기준으로 `created_at`, `heartbeat_at`, `config.*.value`, 또는 `summary_metrics.*`를 사용할 수 있습니다. 앞에 +를 붙이면 오름차순(기본값)입니다. 앞에 -를 붙이면 내림차순입니다. 기본 정렬은 가장 오래된 것부터 최신순까지의 run.created\_at입니다.
* `per_page`: (int) 쿼리 페이지네이션의 페이지 크기를 설정합니다.
* `include_sweeps`: (bool) 결과에 sweep run을 포함할지 여부입니다.
* `lazy`: (bool) 더 빠른 성능을 위해 lazy 로딩을 사용할지 여부입니다. True(기본값)인 경우 처음에는 필수 run 메타데이터만 로드됩니다. config, summaryMetrics, systemMetrics 같은 큰 필드는 접근 시 필요에 따라 로드됩니다. 전체 데이터를 처음부터 로드하려면 False로 설정하세요.

**반환값:**
`Run` 객체를 순회할 수 있는 컬렉션인 `Runs` 객체입니다.

**예시:**

```python theme={null}
import wandb
from wandb.apis.public import Api

# 프로젝트에서 config.experiment_name이 "foo"로 설정된 run 찾기
Api.runs(path="my_entity/project", filters={"config.experiment_name": "foo"})
```

```python theme={null}
# config.experiment_name이 "foo" 또는 "bar"로 설정된 프로젝트의 run 찾기
Api.runs(
    path="my_entity/project",
    filters={
         "$or": [
             {"config.experiment_name": "foo"},
             {"config.experiment_name": "bar"},
         ]
    },
)
```

```python theme={null}
# 프로젝트에서 config.experiment_name이 정규식과 일치하는 run 찾기
# (앵커는 지원되지 않음)
Api.runs(
    path="my_entity/project",
    filters={"config.experiment_name": {"$regex": "b.*"}},
)
```

```python theme={null}
# 프로젝트에서 run 이름이 정규식과 일치하는 run 찾기
# (앵커는 지원되지 않음)
Api.runs(
    path="my_entity/project", filters={"display_name": {"$regex": "^foo.*"}}
)
```

```python theme={null}
# 오름차순 loss로 정렬된 프로젝트의 runs 찾기
Api.runs(path="my_entity/project", order="+summary_metrics.loss")
```

***

### <kbd>방법</kbd> `Api.slack_integrations`

```python theme={null}
slack_integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[SlackIntegration]
```

entity에 대한 Slack 인테그레이션 이터레이터를 반환합니다.

**매개변수:**

* `entity`:  인테그레이션을 조회할 대상 entity(예: 팀 이름)입니다.  지정하지 않으면 사용자의 기본 entity가 사용됩니다.
* `per_page`:  페이지당 조회할 인테그레이션 수입니다.  기본값은 50입니다.  일반적으로 이 값을 변경할 필요는 없습니다.

**Yields:**

* `Iterator[SlackIntegration]`:  Slack 인테그레이션 이터레이터입니다.

**예제:**
팀 "my-team"에 등록된 모든 Slack 인테그레이션을 조회합니다:

```python theme={null}
import wandb

api = wandb.Api()
slack_integrations = api.slack_integrations(entity="my-team")
```

"team-alerts-"로 시작하는 이름의 채널에 게시하는 Slack 인테그레이션만 찾습니다:

```python theme={null}
slack_integrations = api.slack_integrations(entity="my-team")
team_alert_integrations = [
    ig
    for ig in slack_integrations
    if ig.channel_name.startswith("team-alerts-")
]
```

***

### <kbd>방법</kbd> `Api.sweep`

```python theme={null}
sweep(path='')
```

`entity/project/sweep_id` 형식의 경로를 파싱해 스윕을 반환합니다.

**매개변수:**

* `path`: entity/project/sweep\_id 형식의 스윕 경로입니다. `api.entity`가 설정되어 있으면 project/sweep\_id 형식을 사용할 수 있고, `api.project`가 설정되어 있으면 sweep\_id만 사용하면 됩니다.

**반환값:**
`Sweep` 객체입니다.

***

### <kbd>방법</kbd> `Api.sync_tensorboard`

```python theme={null}
sync_tensorboard(root_dir, run_id=None, project=None, entity=None)
```

tfevent 파일이 포함된 로컬 디렉터리를 wandb로 동기화합니다.

***

### <kbd>방법</kbd> `Api.team`

```python theme={null}
team(team: 'str') → Team
```

지정한 이름과 일치하는 `Team`을 반환합니다.

**매개변수:**

* `team`:  Team 이름입니다.

**반환값:**
`Team` 객체입니다.

***

### <kbd>방법</kbd> `Api.update_automation`

```python theme={null}
update_automation(
    obj: 'Automation',
    create_missing: 'bool' = False,
    **kwargs: 'Unpack[WriteAutomationsKwargs]'
) → Automation
```

기존 자동화를 업데이트합니다.

**매개변수:**

* `obj`:  업데이트할 자동화입니다. 기존에 존재하는 자동화여야 합니다. create\_missing (bool):  True이고 자동화가 존재하지 않으면 생성합니다. \*\*kwargs:  업데이트하기 전에 자동화에 할당할 추가 값입니다. 지정하면 자동화에 이미 설정된 값을 덮어씁니다:
  * `name`: 자동화의 이름입니다.
  * `description`: 자동화의 설명입니다.
  * `enabled`: 자동화의 활성화 여부입니다.
  * `scope`: 자동화의 범위입니다.
  * `event`: 자동화를 트리거하는 이벤트입니다.
  * `action`: 자동화에 의해 트리거되는 작업입니다.

**반환값:**
업데이트된 자동화입니다.

**예시:**
기존 자동화("my-automation")를 비활성화하고 설명을 수정합니다:

```python theme={null}
import wandb

api = wandb.Api()

automation = api.automation(name="my-automation")
automation.enabled = False
automation.description = "레퍼런스용으로 보관하지만 더 이상 사용하지 않습니다."

updated_automation = api.update_automation(automation)
```

또는

```python theme={null}
import wandb

api = wandb.Api()

automation = api.automation(name="my-automation")

updated_automation = api.update_automation(
    automation,
    enabled=False,
    description="Kept for reference, but no longer used.",
)
```

***

### <kbd>방법</kbd> `Api.upsert_run_queue`

```python theme={null}
upsert_run_queue(
    name: 'str',
    resource_config: 'dict',
    resource_type: 'public.RunQueueResourceType',
    entity: 'str | None' = None,
    template_variables: 'dict | None' = None,
    external_links: 'dict | None' = None,
    prioritization_mode: 'public.RunQueuePrioritizationMode | None' = None
)
```

W\&B Launch에서 run 큐를 생성하거나 업데이트합니다.

**매개변수:**

* `name`:  생성할 큐의 이름
* `entity`:  큐를 생성할 entity의 이름(선택 사항)입니다. `None`이면 설정된 entity 또는 기본 entity를 사용합니다.
* `resource_config`:  큐에 사용할 기본 리소스 설정(선택 사항)입니다. 템플릿 변수를 지정하려면 handlebars(예: `{{var}}`)를 사용합니다.
* `resource_type`:  큐에 사용할 리소스의 유형입니다. "local-container", "local-process", "kubernetes", "sagemaker", 또는 "gcp-vertex" 중 하나입니다.
* `template_variables`:  설정과 함께 사용할 템플릿 변수 스키마의 사전입니다.
* `external_links`:  큐와 함께 사용할 외부 링크의 사전(선택 사항)입니다.
* `prioritization_mode`:  사용할 우선순위 지정 버전(선택 사항)입니다. "V0" 또는 None입니다.

**반환값:**
생성되거나 업데이트된 `RunQueue`.

**예외:**
매개변수 중 하나라도 올바르지 않으면 ValueError가 발생합니다. wandb API 오류가 발생하면 wandb.Error가 발생합니다.

***

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

```python theme={null}
user(username_or_email: 'str') → User | None
```

사용자 이름 또는 이메일 주소로 사용자를 조회합니다.

이 함수는 로컬 관리자만 사용할 수 있습니다. 자신의 사용자 객체를 가져오려면 `api.viewer`를 사용하세요.

**매개변수:**

* `username_or_email`:  사용자의 사용자 이름 또는 이메일 주소입니다.

**반환값:**
사용자를 찾으면 `User` 객체를, 찾지 못하면 None을 반환합니다.

***

### <kbd>방법</kbd> `Api.users`

```python theme={null}
users(username_or_email: 'str') → list[User]
```

사용자 이름 또는 이메일 주소의 일부를 쿼리해 일치하는 모든 사용자를 반환합니다.

이 함수는 로컬 관리자만 사용할 수 있습니다. 자신의 사용자 객체를 가져오려면 `api.viewer`를 사용하세요.

**매개변수:**

* `username_or_email`:  찾으려는 사용자의 접두사 또는 접미사입니다.

**반환값:**
`User` 객체 배열입니다.

***

### <kbd>방법</kbd> `Api.webhook_integrations`

```python theme={null}
webhook_integrations(
    entity: 'str | None' = None,
    per_page: 'int' = 50,
    start: 'str | None' = None
) → Iterator[WebhookIntegration]
```

entity에 대한 웹훅 인테그레이션 이터레이터를 반환합니다.

**매개변수:**

* `entity`:  인테그레이션을 가져올 대상 entity(예: 팀 이름)입니다.  지정하지 않으면 사용자의 기본 entity가 사용됩니다.
* `per_page`:  페이지당 가져올 인테그레이션 수입니다.  기본값은 50입니다.  일반적으로 이 값을 변경할 이유는 없습니다.

**Yields:**

* `Iterator[WebhookIntegration]`:  웹훅 인테그레이션 이터레이터입니다.

**예제:**
팀 "my-team"에 등록된 모든 웹훅 인테그레이션을 조회합니다:

```python theme={null}
import wandb

api = wandb.Api()
webhook_integrations = api.webhook_integrations(entity="my-team")
```

"[https://my-fake-url.com](https://my-fake-url.com)"로 요청을 전송하는 웹훅 인테그레이션만 찾습니다:

```python theme={null}
webhook_integrations = api.webhook_integrations(entity="my-team")
my_webhooks = [
    ig
    for ig in webhook_integrations
    if ig.url_endpoint.startswith("https://my-fake-url.com")
]
```
