> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-wbdocs-1882.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>method</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 서버를 사용하는 경우에 설정합니다. 또한 `entity`, `project`, `run\`의 기본값도 설정할 수 있습니다.
* `timeout`:  API 요청에 대한 HTTP 타임아웃(초)입니다. 지정하지 않으면 기본 타임아웃이 사용됩니다.
* `api_key`:  인증에 사용할 API 키입니다. 제공되지 않으면 현재 환경이나 설정에 있는 API 키가 사용됩니다. 환경에 제공되었거나 설정된 API 키가 전혀 없으면 API 키 입력을 요청합니다.

***

### <kbd>property</kbd> Api.client

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

**반환값:**

* `RetryingClient`: client 속성 값입니다.

***

### <kbd>property</kbd> Api.default\_entity

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

**반환값:**

* `str | None`: default\_entity 프로퍼티의 값.

***

### <kbd>property</kbd> Api.user\_agent

W\&B 공개용 user agent를 반환합니다.

**Returns:**

* `str`: `user_agent` 프로퍼티 값.

***

### <kbd>property</kbd> Api.viewer

viewer 객체를 반환합니다.

**Raises:**

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

**Returns:**

* `User`: viewer 속성 값.

***

### <kbd>메서드</kbd> `Api.artifact`

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

단일 아티팩트를 반환합니다.

**Args:**

* `name`:  아티팩트의 이름입니다. 아티팩트 이름은 최소한 아티팩트가 로그된 프로젝트 이름, 아티팩트 이름, 그리고 아티팩트의 버전 또는 별칭으로 구성된, 파일 경로와 유사한 형식입니다. 선택적으로, 아티팩트를 로그한 엔티티를 접두사로 앞에 추가하고 슬래시(`/`)로 구분할 수 있습니다. 이름에 엔티티가 지정되지 않은 경우, run 또는 API 설정의 entity가 사용됩니다.
* `type`:  가져올 아티팩트의 유형입니다.

**Returns:**
`Artifact` 객체를 반환합니다.

**Raises:**

* `ValueError`:  아티팩트 이름이 지정되지 않은 경우.
* `ValueError`:  아티팩트 유형이 지정되었지만, 가져온 아티팩트 유형과 일치하지 않는 경우.

**Examples:**
다음 코드 스니펫에서 "entity", "project", "artifact", "version", 그리고 "alias"는 각각 여러분의 W\&B entity, 아티팩트가 포함된 프로젝트 이름, 아티팩트 이름, 그리고 아티팩트 버전을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

# 프로젝트, 아티팩트 이름, 아티팩트 별칭을 지정합니다
wandb.Api().artifact(name="project/artifact:alias")

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

# 엔티티, 프로젝트, 아티팩트 이름, 아티팩트 별칭을 지정합니다
wandb.Api().artifact(name="entity/project/artifact:alias")

# 엔티티, 프로젝트, 아티팩트 이름, 특정 아티팩트 버전을 지정합니다
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
```

지정된 유형의 단일 아티팩트 컬렉션을 반환합니다.

반환된 `ArtifactCollection` 객체를 사용하여 해당 컬렉션에 포함된 특정 아티팩트에 대한 정보 등을 조회할 수 있습니다.

**Args:**

* `type_name`:  가져올 아티팩트 컬렉션의 유형.
* `name`:  아티팩트 컬렉션 이름. 선택적으로, 아티팩트를 로깅한 엔터티를 접두사로 앞에 추가하고 그 뒤에 슬래시(`/`)를 붙일 수 있습니다.

**Returns:**
`ArtifactCollection` 객체.

**Examples:**
다음 코드 스니펫에서 "type", "entity", "project", 그리고 "artifact\_name"은 각각 컬렉션 유형, 사용자의 W\&B 엔터티, 아티팩트가 포함된 프로젝트 이름, 그리고 아티팩트 이름을 나타내는 플레이스홀더입니다.

