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 は不要です)。
-
Azure Portal で App registrations に移動し、New registration をクリックします。single-tenant registration を選択します。
-
作成後、Overview tab で Application (client) ID と Directory (tenant) ID を控えます。
-
Certificates & secrets で新しい client secret を作成し、その value を保存します。client secret には expiration があり(default は 6 か月、最大 24 か月)、secret の有効期限が切れると sync は silent に停止します。追跡できる expiration を選択し、それまでに Squid Console で新しい secret を connector に update してください。
-
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 を追加する
-
Squid Console の Connectors tab に移動します。
-
Available Connectors をクリックします。
-
Microsoft OneDrive connector を見つけ、Add Connector を選択します。
-
以下の 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
-
Squid Console の Studio tab に移動します。
-
Create AI Agent をクリックします。
-
"docs-agent"や"This agent answers questions using our OneDrive files"などの agent ID と description を指定します。 -
Add Abilities をクリックし、Storage section まで scroll して、先ほど作成した Microsoft OneDrive connector を選択します。
-
「user が OneDrive に保存されている content について質問した場合にこれを call する」など、agent がこの connection を使用する方法の description を指定します。
-
Test をクリックし、agent に「Search OneDrive for the Q3 planning docs」と尋ねてみます。
Squid SDK を使用する
Squid SDK を使用して AI agent を作成する場合、ask() function の connectedIntegrations option に OneDrive connector を追加して接続します。
- TypeScript
- Python
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',
},
],
});
await squid.ai().agent('AGENT_ID').ask(
'Find the latest onboarding checklist in OneDrive',
options={
'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();