> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Reports and Workspaces API の概要

> W&B Reports and Workspaces API を使用して、Reports と Workspace をプログラムから作成・管理します

`wandb_workspaces` から利用できる W\&B Reports and Workspaces API を使用すると、調査結果の共有に向けて Web 上で公開できる [Reports](/ja/models/reports/) を作成できるほか、トレーニングやファインチューニングの作業を行った [Workspace](/ja/models/app/features/cascade-settings/) をカスタマイズできます。

<Card title="ソースコードを表示" href="https://github.com/wandb/wandb-workspaces/blob/main/wandb_workspaces/" icon="github" />

<Note>
  W\&B Report and Workspace API はパブリックプレビューです。
</Note>

<div id="installation-and-setup">
  ## インストールと設定
</div>

<div id="sign-up-and-create-an-api-key">
  ### サインアップしてAPIキーを発行する
</div>

お使いのマシンをW\&Bに対して認証するには、まず [User Settings](https://wandb.ai/settings) でAPIキーを発行する必要があります。

<div id="install-and-import-packages">
  ### パッケージのインストールとインポート
</div>

W\&B Reports および Workspaces のライブラリをインストールします。

```python theme={null}
pip install wandb-workspaces
```

<div id="create-a-report">
  ### レポートを作成する
</div>

レポートを作成するには、Team の entity を指定し、レポートの名を入力します。囲まれたテキストを実際の値に置き換えてください。

```python theme={null}
import wandb_workspaces.reports.v2 as wr 
# 作成
report = wr.Report(
    entity="<team_entity>",
    project="<project_name>",
    title='Quickstart Report',
    description="That was easy!"
)

# レポートを保存
report.save()
```

次に、レポートにブロックとパネルを追加します。たとえば、次のコードは、目次、ヘッダー、段落を含むレポートを作成します。

```python theme={null}
report.blocks = [
    wr.TableOfContents(),
    wr.H1("Text and images example"),
    wr.P("Lorem ipsum dolor sit amet."),
]
report.save()
```

エンドツーエンドの例は、[レポート API クイックスタート](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/intro/Report_API_Quickstart.ipynb) の Google Colab を参照してください。

<div id="create-a-workspace">
  ### Workspace を作成する
</div>

次のコードは、折れ線グラフ、棒グラフ、スカラーチャートの 3 つのパネルを含むセクションを持つ Workspace を作成する方法を示しています。角括弧で囲まれたテキストは、実際の値に置き換えてください。

```python theme={null}
# インポート方法
import wandb_workspaces.workspaces as ws

# Workspaceを作成する
ws.Workspace(
     entity="<team_entity>", # Workspaceを所有するentity
     project="<project_name>", # Workspaceに関連付けられたプロジェクト
     sections=[
         ws.Section(
             name="<Validation Metrics>",
             panels=[
                 wr.LinePlot(x="Step", y=["<val_loss>"]),
                 wr.BarPlot(metrics=["<val_accuracy>"]),
                 wr.ScalarChart(metric="<f1_score>", groupby_aggfunc="<mean>"),
             ],
             is_open=True,
         ),
     ],
)
workspace.save()
```

一連の流れを通した例については、[Workspace API クイックスタート](https://colab.research.google.com/github/wandb/wandb-workspaces/blob/Update-wandb-workspaces-tuturial/Workspace_tutorial.ipynb#scrollTo=MmxL0wjvrNtQ) の Google Colab を参照してください。
