目次
この記事について
本記事は、Agent Builder を使用したデータストア参照型対話エージェントの作成に関する調査記録です。
やりたいこと
Agent Builder を用いたデータストア参照型対話エージェントの作成において、
データストアのファイル数が増加することで回答率が低下する問題への対処を進める。
前回の調査日記
あわせて読みたい


AI Agent開発日記 2025/04/01
この記事について 本記事は、Agent Builder を使用したデータストア参照型対話エージェントの作成に関する調査記録です。 やりたいこと Agent Builder を用いたデータス...
Agent BuilderのツールであるOpenAPIのスキーマを適切に設定し、Cloud RunにデプロイしたElasticsearchで検索できるか調べる。
- やりたいこと
- 検索結果がツールの
output
内にしか出ていなく、agentが解説してくれない場合や、output内容が一部欠如する場合などがあるため修正したい。
- 検索結果がツールの
- 結果
- スキーマのres部分を下記のように修正した結果、output内容が一部欠如する問題は解決した、
次はたまに「registryインデックスのデザイナーを検索して」という指示文で、インデックス全体を取得してしまうことなどがあり不安定なので修正する。
- スキーマのres部分を下記のように修正した結果、output内容が一部欠如する問題は解決した、
新スキーマ
openapi: 3.0.0
info:
title: Elasticsearch Search API
version: v1
servers:
- url: 'https://app-elasticsearch-appyouta-837157351927.us-west1.run.app'
paths:
/_search:
post: # ここを "get" ではなく "post" に変更
summary: Search documents in Elasticsearch
description: Executes a search query against an Elasticsearch index.
requestBody: # クエリをボディで送信するように変更
required: true
content:
application/json:
schema:
type: object
properties:
query:
type: object
description: Query in Elasticsearch Query DSL format.
responses:
'200':
description: Successful response with search results.
content:
application/json:
schema:
type: object
properties:
took:
type: integer
description: Time taken for the query in milliseconds.
timed_out:
type: boolean
description: Indicates if the query timed out.
_shards:
type: object
properties:
total:
type: integer
successful:
type: integer
skipped:
type: integer
failed:
type: integer
hits:
type: object
properties:
total:
type: object
properties:
value:
type: integer
relation:
type: string
max_score:
type: number
hits:
type: array
items:
type: object
properties:
_index:
type: string
_type:
type: string
_id:
type: string
_score:
type: number
_source:
type: object
properties:
name:
type: string
occupation:
type: object
properties:
id:
type: string
name:
type: string