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

Microsoft OneDrive

organization の OneDrive file を、Squid AI agent 用の検索可能な knowledge として index 化します​

OneDrive Connector の Functionality​

OneDrive connector は、Microsoft 365 organization の OneDrive account 内の file を knowledge base に読み込み、Squid AI agent がその content を使用して question に answer できるようにします。

  • Squid は tenant 内のすべての user の OneDrive file を index 化し、index を自動的に sync します。新しい user は 1 時間ごとに discover され、file の change、rename、delete は 10 分ごとに取得されます。
  • OneDrive connector に接続された AI agent は、index 化された content を semantic search し、index 済み document を list 化できます。search result は、各 result がどの user の drive に由来するかを識別します。
  • Squid は OneDrive 固有の permission を尊重できるため、agent は chat 中の person が OneDrive で開ける file のみを retrieve します。Respecting source permissionsを参照してください。
  • access は read-only です。Squid が OneDrive に write することはありません。

Microsoft Entra App Registration の作成​

connector は application permission を持つ app registration を使用して authenticate します(per-user sign-in は不要です)。

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

  2. 作成後、Overview tab で Application (client) ID と Directory (tenant) ID を控えます。

  3. Certificates & secrets で新しい client secret を作成し、その value を保存します。client secret には expiration があり(default は 6 か月、最大 24 か月)、secret の有効期限が切れると sync は silent に停止します。追跡できる expiration を選択し、それまでに Squid Console で新しい secret を connector に update してください。

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

    • Files.Read.All - user drive の file を read するため
    • User.Read.All - tenant の user を enumerate するため

Squid Application に OneDrive Connector を追加する​

  1. Squid Console の Connectors tab に移動します。

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

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

  4. 以下の configuration detail を指定します。

Connector ID: code 内で connector を一意に識別する string。この value は後で変更できません。

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

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

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

connector を追加すると、Squid は tenant drive の initial sync を開始します。search の test 前に indexing が完了するまでしばらく待機してください。

注記

connector は Microsoft 365 work および school tenant をサポートします(application permission には admin consent が必要です)。tenant 内のすべての user の drive を常に index 化します。現在、per-user または per-folder の選択には対応していません。

Application で OneDrive Connector を使用する​

No-code Studio​

  1. Squid Console の Studio tab に移動します。

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

  3. "docs-agent" や "This agent answers questions using our OneDrive files" などの agent ID と description を指定します。

  4. Add Abilities をクリックし、Storage section まで scroll して、先ほど作成した Microsoft OneDrive connector を選択します。

  5. 「user が OneDrive に保存されている content について質問した場合にこれを call する」など、agent がこの connection を使用する方法の description を指定します。

  6. Test をクリックし、agent に「Search OneDrive for the Q3 planning docs」と尋ねてみます。

Squid SDK を使用する​

Squid SDK を使用して AI agent を作成する場合、ask() function の 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 を install します。

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();