> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-serverless-sft-revamp.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 source
  </a>;

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

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

W\&B サーバーへのクエリ実行に使用されます。

**Examples:**

```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 を初期化します。

**Args:**

* `overrides`: `https://api.wandb.ai` 以外の W\&B サーバーを使用している場合に `base_url` を設定できます。また、 `entity` 、 `project` 、 `run` のデフォルト値を設定することも可能です。
* `timeout`: API リクエストの HTTP タイムアウト（秒）。指定しない場合はデフォルトのタイムアウトが使用されます。
* `api_key`: 認証に使用する APIキー。提供されない場合は、現在の環境または設定からの APIキー が使用されます。環境に設定されていない場合は、 APIキー の入力を求めるプロンプトが表示されます。

***

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

クライアントオブジェクトを返します。

**Returns:**

* `RetryingClient`: クライアントプロパティの値。

***

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

デフォルトの W\&B entity を返します。

**Returns:**

* `str | None`: default\_entity プロパティの値。

***

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

W\&B 公開ユーザーエージェントを返します。

**Returns:**

* `str`: user\_agent プロパティの値。

***

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

viewer オブジェクトを返します。

**Raises:**

* `ValueError`: W\&B から viewer データを取得できない場合。
* `requests.RequestException`: graphql リクエストの実行中にエラーが発生した場合。

**Returns:**

* `User`: viewer プロパティの値。

***

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

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

単一の Artifact を返します。

**Args:**

* `name`: Artifact の名前。Artifact の名前はファイルパスに似ており、最小構成として、Artifact がログ記録された Projects の名前、Artifact の名前、および Artifact のバージョンまたはエイリアスが含まれます。オプションとして、Artifact をログ記録した entity をプレフィックスとして追加し、その後にスラッシュを続けることができます。名前に entity が指定されていない場合は、 Runs または API 設定の entity が使用されます。
* `type`: 取得する Artifact のタイプ。

**Returns:**
`Artifact` オブジェクト。

**Raises:**

* `ValueError`: Artifact 名が指定されていない場合。
* `ValueError`: Artifact タイプが指定されているが、取得された Artifact のタイプと一致しない場合。

**Examples:**
以下のコードスニペットにおいて、"entity"、"project"、"artifact"、"version"、および "alias" は、それぞれあなたの W\&B entity、Artifact が属する Projects の名前、Artifact の名前、および Artifact のバージョンを表すプレースホルダーです。

```python theme={null}
import wandb

# プロジェクト、アーティファクト名、アーティファクトのエイリアスを指定
wandb.Api().artifact(name="project/artifact:alias")

# プロジェクト、アーティファクト名、特定のアーティファクトバージョンを指定
wandb.Api().artifact(name="project/artifact:version")

# entity、プロジェクト、アーティファクト名、アーティファクトのエイリアスを指定
wandb.Api().artifact(name="entity/project/artifact:alias")

# entity、プロジェクト、アーティファクト名、特定のアーティファクトバージョンを指定
wandb.Api().artifact(name="entity/project/artifact:version")
```

**Note:**

> このメソッドは外部利用のみを目的としています。wandb リポジトリのコード内で `api.artifact()` を呼び出さないでください。

***

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

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

タイプ別に単一の Artifact コレクションを返します。

返された `ArtifactCollection` オブジェクトを使用して、そのコレクション内の特定の Artifact に関する情報の取得などを行うことができます。

**Args:**

* `type_name`: 取得する Artifact コレクションのタイプ。
* `name`: Artifact コレクションの名前。オプションとして、Artifact をログ記録した entity をプレフィックスとして追加し、その後にスラッシュを続けることができます。

**Returns:**
`ArtifactCollection` オブジェクト。

**Examples:**
以下のコードスニペットにおいて、"type"、"entity"、"project"、および "artifact\_name" は、それぞれコレクションのタイプ、あなたの W\&B entity、Artifact が属する Projects の名前、および Artifact の名前を表すプレースホルダーです。

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

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

指定された Projects および entity 内に Artifact コレクションが存在するかどうかを確認します。

**Args:**