```python theme={null}
import wandb

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

# 컬렉션에서 첫 번째 아티팩트를 가져옵니다.
artifact_example = collections.artifacts()[0]

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

***

### <kbd>메서드</kbd> `Api.artifact_collection_exists`

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

지정된 프로젝트와 entity 내에 아티팩트 컬렉션이 존재하는지 여부.

**인자:**

* `name`:  아티팩트 컬렉션 이름. 선택적으로, 아티팩트를 로깅한 entity를 접두사로 추가하고 그 뒤에 슬래시를 붙일 수 있습니다. entity 또는 project가 지정되지 않은 경우, 존재한다면 override 파라미터에서 컬렉션을 유추합니다. 그렇지 않으면 entity는 사용자 설정에서 가져오고 project는 기본적으로 "uncategorized"로 설정됩니다.
* `type`:  아티팩트 컬렉션의 타입.

**반환값:**
아티팩트 컬렉션이 존재하면 True, 그렇지 않으면 False를 반환합니다.

**예시:**
다음 코드 스니펫에서 "type"과 "collection\_name"은 각각 아티팩트 컬렉션의 타입과 컬렉션 이름을 나타냅니다.

```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
) → ArtifactCollections
```

일치하는 아티팩트 컬렉션 모음을 반환합니다.

**Args:**

* `project_name`:  필터링에 사용할 프로젝트 이름.
* `type_name`:  필터링에 사용할 아티팩트 타입 이름.
* `per_page`:  쿼리 페이지네이션에 사용할 페이지 크기 설정 값입니다. 일반적으로 이 값을 변경할 필요는 없습니다.

**Returns:**
이터러블한 `ArtifactCollections` 객체.

***

### <kbd>메서드</kbd> `Api.artifact_exists`

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

지정된 프로젝트와 entity 내에 해당 아티팩트 버전이 존재하는지 여부.

**Args:**

* `name`:  아티팩트의 이름. 접두사로 아티팩트의 entity와 프로젝트를 추가한다. 콜론(`:`)을 사용해 아티팩트의 버전 또는 별칭(alias)을 덧붙인다. entity 또는 프로젝트가 지정되지 않은 경우, 값이 설정되어 있다면 override 파라미터를 사용한다. 그렇지 않으면 entity는 사용자 설정에서 가져오고, 프로젝트는 "Uncategorized"로 설정된다.
* `type`:  아티팩트의 유형.

**Returns:**
아티팩트 버전이 존재하면 True, 그렇지 않으면 False.

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

```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`:  조회할 아티팩트 타입의 이름입니다.
* `project`:  지정하면, 필터링에 사용할 프로젝트 이름 또는 경로입니다.

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

***

### <kbd>메서드</kbd> `Api.artifact_types`

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

일치하는 아티팩트 타입 컬렉션을 반환합니다.

**Args:**

* `project`:  필터링에 사용할 프로젝트 이름 또는 경로.

**Returns:**
반복 가능한 `ArtifactTypes` 객체를 반환합니다.

***

### <kbd>메서드</kbd> `Api.artifact_versions`

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

더 이상 사용되지 않습니다. 대신 `Api.artifacts(type_name, name)` 메서드를 사용하십시오.

***

### <kbd>method</kbd> `Api.artifacts`

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

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

**Args:**

* `type_name`:  가져올 아티팩트의 유형입니다.
* `name`:  아티팩트 컬렉션 이름입니다. 선택적으로 아티팩트를 로깅한 엔터티를 접두사로 추가하고, 이어서 슬래시(`/`)를 붙일 수 있습니다.
* `per_page`:  쿼리 페이지네이션을 위한 페이지 크기를 설정합니다. 일반적으로 이 값을 변경할 필요는 없습니다.
* `tags`:  이 모든 태그를 포함하는 아티팩트만 반환합니다.

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

**Examples:**
다음 코드 스니펫에서 "type", "entity", "project", 그리고 "artifact\_name"은 각각 아티팩트 유형, W\&B entity, 아티팩트가 로깅된 프로젝트 이름, 그리고 아티팩트 이름에 대한 플레이스홀더입니다.

```python theme={null}
import wandb

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

