メインコンテンツまでスキップ

Microsoft OneDrive

組織の OneDrive ファイルを、Squid AI agents が検索可能なナレッジとしてインデックス化する

OneDrive connector の機能

OneDrive connector は、Microsoft 365 組織の OneDrive アカウント内のファイルを knowledge base に読み込み、Squid AI agents がそのコンテンツを使用して質問に回答できるようにします。

  • Squid は tenant 内のすべての user の OneDrive files をインデックス化し、index を自動的に同期します。新しい user は 1 時間ごとに検出され、file の変更、名前変更、削除は 10 分ごとに取得されます。
  • OneDrive connector に接続された AI agents は、インデックス化されたコンテンツを semantic search し、インデックス化された documents を一覧表示できます。検索結果には、各結果がどの user の drive から取得されたかが示されます。
  • アクセスは read-only です。Squid が OneDrive に書き込むことはありません。

Microsoft Entra app registration の作成

connector は、application permissions を持つ app registration を使用して認証します(user ごとの sign-in は不要です)。

  1. Azure PortalApp registrations に移動し、New registration をクリックします。single-tenant registration を選択します。

  2. 作成後、Overview タブから Application (client) IDDirectory (tenant) ID を控えておきます。

  3. Certificates & secrets で新しい client secret を作成し、その値を保存します。client secret には有効期限があり(デフォルトは 6 か月、最大 24 か月)、失効すると同期は通知なく停止します。追跡できる有効期限を選び、失効前に Squid Console で connector を新しい secret に更新してください。

  4. API permissions で、次の Microsoft Graph application permissions を追加し、admin consent を付与します。

    • Files.Read.All - users の drives から files を読み取るため
    • User.Read.All - tenant 内の users を列挙するため

Squid application への OneDrive connector の追加

  1. Squid ConsoleConnectors タブに移動します。

  2. Available Connectors をクリックします。

  3. Microsoft OneDrive connector を見つけ、Add Connector を選択します。

  4. 次の設定情報を入力します。

Connector ID: コード内で connector を一意に識別する文字列です。これは後から変更できません。

Client ID: app registration の Application (client) ID です。

Tenant ID: app registration の Directory (tenant) ID です。

Client Secret: 作成した client secret です。これは Squid secret として安全に保存されます。

connector が追加されると、Squid は tenant の drives の初期同期を開始します。検索をテストする前に、インデックス化が完了するまでしばらく待ってください。

注記

connector は Microsoft 365 の work および school tenants をサポートします(application permissions には admin consent が必要です)。tenant 内のすべての users の drives が常にインデックス化されます。現在、user ごとまたは folder ごとの選択はできません。

application で OneDrive connector を使用する

No-code Studio

  1. Squid ConsoleStudio タブに移動します。

  2. Create AI Agent をクリックします。

  3. "docs-agent" や "This agent answers questions using our OneDrive files" などの agent IDdescription を入力します。

  4. Add Abilities をクリックし、Storage セクションまでスクロールして、以前に作成した Microsoft OneDrive connector を選択します。

  5. "Call this when a user asks about content stored in OneDrive." など、この接続を agent がどのように使用すべきかを説明します。

  6. Test をクリックし、agent に "Search OneDrive for the Q3 planning docs" と質問してみます。

Squid SDK を使用する

Squid SDK で AI agent を作成している場合は、ask() 関数の connectedIntegrations option に OneDrive connector を追加して接続します。

await this.squid
.ai()
.agent('AGENT_ID')
.ask('Find the latest onboarding checklist in OneDrive', {
connectedIntegrations: [
{
integrationId: 'ONEDRIVE_CONNECTOR_ID',
integrationType: 'onedrive',
description: 'Call this connector to search OneDrive files',
},
],
});

npm package を使用する

backend code から programmatic access を行うには、@squidcloud/onedrive-client package をインストールします。

npm install @squidcloud/onedrive-client
import { OneDriveClient } from '@squidcloud/onedrive-client';

const onedrive = new OneDriveClient(squid, 'ONEDRIVE_CONNECTOR_ID');

// List everything that has been indexed
const documents = await onedrive.listIndexedDocuments();

// Trigger a full re-sync of all users' drives
await onedrive.syncAllUsers();