* `name`: Artifact コレクションの名前。オプションとして、Artifact をログ記録した entity をプレフィックスとして追加し、その後にスラッシュを続けることができます。entity または project が指定されていない場合、オーバーライドパラメータが存在すればそれらからコレクションを推測します。それ以外の場合、entity はユーザー設定から取得され、project はデフォルトで "uncategorized" になります。
* `type`: Artifact コレクションのタイプ。

**Returns:**
Artifact コレクションが存在する場合は True、そうでない場合は False。

**Examples:**
以下のコードスニペットにおいて、"type" および "collection\_name" は、それぞれ Artifact コレクションのタイプおよびコレクションの名前を指します。

```python theme={null}
import wandb

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

***

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

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

一致する Artifact コレクションの集合を返します。

**Args:**

* `project_name`: フィルタリングする Projects の名前。
* `type_name`: フィルタリングする Artifact タイプの名前。
* `per_page`: クエリのページネーションにおけるページサイズを設定します。通常、これを変更する理由はありません。

**Returns:**
イテラブルな `ArtifactCollections` オブジェクト。

***

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

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

指定された Projects および entity 内に Artifact バージョンが存在するかどうかを確認します。

**Args:**

* `name`: Artifact の名前。Artifact の entity と project をプレフィックスとして追加します。Artifact のバージョンまたはエイリアスをコロンで末尾に付けます。entity または project が指定されていない場合、設定されているオーバーライドパラメータを使用します。それ以外の場合、entity はユーザー設定から取得され、project は "Uncategorized" に設定されます。
* `type`: Artifact のタイプ。

**Returns:**
Artifact バージョンが存在する場合は True、そうでない場合は False。

**Examples:**
以下のコードスニペットにおいて、"entity"、"project"、"artifact"、"version"、および "alias" は、それぞれあなたの W\&B entity、Artifact が属する Projects の名前、Artifact の名前、および Artifact のバージョンを表すプレースホルダーです。

```python theme={null}
import wandb

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

***

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

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

一致する `ArtifactType` を返します。

**Args:**

* `type_name`: 取得する Artifact タイプの名前。
* `project`: 指定された場合、フィルタリングする Projects 名またはパス。

**Returns:**
`ArtifactType` オブジェクト。

***

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

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

一致する Artifact タイプの集合を返します。

**Args:**

* `project`: フィルタリングする Projects 名またはパス。

**Returns:**
イテラブルな `ArtifactTypes` オブジェクト。

***

### <kbd>method</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: 取得する Artifact のタイプ。 name: Artifact のコレクション名。オプションとして、Artifact をログ記録した entity をプレフィックスとして追加し、その後にスラッシュを続けることができます。 per\_page: クエリのページネーションにおけるページサイズを設定します。通常、これを変更する理由はありません。 tags: これらのタグをすべて持つ Artifact のみを返します。

**Returns:**
イテラブルな `Artifacts` オブジェクト。

**Examples:**
以下のコードスニペットにおいて、"type"、"entity"、"project"、および "artifact\_name" は、それぞれ Artifact タイプ、W\&B entity、Artifact がログ記録された Projects の名前、および Artifact の名前を表すプレースホルダーです。

```python theme={null}
import wandb

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

***

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

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

パラメータに一致する唯一の Automation を返します。

**Args:**

* `name`: 取得するオートメーションの名前。
* `entity`: オートメーションを取得する対象の entity。

**Raises:**

* `ValueError`: 検索条件に一致する Automation が 0 個または複数存在する場合。

**Examples:**
"my-automation" という名前の既存のオートメーションを取得します：

```python theme={null}
import wandb

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

entity "my-team" から "other-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]
```

指定されたパラメータに一致するすべての Automations に対するイテレータを返します。

パラメータが指定されない場合、返されるイテレータにはユーザーがアクセス権を持つすべての Automations が含まれます。

**Args:**

* `entity`: オートメーションを取得する対象の entity。
* `name`: 取得するオートメーションの名前。
* `per_page`: 1ページあたりに取得するオートメーションの数。デフォルトは 50 です。通常、これを変更する理由はありません。

**Returns:**
オートメーションのリスト。

**Examples:**
entity "my-team" のすべての既存のオートメーションを取得します：

```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: 作成するオートメーション。 fetch\_existing: True の場合、競合するオートメーションが既に存在すると、エラーを発生させる代わりに既存のオートメーションの取得を試みます。 \*\*kwargs: 作成前にオートメーションに割り当てる追加の値。指定された場合、これらはオートメーションに既に設定されている値を上書きします：