***

### <kbd>메서드</kbd> `Api.automation`

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

지정된 매개변수와 일치하는 단 하나의 Automation을 반환합니다.

**Args:**

* `name`:  가져올 Automation의 이름입니다.
* `entity`:  Automation을 가져올 entity입니다.

**Raises:**

* `ValueError`:  검색 기준과 일치하는 Automation이 0개이거나 여러 개인 경우 발생합니다.

**Examples:**
이름이 "my-automation"인 기존 Automation을 가져옵니다:

```python theme={null}
import wandb

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

엔티티 "my-team"에서 이름이 "other-automation"인 기존 automation을 가져옵니다:

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

***

### <kbd>method</kbd> `Api.automations`

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

주어진 매개변수와 일치하는 모든 Automation에 대한 이터레이터를 반환합니다.

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

**Args:**

* `entity`:  Automation을 조회할 엔티티.
* `name`:  조회할 Automation의 이름.
* `per_page`:  페이지당 조회할 Automation 개수. 기본값은 50입니다. 일반적으로 이 값을 변경할 필요는 없습니다.

**Returns:**
Automation 목록.

**Examples:**
엔티티 "my-team"에 대한 기존의 모든 Automation을 가져옵니다:

```python theme={null}
import wandb

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

***

### <kbd>method</kbd> `Api.create_automation`

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

새 Automation을 생성합니다.

**Args:**
obj:  생성할 automation입니다.  fetch\_existing:  True인 경우, 충돌하는 automation이 이미 존재하면 오류를 발생시키는 대신  기존 automation을 가져오려 시도합니다.  \*\*kwargs:  automation을 생성하기 전에 할당할 추가 값입니다.  제공된 경우, automation에 이미 설정되어 있을 수 있는 값을  다음과 같이 덮어씁니다:

* `name`: automation의 이름.
  * `description`: automation의 설명.
  * `enabled`: automation이 활성화되어 있는지 여부.
  * `scope`: automation의 범위.
  * `event`: automation을 트리거하는 이벤트.
  * `action`: automation에 의해 트리거되는 동작.

**Returns:**
저장된 Automation을 반환합니다.

**Examples:**
특정 프로젝트 내의 run이 사용자 지정 임계값을 초과하는 메트릭을 로깅할 때 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를 반환합니다.

**Args:**

* `entity`:  차트를 소유하는 엔터티(사용자 또는 팀)
* `name`:  차트 프리셋의 고유 식별자
* `display_name`:  UI에 표시되는 사람이 읽기 쉬운 이름
* `spec_type`:  스펙 유형. Vega-Lite v2 스펙의 경우 반드시 "vega2"여야 합니다.
* `access`:  차트에 대한 접근 권한 수준:
  * "private": 차트를 생성한 엔터티만 접근 가능
  * "public": 차트가 공개적으로 접근 가능
* `spec`:  사전 또는 JSON 문자열 형태의 Vega/Vega-Lite 스펙

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

**Raises:**

* `wandb.Error`:  차트 생성에 실패한 경우
* `UnsupportedError`:  서버가 사용자 지정 차트를 지원하지 않는 경우

**Example:**

