ダッシュボード
メモリ

関数呼び出し

モデル ツール ループからメモリを取得します。

アプリケーションがすでにモデル リクエストを所有している場合、関数呼び出しが優先されるメモリ統合です。モデルは、現在のコンテキストに長期記憶が必要かどうかを決定します。サーバーは ID と認証情報を所有します。

#関数宣言

{
  "name": "halo_retrieve_end_user_memory",
  "description": "Retrieve relevant long-term memory for this end user.",
  "parameters": {
    "type": "object",
    "properties": {
      "sessionData": {
        "type": "object",
        "description": "Current conversation and application state."
      },
      "query": {
        "type": "string",
        "description": "Optional retrieval focus."
      },
      "limit": {
        "type": "number",
        "description": "Maximum raw records to return."
      }
    },
    "required": ["sessionData"]
  }
}

#関数を実行する

curl -X POST \
  https://api.agihalo.com/api/v1/memory/functions/halo_retrieve_end_user_memory \
  -H "Authorization: Bearer $HALO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectKey": "customer-product",
    "endUserKey": "user_123",
    "arguments": {
      "sessionData": {
        "messages": [
          {
            "role": "user",
            "content": "What format do I prefer for weekly reports?"
          }
        ]
      },
      "query": "weekly report preference",
      "limit": 5
    }
  }'

#レスポンスを使用する

HALO は、取得可能なトピックとリンクされた処理済みの生の交換を即座に選択します。応答には、 selectedTopicKeysselectionReasonoverallSummarytopicsrawEntries、およびコンパクトfunctionResponse.

{
  "name": "halo_retrieve_end_user_memory",
  "projectKey": "customer-product",
  "endUserKey": "user_123",
  "selectedTopicKeys": ["report_preferences"],
  "selectionReason": "The user is asking about report format.",
  "overallSummary": "The user prefers concise weekly reports.",
  "functionResponse": {
    "requestId": "memory_request_id",
    "rawEntries": [
      {
        "id": "raw_entry_id",
        "topic": { "topicKey": "report_preferences" },
        "requestRaw": { "messages": [] },
        "responseRaw": { "role": "assistant", "content": "..." }
      }
    ]
  }
}

スコープが存在しない場合、HALO は空のトピックと生の配列を含む同じ形状を返します。これを通常の初回ユーザー状態として扱います。

#回答後にキャプチャ

取得が書き込みを意味することはありません。モデルが最終アシスタント メッセージを生成した後にキャプチャを呼び出します。

curl -X POST https://api.agihalo.com/api/v1/memory/capture \
  -H "Authorization: Bearer $HALO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "projectKey": "customer-product",
    "endUserKey": "user_123",
    "sessionData": {
      "messages": [
        {
          "role": "user",
          "content": "Keep my weekly reports short and send them in the morning."
        }
      ]
    },
    "response": {
      "role": "assistant",
      "content": "I will keep them concise and morning-ready."
    }
  }'