* `name`: オートメーションの名前。
* `description`: オートメーションの説明。
* `enabled`: オートメーションが有効かどうか。
* `scope`: オートメーションのスコープ。
* `event`: オートメーションをトリガーするイベント。
* `action`: オートメーションによってトリガーされるアクション。

**Returns:**
保存された Automation。

**Examples:**
特定のプロジェクト内の Run がカスタムしきい値を超えるメトリクスをログに記録したときに Slack 通知を送信する、"my-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="'custom-metric' が 10 を超えるたびに Slack メッセージを送信します。",
)
```

***

### <kbd>method</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`: チャートを所有する entity (ユーザーまたはチーム)。
* `name`: チャートプリセットの一意の識別子。
* `display_name`: UI に表示される人間が読める名前。
* `spec_type`: 仕様のタイプ。Vega-Lite v2 仕様の場合は "vega2" である必要があります。
* `access`: チャートのアクセスレベル：
  * "private": 作成した entity のみがチャートにアクセス可能。
  * "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`: 新しいプロジェクトの entity。

***

### <kbd>method</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`: レジストリの組織。設定に組織が設定されていない場合、entity が1つの組織にのみ属しているなら、その entity から組織が取得されます。
* `description`: レジストリの説明。
* `artifact_types`: レジストリで受け入れられる Artifact タイプ。タイプは 128 文字以内で、`/` または `:` 文字を含めることはできません。指定しない場合、すべてのタイプが受け入れられます。レジストリに追加された許可タイプは後で削除することはできません。

**Returns:**
レジストリオブジェクト。

**Examples:**

```python theme={null}
import wandb

api = wandb.Api()
registry = api.create_registry(
   name="my-registry",
   visibility="restricted",
   organization="my-org",
   description="これはテストレジストリです",
   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 を作成します。

**Args:**

* `run_id`: Run に割り当てる ID。指定しない場合、W\&B はランダムな ID を作成します。
* `project`: Run をログに記録する Projects。プロジェクトが指定されていない場合、"Uncategorized" という名前のプロジェクトにログを記録します。
* `entity`: プロジェクトを所有する entity。entity が指定されていない場合、デフォルトの entity に Run をログ記録します。

**Returns:**
新しく作成された `Run`。

***

### <kbd>method</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`: キューを作成する entity の名前。 `None` の場合、設定された entity またはデフォルトの entity を使用します。
* `prioritization_mode`: 使用する優先順位付けのバージョン。"V0" または `None`。
* `config`: キューに使用されるデフォルトのリソース設定。テンプレート変数を指定するにはハンドルバー（例： `{{var}}`）を使用します。
* `template_variables`: 設定で使用するテンプレート変数スキーマの辞書。

**Returns:**
新しく作成された `RunQueue`。

**Raises:**
パラメータのいずれかが無効な場合は `ValueError` 、W\&B API エラーの場合は `wandb.Error`。

***

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

新しいユーザーを作成します。

**Args:**

* `email`: ユーザーのメールアドレス。
* `admin`: ユーザーをグローバルインスタンス管理者として設定します。

**Returns:**
`User` オブジェクト。

***

### <kbd>method</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 オブジェクトは Runs のローカルキャッシュを保持しているため、スクリプトの実行中に Run の状態が変化する可能性がある場合は、 `api.flush()` を使用してローカルキャッシュをクリアし、Run に関連付けられた最新の値を取得する必要があります。

***

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

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

パスから Run、Sweep、Projects、または Report を返します。

**Args:**

* `path`: プロジェクト、Run、Sweep、または Report へのパス。

**Returns:**
`Project`、`Run`、`Sweep`、または `BetaReport` のインスタンス。

**Raises:**
パスが無効であるか、オブジェクトが存在しない場合は `wandb.Error`。