```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>method</kbd> `Api.create_project`

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

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

**Args:**

* `name`:  새 프로젝트의 이름.
* `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
```

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

**Args:**

* `name`:  레지스트리 이름입니다. 조직 내에서 고유해야 합니다.
* `visibility`:  레지스트리의 공개 범위입니다.
* `organization`:  조직의 모든 구성원이 이 레지스트리를 볼 수 있습니다. 나중에 UI 설정에서 이들의 역할을 수정할 수 있습니다.
* `restricted`:  UI를 통해 초대된 멤버만 이 레지스트리에 접근할 수 있습니다. 공개 공유는 비활성화됩니다.
* `organization`:  레지스트리가 속한 조직입니다. 설정에서 조직이 지정되지 않은 경우, 엔티티가 오직 하나의 조직에만 속해 있다면 그 엔티티로부터 조직이 가져와집니다.
* `description`:  레지스트리 설명입니다.
* `artifact_types`:  레지스트리가 허용하는 아티팩트 타입입니다. 타입 이름은
* `more than 128 characters and do not include characters `/`or ``:`. If not specified, all types are accepted. Allowed types added to the registry cannot be removed later.

**Returns:**
레지스트리 객체를 반환합니다.

**Examples:**

```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>method</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`:  프로젝트를 소유하는 엔티티입니다. 엔티티를 지정하지 않으면 기본 엔티티에 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 큐를 생성합니다.

**Args:**

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

**Returns:**
새로 생성된 `RunQueue`.

**Raises:**
매개변수가 잘못된 경우 `ValueError`, wandb API 오류 시 `wandb.Error`

***

### <kbd>메서드</kbd> `Api.create_team`

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

새 팀을 생성합니다.

**인자(Args):**

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

**반환(Returns):**
`Team` 객체를 반환합니다.

***

### <kbd>method</kbd> `Api.create_user`

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

새로운 사용자를 생성합니다.

**매개변수:**

* `email`:  사용자의 이메일 주소.
* `admin`:  사용자를 전역 인스턴스 관리자(global instance administrator)로 설정합니다.

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

***

### <kbd>메서드</kbd> `Api.delete_automation`

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

자동화를 삭제합니다.

**Args:**

* `obj`:  삭제할 자동화 객체 또는 해당 ID.

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

***

### <kbd>method</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, 스윕, 프로젝트 또는 리포트를 반환합니다.

**Args:**

* `path`:  프로젝트, run, 스윕 또는 리포트에 대한 경로

**Returns:**
`Project`, `Run`, `Sweep` 또는 `BetaReport` 인스턴스.

**Raises:**
경로가 잘못되었거나 객체가 존재하지 않는 경우 `wandb.Error`를 발생합니다.

**Examples:**
다음 코드 스니펫에서 "project", "team", "run\_id", "sweep\_id", 및 "report\_name"은 각각 프로젝트, 팀, run ID, 스윕 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
) → Iterator[Integration]
```

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

**Args:**

* `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` 객체를 반환합니다.

**Args:**

* `name`: Job 이름.
* `path`: Job 아티팩트를 다운로드할 루트 경로.

**Returns:**
`Job` 객체.

***

### <kbd>메서드</kbd> `Api.list_jobs`

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

지정한 entity와 프로젝트에 대해 해당하는 job 목록을 반환합니다.

**Args:**

* `entity`:  나열할 job이 속한 entity입니다.
* `project`:  나열할 job이 속한 프로젝트입니다.

**Returns:**
조건과 일치하는 job 목록입니다.

***

### <kbd>method</kbd> `Api.project`

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

지정된 이름(및 필요한 경우 entity)을 가진 `Project`를 반환합니다.

**인자:**

* `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`:  요청된 엔티티의 이름입니다.  None이면 `Api`에 전달된 기본 엔티티를 사용합니다.  기본 엔티티가 없으면 `ValueError`를 발생시킵니다.
* `per_page`:  쿼리 페이지네이션을 위한 페이지 크기를 설정합니다.  일반적으로 이 값을 변경할 필요는 없습니다.

**반환값:**
`Projects` 객체로, 이는 `Project` 객체들의 이터러블 컬렉션입니다.

***

### <kbd>method</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
) → Registries
```

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

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

**Args:**

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

**Returns:**
`Registry` 객체의 지연 이터레이터.

**Examples:**
이름에 "모델"이 포함된 모든 레지스트리 찾기

```python theme={null}
import wandb

