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

# Reports and Workspaces API の概要

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

W\&B Reports and Workspaces API は `wandb_workspaces` から利用でき、[report](/ja/products/wandb/reports) を作成したり、トレーニングやファインチューニングを行った [Workspace](/ja/products/wandb/app/features/cascade-settings) をカスタマイズしたりできます。作成した report は Web 上に公開して、分析結果を共有できます。

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

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

<h2 id="installation-and-setup">
  インストールとセットアップ
</h2>

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

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

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

W\&B Report and Workspaces ライブラリをインストールします。

```python theme={"system"}
pip install wandb-workspaces
```

<h3 id="create-a-report">
  report を作成する
</h3>

report を作成するには、チームの entity を指定し、report の名前を設定します。囲まれたテキストをご自身の値に置き換えてください。

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

# report を保存
report.save()
```

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

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

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

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

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

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

# workspace を作成
ws.Workspace(
     entity="<team_entity>", # workspace を所有する entity
     project="<project_name>", # workspace に関連付ける project
     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()
```

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