**Examples:**
以下のコードスニペットにおいて、"project"、"team"、"run\_id"、"sweep\_id"、および "report\_name" は、それぞれプロジェクト、チーム、Run ID、Sweep ID、および特定の Report の名前を表すプレースホルダーです。

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

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

entity のすべてのインテグレーションのイテレータを返します。

**Args:**

* `entity`: インテグレーションを取得する entity (チーム名など)。提供されない場合、ユーザーのデフォルト entity が使用されます。
* `per_page`: 1ページあたりに取得するインテグレーションの数。デフォルトは 50 です。通常、これを変更する理由はありません。

**Yields:**

* `Iterator[SlackIntegration | WebhookIntegration]`: サポートされているインテグレーションのイテレータ。

***

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

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

`Job` オブジェクトを返します。

**Args:**

* `name`: ジョブの名前。
* `path`: ジョブ Artifact をダウンロードするためのルートパス。

**Returns:**
`Job` オブジェクト。

***

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

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

指定された entity と Projects に対してジョブがある場合、そのリストを返します。

**Args:**

* `entity`: リストされるジョブの entity。
* `project`: リストされるジョブの Projects。

**Returns:**
一致するジョブのリスト。

***

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

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

指定された名前（および指定されていれば entity）を持つ `Project` を返します。

**Args:**

* `name`: プロジェクト名。
* `entity`: 要求された entity の名前。 `None` の場合、 `Api` に渡されたデフォルトの entity にフォールバックします。デフォルトの entity がない場合は `ValueError` を発生させます。

**Returns:**
`Project` オブジェクト。

***

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

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

指定された entity の Projects を取得します。

**Args:**

* `entity`: 要求された entity の名前。 `None` の場合、 `Api` に渡されたデフォルトの entity にフォールバックします。デフォルトの entity がない場合は `ValueError` を発生させます。
* `per_page`: クエリのページネーションにおけるページサイズを設定します。通常、これを変更する理由はありません。

**Returns:**
`Project` オブジェクトのイテラブルなコレクションである `Projects` オブジェクト。

***

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

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

`Registry` オブジェクトのレイジーイテレータを返します。

イテレータを使用して、組織のレジストリ全体でレジストリ、コレクション、または Artifact バージョンを検索およびフィルタリングします。

**Args:**

* `organization`: (str, オプション) 取得するレジストリの組織。指定しない場合、ユーザー設定で指定された組織が使用されます。
* `filter`: (dict, オプション) レイジーレジストリイテレータの各オブジェクトに適用する 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:**
名前が "model" を含むすべてのレジストリを検索します。

```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" であるバージョンを持つレジストリ内のすべての Artifact バージョンを検索します。

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

名前が "model" を含み、タグが "prod" またはエイリアスが "best" である、レジストリ内のすべての Artifact バージョンを検索します。

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

***

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

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

レジストリ名を指定してレジストリを返します。

**Args:**

* `name`: レジストリの名前。これには `wandb-registry-` プレフィックスは含まれません。
* `organization`: レジストリの組織。設定に組織が設定されていない場合、entity が1つの組織にのみ属しているなら、その entity から組織が取得されます。

**Returns:**
レジストリオブジェクト。

**Examples:**
レジストリを取得して更新する

```python theme={null}
import wandb

api = wandb.Api()
registry = api.registry(name="my-registry", organization="my-org")
registry.description = "これは更新された説明です"
registry.save()
```

***

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

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

指定されたプロジェクトパスの Reports を取得します。

注意: `wandb.Api.reports()` API はベータ版であり、将来のリリースで変更される可能性があります。

**Args:**

* `path`: Report が存在する Projects へのパス。プロジェクトを作成した entity をプレフィックスとして追加し、その後にスラッシュを続けます。
* `name`: 要求された Report の名前。
* `per_page`: クエリのページネーションにおけるページサイズを設定します。通常、これを変更する理由はありません。

**Returns:**
`BetaReport` オブジェクトのイテラブルなコレクションである `Reports` オブジェクト。

**Examples:**

```python theme={null}
import wandb

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

***

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

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

entity の指定された名前の `RunQueue` を返します。

