<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Jonathan Simon - Elasticsearch Labs]]></title>
    <description><![CDATA[Articles and tutorials from the Search team at Elastic]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Jonathan Simon - Elasticsearch Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1121c0bf0e8a6e65/6a88da6340a1841030ef456f/search-labs-thumbnail.png</url>
      <link>https://www.elastic.co/jp/search-labs/author/jonathan-simon</link>
    </image>
    <link>https://www.elastic.co/jp/search-labs/author/jonathan-simon</link>
    <atom:link href="https://www.elastic.co/jp/search-labs/rss/author/jonathan-simon.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[jp]]></language>
    <lastBuildDate>Mon, 28 Sep 2026 03:58:14 GMT</lastBuildDate>
  <item>
    <title><![CDATA[Elastic Agent BuilderとStrands Agents SDKの使用を開始]]></title>
    <description><![CDATA[Elastic Agent Builderでエージェントを作成する方法を学び、次にStrands Agents SDKで管理されたA2Aプロトコルを介してエージェントを使用する方法を学びましょう。]]></description>
    <content:encoded><![CDATA[<p>AIエージェントのアイデアをお持ちですか？おそらく、データを使って何かを行うことが関係しているでしょう。エージェントが有用なアクションを開始するには、決定を下す必要があり、正しい決定を下すには正しいデータが必要だからです。</p><p>Elastic Agent Builderは、データ接続型AIエージェントを簡単に構築できるようにします。このブログ記事でその方法を説明します。まず、Elasticに格納されているデータにアクセスするMCPツールを使ってエージェントを作成するのに必要なすべてのステップを見ていきましょう。次に、Strands Agents SDKとそのAgent2Agent（A2A）機能を使用してエージェントを操作します。<a href="https://strandsagents.com/">Strands Agents SDK</a>は、望む結果を得るために十分なコードでエージェント向けアプリを構築するマルチエージェントAI開発プラットフォームです。</p><p>AIエージェントを構築しましょう。このエージェントは、RPS+というゲームをプレイします。これは古典的な「じゃんけん」に追加のひねりを加えたもので、プレイヤーにいくつかの追加の選択肢を与えます。</p><h2>要件</h2><p>こちらのブログ記事の手順に従うために必要なものは次のとおりです。</p><ul><li><p>ローカルコンピューターで実行されているテキストエディター</p><ul><li><p>このブログ記事の例では<a href="https://code.visualstudio.com/download">Visual Studio Code</a>を使用します。</p></li></ul></li><li><p>ローカルコンピューターで実行されている<a href="https://www.python.org/downloads/">Python 3.10以上</a></p></li></ul><h2>Serverlessプロジェクトを作成する</h2><p>最初に必要なのは、Elastic Agentビルダーを含むElasticsearch Serverlessプロジェクトです。</p><p><a href="http://cloud.elastic.co/">cloud.elastic.co</a>に移動して新しいElasticsearch Serverlessプロジェクトを作成します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3472edce39ec0b81/6a17060e66c4f93c17f8bf57/31b6a5c1c30dacbb4d5e58d1c566071e7143a0c8-1600x879.gif" alt="" /><h2>インデックスを作成してデータを追加する</h2><p>次に、Elasticsearchプロジェクトにデータを追加します。開発者ツールを開き、コマンドを実行して新しいインデックスを作成し、そこにデータを挿入します。トップレベルのナビゲーションメニューから「開発者向けツール」を選択します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltaedaa94068c07a17/6a17060f961e697558c4ce5f/f97d5af077504463155655a9e27c171a7f974f71-1600x879.jpg" alt="" /><p>コピーして、以下のPUTコマンドを開発者向けツールコンソールのリクエストインプットエリアに貼り付けてください。この文は「game-docs」という名前のElasticsearchインデックスを作成します。</p>PUT /game-docs
{
  "mappings": {
    "properties": {
      "title": { "type": "text" },
      "content": { 
        "type": "text"
      },
      "filename": { "type": "keyword" },
      "last_modified": { "type": "date" }
    }
  }
}<p>開発者ツールのステートメントの右側に表示される <strong>[リクエストの送信]</strong> ボタンをクリックします。開発者向けツールの対応エリアに<em>game-docs</em>インデックスが作成されたことを確認する通知が表示されるはずです。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt430c357b479d93af/6a170611a6c2b98191e79624/be0555a1930e4d4f58b7ed8b669c9b702532ed17-1600x880.jpg" alt="" /><p><em>game-docs</em>という名前のインデックスは、作成中のゲームのデータを保存するのに最適な場所です。ゲームに必要なすべてのデータを含むこのインデックスに、<em>rps+-md</em>という名前のドキュメントを配置しましょう。次のPUTコマンドをコピーして、開発者向けツールコンソールに貼り付けます。</p>PUT /game-docs/_doc/rps+-md
{
  "title": "Rock Paper Scissors +",
  "content": "
# Game Name
RPS+

# Starting Prompt
Let's play RPS+ !
---
What do you choose?

# Game Objects
1. Rock 🪨 👊
2. Paper 📜 🖐
3. Scissors ✄ ✌️
4. Light ☼ 👍
5. Dark Energy ☄ 🫱

# Judgement of Victory
* Rock beats Scissors
  * because rocks break scissors
* Paper beats Rock
  * because paper covers rock
* Scissors beat Paper
  * because scissors cut paper
* Rock beats Light
  * because you can build a rock structure to block out light
* Paper beats Light
  * because knowledge stored in files and paper books helps us understand light
* Light beats Dark Energy
  * because light enables humans to lighten up and laugh in the face of dark energy as it causes the eventual heat death of the universe
* Light beats Scissors
  * because light is needed to use scissors safely
* Dark Energy beats Rock
  * because dark energy rocks more than rocks. It rocks rocks and everything else in its expansion of the universe
* Dark Energy beats Paper
  * because humans, with their knowledge stored in files and paper books, can't explain dark energy 
* Scissors beat Dark Energy
  * because a human running with scissors is darker than dark energy

# Invalid Input
I was hoping for an worthy opponent
  - but alas it appears that time has past
  - but alas there's little time for your todo list when [todo:fix this] is so vast

# Cancel Game
The future belongs to the bold. Goodbye..
",
  "filename": "RPS+.md",
  "last_modified": "2025-11-25T12:00:00Z"
}<p>ステートメントの横にある<strong> [リクエストの送信] </strong>ボタンをクリックして実行し、<em>rps+-md</em>ドキュメントをgame-docsのインデックスに追加してください。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt64d49e13754d5b25/6a17061214b270524be3c55d/3c01d8a4602de5c33337457591a388a4a4e3fad3-1600x879.jpg" alt="" /><p>クエリを実行するためのデータが用意されているはずです。Agent Builderを使用すると、クエリはこれまで以上に簡単になります。</p><p>トップレベルのナビゲーションメニューから<strong> [エージェント]</strong> を選択します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltb4d374bf2ba9135c/6a1706147d8d67468570e63e/82dbd2e9a439cabd5a5eea3d0ce005b87df0c3ea-1600x879.jpg" alt="" /><p>あとは、デフォルトのElastic AI Agentに「どんなデータがありますか？」と聞くだけです。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc0f879cf28772718/6a1706161949f7f25ee7a92d/f7a2f39c9d1486bdf02d9e88a732b540ac2e2cd1-1600x872.gif" alt="" /><p>Elastic AI Agentはデータを評価し、保有するデータの簡潔な説明を返します。</p><h2>ツールを作成する</h2><p>さて、Elasticにデータがいくつか入ったので、それを活用してみましょう。Agent Builderには、エージェントが必要なデータにアクセスし、タスクに適したコンテキストを得られるように<a href="https://modelcontextprotocol.io/">MCP</a>ツールを作成するための組み込みサポートが含まれています。ゲームデータを取得できるシンプルなツールを作りましょう。</p><p>Agent Builderのアクションメニューをクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt7802a6b94e81440c/6a170618ab7f085287db9db4/0e327c202674dda33bcc0e494d2b588fa8b32e4f-1600x879.png" alt="" /><p>メニューオプションから <strong>[すべてのツールを表示]</strong> を選択します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt9f52ffe114fb6ea7/6a17061a4a531b801b36a884/1ebf58650e9fb56750d3f0b1700fab50b44f9bdf-1600x879.png" alt="" /><p><strong>[+ 新しいツール] </strong>をクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt8090769f6c4d1899/6a17061c286714294093e219/6c03a7f28b99ac2d805f34f39948979893316a00-1600x879.png" alt="" /><p><strong>ツール作成</strong>フォームで<a href="https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql"><strong>ES|QL</strong></a>を選択します。ツール<strong>タイプ</strong>として次の値を入力します。</p><p><strong>ツールID</strong>について：</p>example.get_game_docs<p><strong>説明</strong>について：</p>Get RPS+ doc from Elasticsearch game-docs index.<p><strong>構成</strong>については、以下のクエリを<strong>ES|QLクエリ</strong>テキスト領域にします。</p>FROM game-docs | WHERE filename == "RPS+.md"<p>完了した<strong>ツール作成</strong>フォームは次のようになります。ツールを作成するには、 <strong>[保存]</strong> をクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt77034c305198217a/6a17061e66c4f9e54ef8bf5e/b6c93e344600f319b9d2c3030020cf2d171ac1c4-1600x1312.png" alt="" /><p>ツールラックに新しいツールが追加されました。ツールはラックに掛けておけばよいというものではなく、有効に活用されるべきものです。新しいカスタムツールを使用できるエージェントを作成しましょう。</p><h2>エージェントを作成し、ツールを割り当てます。</h2><p>Agent Builderを使えば、エージェントの作成は驚くほど簡単です。いくつかの詳細を記載したエージェントの指示を入力するだけで十分です。それではエージェントを作成しましょう。</p><p><strong>[エージェントを管理]</strong> をクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltaa8a83fc2f3758a9/6a1706201949f71a10e7a931/53934b93db07187e251d4b321cb9ca647e2fd51b-1600x858.png" alt="" /><p><strong>[+ 新しいエージェント] </strong>をクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3778403c5101a000/6a17062160084be12f3c449e/fae3ad8f31e71a6dfd044e1daa025a4e280b4e68-1600x490.png" alt="" /><p><strong>新しいエージェント</strong>フォームに次の情報を入力します。</p><p><strong>エージェントID</strong>には以下のテキストを入力します。</p>rps_plus_agent<p><strong>カスタム指示</strong>テキスト領域には次の指示を入力します。</p>When prompted, if the prompt contains an integer, then select the corresponding numbered item in the list of "Game Objects" from your documents. Otherwise select a random game object. This is your chosen game object for a single round of the game.

# General Game Rules
* 2 players
    - the user: the person playing the game
    - you: the agent playing the game and serving as the game master
* Each player chooses a game object which will be compared and cause them to tie, win or lose.

# Start the game
1. This is the way each new game always starts. You make the first line of your response only the name of your chosen game object. 

2. The remainder of your response should be the "Starting Prompt" text from your documents and generate a list of "Game Objects" for the person playing the game to choose a game object from.  

# End of Game: The game ends in one of the following three outcomes:
1. Invalid Input: If the player responds with an invalid game object choice, respond with variations of the "Invalid Input" text from your documents and then end the game.

2. Tie: The game ends in a tie if the user chooses the same game object as your game object choice.

3. Win or Lose: The game winner is decided based on the "Judgement of Victory" conditions from your documents. Compare the user's game object choice and your game object choice and determine who chose the winning game object.

# Game conclusion
Respond with a declaration of the winner of the game by outputting the corresponding text in the "Judgement of Victory" section of your documents.<p><strong>表示名</strong>には以下のテキストを入力します。</p>RPS+ Agent<p><strong>表示の説明</strong>には以下のテキストを入力します。</p>An agent that plays the game RPS+<p><strong>[ツール]</strong> タブをクリックして、以前に作成したカスタムツールをエージェントに提供します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte5b0fe00abdde07c/6a17062314b2704bc4e3c563/1778f64bc3a1b4004998dc3668ef7f666788e193-1600x1390.png" alt="" /><p>先ほど作成した<em>example.get_game_docs</em>ツールのみを選択します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt2210212e07e06104/6a170625a929cf3277ae08d1/7d734cd80161bcc058817482eb330ffcf1cb567b-1600x1363.png" alt="" /><p><strong>[保存]</strong> をクリックして新しいエージェントを作成します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6e3afc1918e26f14/6a170627ab7f084746db9db8/c0014faf605ce50c03679ed0d073bd9f3ae7234d-1600x468.png" alt="" /><p>新しいエージェントをテストしてみましょう。エージェントのリストから任意のエージェントとチャットを開始するための便利なリンクがあります。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blteb4b69dc5971d3a0/6a1706286f7f046840914743/b7d6943ad90a4f68691207caf66b81742e712145-1600x560.png" alt="" /><p>「start game」と入力すると、ゲームが始まります。うまくいきました！</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte5b621d602223dff/6a17062ab339d568a1769ef8/984d008e4cc3f08cc1f101720673b0f7347c066c-1600x874.gif" alt="" /><p>エージェントが応答の上部にゲームオブジェクトの選択を表示することがわかります。これは、エージェントの選択を確認し、ゲームが期待どおりに機能していることを確認できる点で便利です。しかし、自分が選択する前に相手の選択がわかっていると、じゃんけんゲームはあまり楽しくありません。ゲームを最終形に磨き上げるために、コードでエージェントを制御できるエージェントオーケストレーションプラットフォームを使用できます。</p><p>Strands Agents SDKがチャットに参加します。</p><h2>Strands Agents SDK</h2><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt73901ec745a97fbf/6a17062c964cea23c808bab3/c195bba6ff2754f5d8fda174a0c1d247bc283710-456x156.png" alt="" /><p>新しいエージェント開発フレームワークを試してみたい場合は、<a href="https://strandsagents.com/latest/">Strands Agents SDK</a>がおすすめです。<a href="https://aws.amazon.com/blogs/opensource/introducing-strands-agents-an-open-source-ai-agents-sdk/">Strands Agents SDKはAWSから2025年5月に</a>オープンソースの<a href="https://github.com/strands-agents/sdk-python">Python</a>実装としてリリースされ、現在は<a href="https://dev.to/aws/strands-agents-now-speaks-typescript-a-side-by-side-guide-12b3">Typescript</a>版もあります。</p><h2>PythonでStrands Agents SDKの使用を開始</h2><p>コーディングエンジンを起動して、Strandsエージェントを使用してA2Aプロトコル経由で<em>RPS+エージェント</em>を制御するサンプルアプリのクローン作成と実行のプロセスを早速実行してみましょう。RPS+ゲームの微調整バージョンを作成し、エージェントの選択がプレイヤーの選択後に明らかになるようにしてみましょう。結局のところ、じゃんけんのようなゲームを楽しいものにするのは推測と驚きの結果だからです。</p><p>ローカルコンピューターで<a href="https://code.visualstudio.com/download">Visual Studio Code</a>を開き、新しいターミナルを開きます。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3de752025d62993f/6a17062d0c4857f16501a997/2339cc37c89a3524f2b2a21684bc61dae958e1cf-915x460.jpg" alt="" /><p>新しく開いたターミナルで、以下のコマンドを実行してElasticsearch Labsリポジトリをクローンします。</p>git clone https://github.com/elastic/elasticsearch-labs<p>次の<em>cd</em>コマンドを実行して、ディレクトリをelasticsearch-labsディレクトリに変更します。</p>cd elasticsearch-labs<p>次に、次のコマンドを実行して、Visual Studio Codeでリポジトリを開きます。</p>code .<p>Visual Studio File Explorerで、<em>supporting-blog-content</em>フォルダーと<em>agent-builder-a2a-strands-agents</em>フォルダーを展開し、<em>elastic_agent_builder_a2a_rps+.py</em>ファイルを開きます。Visual Studio Codeで開いたファイルは次のようになります。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt65ef8036a70bcaf1/6a17062f1949f7af36e7a935/d153b19e0e016c701576edb99ccab5af7c554f34-1484x1530.jpg" alt="" /><p>テキストエディターに表示される<em>elastic_agent_builder_a2a_rps+.py</em>の内容は次のとおりです。</p>import asyncio
from dotenv import load_dotenv
from uuid import uuid4
import httpx
import os
import random
from a2a.client import A2ACardResolver, ClientConfig, ClientFactory
from a2a.types import Message, Part, Role, TextPart

DEFAULT_TIMEOUT = 60  # set request timeout to 1 minute


def create_message(*, role: Role = Role.user, text: str, context_id=None) -&gt; Message:
    return Message(
        kind="message",
        role="user",
        parts=[Part(TextPart(kind="text", text=text))],
        message_id=uuid4().hex,
        context_id=context_id,
    )


async def main():
    load_dotenv()
    a2a_agent_host = os.getenv("ES_AGENT_URL")
    a2a_agent_key = os.getenv("ES_API_KEY")
    custom_headers = {"Authorization": f"ApiKey {a2a_agent_key}"}

    async with httpx.AsyncClient(
        timeout=DEFAULT_TIMEOUT, headers=custom_headers
    ) as httpx_client:
        # Get agent card
        resolver = A2ACardResolver(httpx_client=httpx_client, base_url=a2a_agent_host)
        agent_card = await resolver.get_agent_card(
            relative_card_path="/rps_plus_agent.json"
        )
        # Create client using factory
        config = ClientConfig(
            httpx_client=httpx_client,
            streaming=True,
        )
        factory = ClientFactory(config)
        client = factory.create(agent_card)
        # Use the client to communicate with the agent
        print("\nSending 'start game' message to Elastic A2A agent...")
        random_game_object = random.randint(1, 5)
        msg = create_message(text=f"start with game object {random_game_object}")
        async for event in client.send_message(msg):
            if isinstance(event, Message):
                context_id = event.context_id
                response_complete = event.parts[0].root.text
                # Get agent choice from the first line of the response
                parsed_response = response_complete.split("\n", 1)
                agent_choice = parsed_response[0]
                print(parsed_response[1])
        # User choice sent for game results from the agent
        prompt = input("Your Choice  : ")
        msg = create_message(text=prompt, context_id=context_id)
        async for event in client.send_message(msg):
            if isinstance(event, Message):
                print(f"Agent Choice : {agent_choice}")
                print(event.parts[0].root.text)


if __name__ == "__main__":
    asyncio.run(main())<p>このコードで何が起きているのか見てみましょう。<em><code>main()</code></em>メソッドから始めて、コードはエージェントのURLとAPIキーの環境変数にアクセスすることから始まります。その値を用いてエージェントカードを取得するための<em><code>httpx</code></em><code> client</code>を作成します。次に、クライアントはエージェントカードの詳細を使用して、「start game」リクエストをエージェントに送信します。ここで注目すべき興味深い点は、 <code>"start game"</code>リクエストの一部として<code>random_game_object</code>値が含まれていることです。この値は、Python の標準ライブラリの<em>random</em>モジュールで生成された乱数です。これを行う理由は、（AIエージェントを可能にする）強力なLLMがランダム性に関してはそれほど優れていないことが判明したためです。Pythonが助けてくれますので問題ありません。</p><p>コードの続きですが、エージェントが「start game」リクエストに応答すると、コードはエージェントのゲームオブジェクトセレクションを取り除き、<em>agent_choice</em>変数に保存します。対応の残りの部分は、エンドユーザーに対してテキストとして表示されます。次に、ユーザーはゲームオブジェクトの選択を入力するように求められ、それがエージェントに送信されます。次に、コードはエージェントのゲームオブジェクトの選択と、エージェントの最終的なゲーム結果の決定を表示します。</p><h2>エージェントのURLとAPIキーを環境変数として設定する</h2><p>サンプルアプリはローカルコンピュータ上で実行されるため、Agent Builderエージェントと通信するためには、Strands Agents SDKにエージェントのA2A URLとAPI Keyを提供する必要があります。この例のアプリは<em>`.env`</em>というファイルを使用してこれらの値を格納します。</p><p><em>env.example</em>ファイルのコピーを作成し、新しいファイル名を<em>.env</em>とします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta17961cbcb42985c/6a170631b0367dc5a072bc55/25ead5f15a17dedb777132a082097cffb06cae4d-1600x843.jpg" alt="" /><p>Elastic Agent Builderに戻りましょう。ここで必要な両方の値を取得できます。</p><p>ページの右上にあるAgent Builderアクションメニューから <strong>[すべてのツールを表示]</strong> を選択します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt140885d7ebfcb969/6a1706327d8d67b17670e646/9c4f4e4a3bd76e11e0a182fa007a2f6aec7777b4-1600x880.jpg" alt="" /><p>ツールページ上部の<strong>MCPサーバー</strong>ドロップダウンをクリックし、<strong>[MCPサーバーURLをコピー] </strong>を選択してください。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc153c2caa27e949b/6a170634a292997793d00f6d/6cde0de678bb6f81bef8a59deffb110ad6c6ce26-1600x882.jpg" alt="" /><p><strong>MCPサーバーのURL</strong>を<em>.env</em>に貼り付けます。<strong>&lt;YOUR-ELASTIC-AGENT-BUILDER-URL&gt;</strong>プレースホルダー値の代わりにファイルを使用します。ここで、URLを1箇所更新する必要があります。つまり、末尾のテキスト「mcp」を「a2a」に置き換えます。これは、Agent Strands SDKがElastic Agent Builderで実行されているエージェントと通信するために使用するプロトコルが<a href="https://a2a-protocol.org/">A2Aプロトコル</a>であるためです。</p><p>編集したURLは次のようになるはずです。</p>https://rps-game-project-12345a.kb.us-east-1.aws.elastic.cloud/api/agent_builder/a2a<p>Elastic Cloudで取得する必要があるもう1つの値は、APIキーです。最上位ナビゲーションで<strong>Elasticsearch</strong>をクリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltada5de819f31d8ff/6a170635b339d55ae9769efc/651676b9be65178cdad50b5d24f26441c0bf3f97-1600x549.jpg" alt="" /><p><strong>[APIキーをコピー] ボタン</strong>をクリックして、APIキーをコピーします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta18f85790df00706/6a170637cf4f257145b2d0bd/17f1e2ed5c7682630c71e75b0b09ffb1d9036210-1600x879.jpg" alt="" /><p>次に、Visual Studio Codeに戻り、<em>.env</em>ファイルにAPIキーを貼り付けて、<strong>&lt;YOUR-ELASTIC-API-KEY&gt;</strong>プレースホルダーテキストを置き換えます。<em>.env</em>ファイルは次のようになります。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt92ab4b37cdcca85e/6a1706386f7f0472ed914747/a357947e07f29c8c03382e00c7baedf04a399297-1600x286.jpg" alt="" /><h2>サンプルアプリを実行してください</h2><p>Visual Studio Codeで新しいターミナルを開いてください。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt8702d826849755d0/6a17063a60084b45ca3c44a2/33e1174c68ea1ed47c7fe62ab6a6da657c606f56-1413x711.jpg" alt="" /><p>まず、ターミナルで次の<em>cd</em>コマンドを実行します。</p>cd elasticsearch-labs/supporting-blog-content/agent-builder-a2a-strands-agents<p>次のコマンドを実行して、Python仮想環境を作成します。</p>python -m venv .venv<p>お使いのローカルコンピューターのオペレーティングシステムに応じて、以下のコマンドを実行して仮想環境を有効にしてください。</p><ul><li><p>MacOS/Linux</p></li></ul>source .venv/bin/activate<ul><li><p>Windows</p></li></ul>.venv\Scripts\activate<p>サンプルアプリはStrands Agents SDKを使用するため、このチュートリアルではこれをインストールする必要があります。以下のコマンドを実行して、Strands Agents SDKとその必要なPythonライブラリの依存関係をインストールします。</p>pip install -r requirements.txt<p>発射台を片付けてカウントダウンを開始する時間です。アプリを起動する準備ができました。後ろに下がってください。次のコマンドを使用して実行しましょう：</p>python elastic_agent_builder_a2a_rps+.py<p>RPS+のゲームに挑戦してみましょう。幸運を祈ります！</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltbb3715672995fcfa/6a17063c6234e07b76db195f/041df81fbf1776f09e1243af0a435c4c0af6aca1-1600x948.gif" alt="" /><h2>関連コンテキストでAIアプリを構築</h2><p>AIエージェントの構築のスキルを習得できました。また、Strands Agents SDKのようなエージェント開発フレームワークで、A2Aを介してElastic Agent Builderエージェントを使用することがいかに簡単であるかをお分かりいただけたと思います。カスタムデータの関連コンテキストに接続されたAIエージェントの構築には<a href="https://cloud.elastic.co/registration?utm_source=agentic-ai-category&amp;utm_medium=search-labs&amp;utm_campaign=agent-builder">Elasticをお試し</a>ください。</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/agent-builder-a2a-strands-agents-guide</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/agent-builder-a2a-strands-agents-guide</guid>
    <category><![CDATA[AI]]></category>
    <category><![CDATA[エージェント型AI]]></category>
    <dc:creator><![CDATA[Jonathan Simon]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3472edce39ec0b81/6a17060e66c4f93c17f8bf57/31b6a5c1c30dacbb4d5e58d1c566071e7143a0c8-1600x879.gif" length="0" type="image/gif"/>
    <pubDate>Mon, 15 Dec 2025 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Azure LLM Functions を Elasticsearch と併用してよりスマートなクエリ エクスペリエンスを実現する]]></title>
    <description><![CDATA[Azure Gen AI LLM 関数と Elasticsearch を使用して柔軟なハイブリッド検索結果を提供する不動産検索アプリの例を調べます。GitHub Codespaces でサンプル アプリを構成して実行する方法を段階的に説明します。]]></description>
    <content:encoded><![CDATA[<p>精度。重要なときは、それは非常に重要なのです。何か特定のものを検索する場合、精度は非常に重要です。ただし、クエリが正確すぎると結果が返されない場合もあるため、クエリの範囲を広げて関連する可能性のある追加のデータを見つける柔軟性があると便利です。</p><p>このブログ記事では、Elasticsearch と Azure Open AI を使用して、非常に具体的な不動産物件を検索するときに正確な結果を見つける方法を示すサンプル アプリを作成する方法について説明します。同時に、特定の一致が見つからない場合でも関連性の高い結果を提供します。検索テンプレートとともに Elasticsearch インデックスを作成するために必要なすべての手順を説明します。次に、Azure OpenAI を使用してユーザー クエリを取得し、それを Elasticsearch 検索テンプレート クエリに変換して、驚くほどカスタマイズされた結果を生成できるアプリを作成するプロセス全体を説明します。</p><p>以下は、サンプルの不動産検索アプリを作成するために使用するすべてのリソースのリストです。</p><ul><li><p>Elasticsearch インデックスと検索テンプレート</p></li><li><p>Azure OpenAI</p></li><li><p>Azure マップ API</p></li><li><p><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb">コードスペース Jupyter ノートブック</a></p></li><li><p>セマンティックカーネル</p></li><li><p>Blazor フロントエンドを使用した C# アプリ</p></li></ul><h2>スマートクエリワークフロー</h2><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt0461b58012efd772/6a17f73fa292997d52d02e19/0c4a7c835e06c514f158c00ab1055a7ba719a35f-1600x765.png" alt="スマートクエリワークフロー" /><p>このワークフローは、LLM、LLM ツール、および検索を組み合わせて、自然言語クエリを構造化された関連性の高い検索結果に変換します。</p><ul><li><p><strong>LLM (大規模言語モデル)</strong> - 複雑なユーザークエリを解釈し、ツールを調整して検索意図を抽出し、コンテキストを強化します。</p></li><li><p><strong>LLM ツール</strong>- 各 LLM ツールは、この投稿用に作成した C# プログラムです。ツールは3つあります。</p><ul><li><p><em>パラメータ抽出ツール</em>: クエリから寝室、バスルーム、機能、価格などの主要な属性を取得します。</p></li><li><p><em>ジオコード ツール</em>: 空間フィルタリングのために場所の名前を緯度/経度に変換します。</p></li><li><p><em>検索ツール</em>: Elasticsearch 検索テンプレートにクエリパラメータを入力し、検索を実行します。<strong>ハイブリッド検索</strong>- 組み込みの ML 推論を使用してハイブリッド検索 (フルテキスト + 高密度ベクトル) を実行します。この階層化されたアプローチにより、エンドユーザーにとってよりスマートでコンテキストを意識したクエリ エクスペリエンスが保証されます。</p></li></ul></li></ul><h2>アプリケーションアーキテクチャ</h2><p>以下はサンプル アプリのシステム アーキテクチャ図です。Elastic Cloud とやり取りするために、Codespaces Jupyter Notebook を使用します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt7617ae80295a3e2b/6a17f74196142a35deeb1cb0/2880afee184cd9270c0eb4310e51418e2339784d-936x452.png" alt="Azure LLM Functions アプリのシステム アーキテクチャ図。" /><h2>要件</h2><p>GitHub Codespaces を使用してサンプル アプリのクローンを作成し、構成して実行するので、必要なのはブラウザーだけです。ソリューションの Elastic 部分では、 Elastic Cloudを使用して Elasticsearch Serverless プロジェクトを作成します。Azure リソースを操作するには、 <a href="https://portal.azure.com/">Azure Portal</a>を使用します。</p><h2>Codespaces でサンプル アプリのリポジトリをクローンする</h2><p>まず、サンプル アプリケーションのコードを複製します。これは、アプリケーションのクローンを作成して実行する方法を提供する<a href="https://github.com/codespaces/">GitHub Codespaces</a>で実行できます。<strong>「新しいコードスペース」をクリックします。</strong></p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltd4ed9c67e2d79c41/6a17f7436df73146a20a10bc/b89cbec491659b6c8a0bb9551ed2629f7a37f9fd-1600x427.png" alt="Codespaces でサンプル アプリ リポジトリのクローンを作成します。" /><p>次に、<strong> リポジトリ</strong> ドロップダウンでリポジトリ<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo"> jwilliams-elastic/msbuild-intelligent-query-demo</a><strong> を選択し、 コードスペースの作成を</strong> クリックします。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltdfcc992a6cb7a7d7/6a17f7450b0bed67c1dd3750/43ea377554527af9578400f16cd2342bf8fff3a2-1600x1049.png" alt="リポジトリドロップダウンをクリックし、コードスペースの作成をクリックします。" /><h2>.env を作成するファイル</h2><p>Elastic Cloud にアクセスして操作するには、Python Jupyter Notebook を使用します。これは、構成ファイルに保存されている構成値を使用して行われます。ノートブックの設定ファイルの名前は<em><strong>.env</strong></em>です。今すぐ作成してみましょう。</p><ol><li><p>GitHub Codespacesで、 <strong>「新規ファイル」</strong>ボタンをクリックし、 <em><strong>.env</strong></em>という名前のファイルを追加します。</p></li><li><p>新しく作成した<em><strong>.env</strong></em>に次の内容を追加します。ファイル</p></li></ol>ELASTIC_URL=
ELASTIC_API_KEY=<img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1a7dcb2fd2bb24f5/6a17f7462f4a5c21abfa8aa9/84d4f327948858ba61db0001dd8cf780d42fe0a7-1600x875.gif" alt="Python Jupyter Notebook を使用して Elastic Cloud にアクセスし、操作します。これは、構成ファイルに保存されている構成値を使用して行われます。 " /><p>ご覧のとおり、 <strong>ELASTIC_URL</strong>と<strong>ELASTIC_API_KEYという2つの値が欠落しており、</strong> <em>.env</em>に追加する必要があります。ファイル。サンプル アプリの検索機能を強化するバックエンドとして機能する Elasticsearch サーバーレス プロジェクトを作成して、これらを今すぐ取得しましょう。</p><h2>Elastic Serverlessプロジェクトを作成する</h2><ol><li><p><a href="http://cloud.elastic.co">cloud.elastic.co</a>にアクセスし、 <strong>「Create New Serverless project」</strong>をクリックします。</p></li><li><p><strong>Elasticsearch</strong> ソリューションの<strong> 「次へ」</strong> をクリックします</p></li><li><p><strong>ベクター用に最適化を</strong>選択</p></li><li><p><strong>クラウドプロバイダーを</strong><strong>Azure</strong>に設定する</p></li><li><p><strong>サーバーレスプロジェクトの作成を</strong>クリック</p></li><li><p>メインナビゲーションメニューの<strong>「はじめ</strong>に」をクリックし、下にスクロールして<strong>接続の詳細</strong>をコピーします。</p></li><li><p><strong>コピー</strong> ボタンをクリックして、<strong> 接続の詳細</strong> から<strong> Elasticsearchエンドポイント をコピーします。</strong></p></li><li><p><em><strong>.env</strong></em>を更新する<strong>ELASTIC_URL</strong>をコピーした<strong>Elasticsearch エンドポイント</strong>に設定するファイル</p></li></ol><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt95b7fefa05173822/6a17f748ec0f89f05f5a67c6/77a35e55446d396066b68cfd132d1543a07b81cc-1600x875.gif" alt="Elasticsearch で新しい Serverless プロジェクトを作成する方法。" /><h2>Elastic APIキーを作成する</h2><ol><li><p>Elasticsearchの<strong> Getting Started</strong> ページを開き、<strong> APIキーの追加</strong> セクションで<strong> 新規を クリックします。</strong></p></li><li><p>キー<strong>名</strong>を入力してください</p></li><li><p><strong>APIキーの作成を</strong>クリック</p></li><li><p>「コピー」ボタンをクリックしてAPIキーの値をコピーします</p></li><li><p><strong>Codespacesに戻ると、</strong> <em><strong>.env</strong></em>がある。ファイルを開いて編集し、コピーした値を貼り付けて<strong>ELASTIC_API_KEY</strong>を設定します。</p></li></ol><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf6b1c85d267e6ad0/6a17f74a4b055d118143239a/20168cba493d8e2c0d9ae7704eb0ae707df58e4c-1600x875.gif" alt="Elastic API キーを作成する方法。" /><h2>Codespacesノートブックを開き、ライブラリの依存関係をインストールする</h2><p>ファイル エクスプローラーで<em><strong>VectorDBSetup.ipynb</strong></em>ファイルを選択し、ノートブックを開きます。ノートブックが読み込まれたら、<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L40-L52"><strong> 「ライブラリのインストール」</strong></a><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L40-L52"> というタイトルのノートブックのセクション を見つけます</a><strong> 。</strong>セクションの再生ボタンをクリックします。</p><p>GitHub Codespaces でノートブックを初めて実行する場合は、Codespaces カーネルを選択して Python 環境を構成するように求められます。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt970f4fa30c6c9302/6a17f74c505ac30ee6ad8ceb/2272f70615dfb9dcbeb91f39b6dd5076213e24a5-1600x875.gif" alt="Codespaces Notebook にライブラリ依存関係をインストールします。" /><h2>Codespaces Notebook を使用してインポートを定義し、環境変数をロードする</h2><p>ノートブックの次のセクション<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L58-L104">「</a><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L58-L104"><strong>インポートの定義と環境変数の読み込み</strong></a>」に進みます。セクションの再生ボタンをクリックします。</p><p>このコードは、ノートブックで使用されるPythonライブラリをインポートし、 <em>.env</em>から環境変数を読み込みます。以前作成したもの。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6d74b41258420d5a/6a17f74e6317301f2f585c16/aa9f9198ff452ac0c4ce33b00f253731dbee22c5-1600x875.gif" alt="Codespaces Notebook を使用してインポートとロード環境変数を定義します。" /><h2>Codespaces Notebook を使用して Elastic ML 推論エンドポイントを作成する</h2><p>次の<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L112-L157"><strong> 「ML 推論エンドポイントの作成」</strong></a><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L112-L157"> というノートブックのセクション</a> に進みます。セクションの再生ボタンをクリックします。</p><p>これにより、Elasticsearch プロジェクトに新しい ML 推論エンドポイントが作成され、データからテキスト埋め込みを生成するために使用します。テキスト埋め込みは、セマンティック検索を強化するために Elasticsearch に保存されるテキストのベクトル表現です。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt87581300d4d0b66e/6a17f750e9ea875a81a9c795/97c1afab3e64027ee5ae77f377d56ba406ae1765-1600x875.gif" alt="Codespaces Notebook を使用して Elastic ML 推論エンドポイントを作成する。" /><h2>Codespaces Notebook を使用して Elasticsearch インデックスを作成する</h2><p>次の<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L165-L224"><strong> 「Elasticsearch インデックスの作成」</strong></a><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L165-L224"> というノートブックのセクション</a> に進みます。セクションの再生ボタンをクリックします。</p><p>これにより、サンプル データと、ML 推論エンドポイントを介して生成された関連するベクトル データを保存する Elasticsearch インデックスが作成されます。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta2d2d5a10c84a1b7/6a17f7527f6f15775cc09cd6/23a66283ee41239e24fb8455c3cd95641982ca6b-1600x875.gif" alt="Codespaces Notebook を使用して Elasticsearch インデックスを作成します。" /><h2>Codespaces Notebook を使用して Elasticsearch 検索テンプレートを作成する</h2><p>次の<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L232-L384"> </a><a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L232-L384"><strong>「検索テンプレート」 というノートブックのセクション</strong></a> に進みます。セクションの再生ボタンをクリックします。</p><p>これにより、<a href="https://www.elastic.co/jp/docs/solutions/search/search-templates">検索テンプレート</a>が作成されます。これは、ユーザーの検索クエリから解析された単語が入力さたテンプレートとしてサンプル アプリで使用されるものです。これにより、Elasticsearch インデックス内のデータをクエリする際の詳細度を設定および制御できるようになります。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt194d6557d096ac25/6a17f7545772628d901bcda0/4c001a3e4d1cca4cfb5c043fea92c7ccaf9cb64a-1600x875.gif" alt="Codespaces Notebook を使用して Elasticsearch 検索テンプレートを作成します。" /><h2>Codespaces Notebook を使用して Elasticsearch インデックスにデータを取り込む</h2><p>ノートブックの次のセクション<a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L392-L450">「</a> <a href="https://github.com/jwilliams-elastic/msbuild-intelligent-query-demo/blob/main/VectorDBSetup.ipynb?short_path=17c25d8#L392-L450"><strong>Ingest property data」</strong></a>に進みます。セクション実行ボタンをクリックします。</p><p>このコード セクションを実行すると、 <em>properties.jsonl</em>ファイルに含まれるサンプル データが一括ロードされます。数分後、プロセスが正常に完了したことを示す確認が表示されます。Elastic Cloud の<strong>インデックス管理</strong>セクションに移動すると、インデックスに予想されるレコードが含まれていることを確認できます。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltaf1b5ad59c75716d/6a17f7566864a4528fb6894b/e9698c798541ccfc08143a939846597028e3c566-1600x875.gif" alt="Codespaces Notebook を使用して Elasticsearch インデックスにデータを取り込みます。" /><h2>C# アプリを構成するための appsetting.json を作成する</h2><p>Elasticsearch インデックスが作成され、データが取り込まれたので、Elastic および Azure Cloud で動作するようにサンプル アプリを構成する準備が整いました。C# サンプル アプリは、 <em>appsettings.json</em>という名前のファイルを使用して、API キーなどのアクセス情報を保存および読み込みます。ここで、Codespaces のエディターを使用して<em>appsettings.json</em>ファイルを作成します。</p><p>1.<strong> HomeFinderApp</strong> フォルダに<em> appsettings.json を作成します。</em></p><p>2. 次のコードを<em>appsettings.json</em>ファイルに貼り付けます。</p>{
 "ElasticSettings": {
   "Url": "",
   "ApiKey": "",
   "IndexName": "properties",
   "TemplateId": "properties-search-template"
 },
 "AzureOpenAISettings": {
   "Endpoint": "",
   "ApiKey": "",
   "DeploymentName": "gpt-4o"
 },
 "AzureMapsSettings": {
   "Url": "https://atlas.microsoft.com/geocode",
   "ApiKey": ""
 },
 "Logging": {
   "LogLevel": {
 	"Default": "Information",
 	"Microsoft.AspNetCore": "Warning"
   }
 },
 "AllowedHosts": "*"
}
<p>3.<strong> ElasticSettings セクションの</strong><strong> Url</strong> と<strong> ApiKey</strong> の 値を見つけます。<em>.env</em>で設定した値と同じ値に設定します前の手順でファイルを作成します。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt28afc316da403ec9/6a17f758faa913584d93ca28/00dad25bacdea2adcbd1e6eca7658867a49b0d8c-1600x875.gif" alt="C# アプリを構成するための appsetting.json を作成しています。" /><h2>Azure OpenAI サービスを作成する</h2><p>サンプル アプリでは、Azure OpenAI を使用してアプリ ユーザーのクエリを解析し、検索テンプレートを入力して Elasticsearch にリクエストを送信し、ユーザーが検索している内容を柔軟に伝えようとします。</p><ol><li><p>新しいブラウザー タブを開き、Azure ポータルの<a href="https://portal.azure.com/#blade/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/OpenAI">AI Foundry | Azure OpenAI</a>に移動します。+<strong>作成を</strong>クリック</p></li><li><p>作成フォームで、<strong>リソース グループ</strong>を選択します。</p></li><li><p><strong>名前</strong>を入力してください</p></li><li><p><strong>価格帯</strong>を選択する</p></li><li><p><strong>次へを</strong>クリック</p></li><li><p><strong>ネットワーク</strong>タブで<strong>次へを</strong>クリックします</p></li><li><p><strong>「タグ」</strong>タブで<strong>「次へ」</strong>をクリックします。</p></li><li><p><strong>「確認と送信」</strong>タブで、 <strong>「作成」を</strong>クリックします。</p></li><li><p>作成が完了したら、 <strong>「リソースに移動」を</strong>クリックします。</p></li><li><p>左側のナビゲーションメニューから<strong>キーとエンドポイント</strong>を選択します</p></li><li><p><strong>エンドポイント</strong>をコピーし、Codespaces エディターが開いているブラウザー タブで作成した<em>appsettings.json</em>ファイルに貼り付けます。</p></li><li><p>次に、Azure OpenAI<strong>キーとエンドポイント ページ</strong>を含むブラウザー タブに戻ります。<strong>Key 1</strong>のコピー ボタンをクリックし、コピーした値を、Codespaces エディターが開いているブラウザー タブの<em>appsettings.json</em>ファイルに貼り付けます。</p></li></ol><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltd01a5e82d9003d02/6a17f75a148009be65b48904/6d49197302d110410dca0a53b6ae90237cf2dfd6-1600x875.gif" alt="Azure OpenAI サービスを作成します。" /><h2>Azure Open AI サービスに gpt-4o モデルのデプロイメントを追加する</h2><p>素晴らしい。Azure OpenAI サービスが実行できるようになりました。ただし、サンプル アプリに必要な LLM 機能を提供するには、まだモデルのデプロイが必要です。選択できるモデルは多数あります。作成した <em>appsettings.json</em><em> ファイルですでに指定されているので 、gpt-4o</em> をデプロイしましょう。</p><p></p><ol><li><p><a href="https://ai.azure.com/resource/playground">Azure AI Foundry</a>にアクセスし、 <strong>「デプロイの作成」を</strong>クリックします。</p></li><li><p><em>gpt-4o</em>を検索し、結果から選択します</p></li><li><p><strong>確認</strong>をクリックして選択します</p></li><li><p><strong>「デプロイ」</strong>をクリックしてモデルをデプロイします</p></li></ol><p><em>gpt-4o</em> モデルを正常にデプロイしたら、左側のナビゲーションメニューから[デプロイメント] を選択し、<em><strong> gpt-4o</strong></em> デプロイメントが[成功] の<strong>状態</strong> でリストされていることを確認できます。
</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte82341dd8a4982b0/6a17f75c4b055d9e0943239e/1b817ab67c05634e9c72777593b4d1a2c6c28191-1600x875.gif" alt="Azure Open AI サービスに gpt-4o モデルのデプロイメントを追加します。" /><h2>Azure Maps アカウントを作成する</h2><p>私たちは、サンプル アプリのユーザーが特定のエリアの不動産物件を検索できるようにしたいと考えていますが、あまり具体的に検索する必要はありません。地元のファーマーズ マーケットの近くの物件を検索したい場合、Azure Maps は OpenAI LLM がマーケットの緯度と経度の座標を取得するために使用できるサービスです。その後、座標は、特定の場所と地理的距離を考慮したユーザークエリのために Elasticsearch に送信される検索テンプレートベースのリクエストに含めることができます。</p><ol><li><p><a href="https://portal.azure.com/#browse/Microsoft.Maps%2Faccounts">Azure Mapsアカウント で 作成を クリックします</a></p></li><li><p><strong>リソースグループ</strong>を選択</p></li><li><p><strong>名前</strong>を入力してください</p></li><li><p>ライセンスとプライバシーに関する声明に同意する</p></li><li><p><strong>「確認して作成」</strong>をクリック</p></li><li><p><strong>作成を</strong>クリック</p></li><li><p>アカウントの作成が完了したら、 <strong>「リソースに移動」を</strong>クリックします。</p></li><li><p>左側のナビゲーションメニューで<strong>「認証」を</strong>クリックします。</p></li><li><p><strong>主キーの</strong> 値をコピーし、Codespaces エディターを含むブラウザー タブに戻って、<em> appsettings.json</em> ファイルの<strong> AzureMapsSettings</strong> セクションの<strong> ApiKey</strong> の値として貼り付けます。</p></li></ol><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt42a4ab4bb7a96d24/6a17f75edbb4ff4f91fb5892/90fadd48e366682e2bad91e32988f93c6354e126-1600x875.gif" alt="Azure Maps アカウントを作成します。" /><h2>サンプルアプリを試してみる</h2><p>さて、ここからが楽しい部分です。サンプルアプリを実行してみましょう。アプリを動かすために必要な Elastic Cloud および Azure Cloud リソースとともに、すべての構成の詳細が設定されました。</p><p>1. Codespaces エディターでターミナル ウィンドウを開きます。</p><p>2. 次のコマンドを使用して、アクティブ ディレクトリをサンプル アプリ フォルダーに変更します。
</p>cd HomeFinderApp<p>3. 次の<em>dotnet</em>コマンドを使用してアプリを実行します。</p>dotnet run<p>4. <strong>「ブラウザで開く</strong>」ボタンが表示されたらクリックします。</p><p>5. デフォルトの検索をテストしてから、独自のカスタム検索をいくつか試します。検索結果を生成するためにバックエンドで実行される内容の詳細を確認するには、「ツールの呼び出し」の横にある<strong>「表示」</strong>リンクをクリックします<strong>。</strong></p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt41adf6631ba91be1/6a17f760505ac30986ad8cf1/821fe7b9446de5ed646d938cc9484a7ddad21030-1600x875.gif" alt="サンプルアプリを試しています。" /><p><strong>ボーナス:</strong> GPT-4o を実際にテストしたい場合は、次の検索を試してください:<em>フロリダ州ディズニー ワールドの近くで、ベッドルーム 30 室以上、バスルーム 20 室以上、プールとガレージがあり、ビーチに近い物件を 20 万ドル未満で探しています。</em>このクエリは、複数の検索ツールの呼び出し後に結果を返します。</p><h2>Elasticは検索AIのソリューションです</h2><p>実行中のアプリは、検索テンプレートを介して Elasticsearch を基礎データ ソースとして使用する Gen AI LLM ガイド付き検索の例です。自由にサンプル アプリを試してカスタマイズし、正確かつ柔軟な検索エクスペリエンスを作成して、ユーザーが探しているものを見つけられるようにしてください。</p><p>読んでいただきありがとうございます。<a href="https://cloud.elastic.co/registration">Elastic Cloud</a>をお試しください。</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/azure-llm-functions-elasticsearch</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/azure-llm-functions-elasticsearch</guid>
    <category><![CDATA[AI]]></category>
    <dc:creator><![CDATA[Jonathan Simon,James Williams]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt93dd59caccfd7fc8/6a17f7614202292a7129f799/1431b90c7e00de06574c1e33c44a2e89296c824e-1200x628.png" length="0" type="image/png"/>
    <pubDate>Fri, 13 Jun 2025 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>