api = wandb.Api()  # entity가 여러 조직에 속한 경우 조직을 지정하세요
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"}]}
)
```

***

### <kbd>메서드</kbd> `Api.registry`

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

레지스트리 이름을 기준으로 레지스트리를 반환합니다.

**인자:**

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

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

**예시:**
레지스트리를 가져와 업데이트하기

```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는 베타 버전이며, 향후 릴리스에서 변경될 가능성이 큽니다.

**Args:**

* `path`:  리포트가 포함된 프로젝트의 경로입니다. 프로젝트를 생성한 entity를 접두사로, 그 뒤에 슬래시(`/`)를 붙여 지정합니다.
* `name`:  요청할 리포트의 이름입니다.
* `per_page`:  쿼리 페이지네이션을 위한 페이지 크기를 설정합니다. 일반적으로 이 값을 변경할 필요는 없습니다.

**Returns:**
`BetaReport` 객체의 이터러블 컬렉션인 `Reports` 객체를 반환합니다.

**Examples:**

```python theme={null}
import wandb

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

***

### <kbd>메서드</kbd> `Api.run`

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

`entity/project/run_id` 형식의 경로를 파싱하여 단일 run을 반환합니다.

**Args:**

* `path`:  `entity/project/run_id` 형식의 run 경로입니다. `api.entity` 가 설정된 경우 `project/run_id` 형식을 사용할 수 있고, `api.project` 가 설정된 경우 run\_id만 사용할 수 있습니다.

**Returns:**
`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` 객체를 지연 방식으로 순회(iterate)하는 `Runs` 객체를 반환합니다.

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

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

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

더 복잡한 필터링을 위해 MongoDB 쿼리 연산자를 사용할 수 있습니다. 자세한 내용은 [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`

**Args:**

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

**Returns:**
`Run` 객체들의 이터러블 컬렉션인 `Runs` 객체를 반환합니다.

**Examples:**

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

# config.experiment_name이 "foo"로 설정된 프로젝트의 runs 찾기
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>method</kbd> `Api.slack_integrations`

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

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

**Args:**

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

**Yields:**

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

**Examples:**
팀 "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` 형식의 경로를 파싱하여 스윕을 반환합니다.

**Args:**

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

**Returns:**
`Sweep` 객체.

***

### <kbd>method</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`을(를) 반환합니다.

**Args:**

* `team`: 팀 이름.

**Returns:**
`Team` 객체를 반환합니다.

***

### <kbd>메서드</kbd> `Api.update_automation`

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

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

**Args:**

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

**Returns:**
업데이트된 자동화.

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

```python theme={null}
import wandb

api = wandb.Api()

automation = api.automation(name="my-automation")
automation.enabled = False
automation.description = "Kept for reference, but no longer used."

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 큐를 생성하거나 업데이트(upsert)합니다.

**Args:**

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

**Returns:**
생성되었거나 업데이트된 `RunQueue`.

**Raises:**
파라미터가 잘못된 경우에는 ValueError를, wandb API 오류가 발생하면 wandb.Error를 발생시킵니다.

### <kbd>method</kbd> `Api.user`

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

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

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

**인수(Args):**

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

**반환값(Returns):**
`User` 객체 또는 사용자를 찾을 수 없으면 None입니다.

***

### <kbd>method</kbd> `Api.users`

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

부분적인 사용자 이름 또는 이메일 주소 쿼리로 모든 사용자를 반환합니다.

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

**인수(Args):**

* `username_or_email`:  찾고자 하는 사용자 이름 또는 이메일의 접두사 또는 접미사입니다.

**반환값(Returns):**
`User` 객체의 배열.

***

### <kbd>메서드</kbd> `Api.webhook_integrations`

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

엔티티에 대한 webhook 인테그레이션 이터레이터를 반환합니다.

**Args:**

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

**Yields:**

* `Iterator[WebhookIntegration]`:  webhook 인테그레이션의 이터레이터.

**Examples:**
팀 "my-team"에 대해 등록된 모든 webhook 인테그레이션 가져오기:

```python theme={null}
import wandb

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

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

```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")
]
```