Run キューの作成方法の詳細については、 `Api.create_run_queue` を参照してください。

***

### <kbd>method</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` オブジェクトをレイジーに反復する `Runs` オブジェクトを返します。

フィルタリングに使用できるフィールドには、以下が含まれます：

* `createdAt`: Run が作成されたタイムスタンプ（ISO 8601 形式、例: "2023-01-01T12:00:00Z"）。
* `displayName`: Run の人間が読める表示名（例: "eager-fox-1"）。
* `duration`: Run の総実行時間（秒）。
* `group`: 関連する Runs をまとめて整理するために使用されるグループ名。
* `host`: Run が実行されたホスト名。
* `jobType`: ジョブのタイプまたは Run の目的。
* `name`: Run の一意識別子（例: "a1b2cdef"）。
* `state`: Run の現在の状態。
* `tags`: Run に関連付けられたタグ。
* `username`: Run を開始したユーザーのユーザー名。

さらに、Run 設定（config）やサマリーメトリクス内の項目でフィルタリングすることもできます（ `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) プロジェクトへのパス。"entity/project" の形式である必要があります。
* `filters`: (dict) MongoDB クエリ言語を使用した特定の Runs のクエリ。config.key、summary\_metrics.key、state、entity、createdAt などの Run プロパティでフィルタリングできます。
* `例`: `{"config.experiment_name": "foo"}` は、設定項目の experiment name が "foo" に設定されている Runs を検索します。
* `order`: (str) 並び順は `created_at`、`heartbeat_at`、`config.*.value`、または `summary_metrics.*` を指定できます。 `+` を先頭に付けると昇順（デフォルト）、 `-` を先頭に付けると降順になります。デフォルトの順序は run.created\_at の古い順です。
* `per_page`: (int) クエリのページネーションにおけるページサイズを設定します。
* `include_sweeps`: (bool) 結果に Sweep の Runs を含めるかどうか。
* `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" に設定されているプロジェクト内の Runs を検索
Api.runs(
    path="my_entity/project",
    filters={
         "$or": [
             {"config.experiment_name": "foo"},
             {"config.experiment_name": "bar"},
         ]
    },
)
```

```python theme={null}
# config.experiment_name が正規表現に一致するプロジェクト内の Runs を検索
# (アンカーはサポートされていません)
Api.runs(
    path="my_entity/project",
    filters={"config.experiment_name": {"$regex": "b.*"}},
)
```

```python theme={null}
# Run の表示名が正規表現に一致するプロジェクト内の Runs を検索
# (アンカーはサポートされていません)
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]
```

entity の Slack インテグレーションのイテレータを返します。

**Args:**

* `entity`: インテグレーションを取得する entity (チーム名など)。提供されない場合、ユーザーのデフォルト entity が使用されます。
* `per_page`: 1ページあたりに取得するインテグレーションの数。デフォルトは 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>method</kbd> `Api.sweep`

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

`entity/project/sweep_id` 形式のパスを解析して Sweep を返します。

**Args:**

* `path`: entity/project/sweep\_id 形式の Sweep へのパス。 `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>method</kbd> `Api.team`

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

指定された名前を持つ一致する `Team` を返します。

**Args:**

* `team`: チームの名前。

**Returns:**
`Team` オブジェクト。

***

### <kbd>method</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 = "参照用に保持しますが、現在は使用されていません。"

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="参照用に保持しますが、現在は使用されていません。",
)
```

***

### <kbd>method</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 キューをアップサート（更新または挿入）します。

**Args:**

* `name`: 作成するキューの名前
* `entity`: オプション。キューを作成する entity の名前。 `None` の場合、設定された entity またはデフォルトの entity を使用します。
* `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、W\&B 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>method</kbd> `Api.webhook_integrations`

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

entity の Webhook インテグレーションのイテレータを返します。

**Args:**

* `entity`: インテグレーションを取得する entity (チーム名など)。提供されない場合、ユーザーのデフォルト entity が使用されます。
* `per_page`: 1ページあたりに取得するインテグレーションの数。デフォルトは 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](https://my-fake-url.com)" にリクエストを送信する Webhook インテグレーションのみを検索します：

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