すべてのプロダクト
Search
ドキュメントセンター

OpenSearch:ディープサーチのベストプラクティス

最終更新日:Jul 25, 2025

ディープサーチ機能は、マルチエージェントアーキテクチャに基づく専門知識 Q&Aシステムを提供します。 正確で焦点を絞った包括的な詳細な回答を提供するように設計されています。 データの効率的な取得、ユーザーの意図の理解、複数のソースからの情報の統合、包括的な構造化回答の生成を行います。 従来の検索エンジンと比較して、この機能は複雑な質問の分解、マルチソースデータの統合、クロスドメイン知識の関連付けに優れています。

比較

次の表は、ディープサーチと従来の AI 検索を比較したものです。

ディメンション

ディープサーチ

従来の AI 検索

理解力

コンテキスト推論と意図認識。

セマンティック検索とキーワード検索。

応答モード

コンテキストの詳細(時間範囲、地域制限など)を積極的に求めます。

元の質問をそのまま受け入れます。

データソース

クロスプラットフォーム集約(非公開ドメイン、インターネット、データベースなど)をサポートします。

単一のデータソースに依存します。

知識密度

質問に正確に回答されるまで、1回の応答で複数の注釈付きリファレンスを出力します。

3~5個の関連データセグメントのみを提供します。

インタラクションの深さ

継続的な複数ラウンドの専門的な会話をサポートします。

推論のラウンド数に依存します。

該当する質問

複雑な自由回答形式の質問(分析、比較など)。

単純な事実に関する質問。

アーキテクチャ

ディープサーチはマルチエージェントアーキテクチャに基づいています。 次のような単一エージェントで構成されています。

  • クエリ理解エージェント:元のクエリを理解して書き直します。

  • 自律計画エージェント:クエリの意図を特定し、実行パスを計画および調整し、回答を修正します。

  • 検索エージェント:現在のラウンドで知識の取得と要約を実行します。

  • カジュアル会話エージェント:「こんにちは」などのカジュアルな会話に応答します。

  • 明確化エージェント:あいまいな質問を明確にするためのフォローアップ質問を生成します。

  • 要約エージェント: 質問に対する最終的な回答を提供します。

サンプル

コンソール

1. OpenSearch コンソールにログインし、OpenSearch LLMベースの対話型検索エディションを選択します。 左側のナビゲーションウィンドウで [インスタンス管理] をクリックし、次に [管理] をクリックします。

image

2. インスタンスの詳細ページで、[Q&Aテスト] をクリックし、[ディープサーチ] を有効にします。 次に、ダイアログボックスに質問を入力し、[送信] をクリックします。

2

3. Q&A 応答を表示します。

3

API からの呼び出し

パラメーター

パラメーター

タイプ

必須

デフォルト値

説明

options.chat.enable_deep_search

ブール値

いいえ

true

ディープサーチ 機能を有効にするかどうかを指定します。

  • true: ディープサーチ機能を有効にします。 これにより、複数ラウンドの推論が有効になります。 1回の会話で比較的多くの時間と計算リソースが消費されます。

  • false:ディープサーチ機能を無効にします。

options.chat.agent.think_process

ブール値

いいえ

true

思考プロセスを表示するかどうかを指定します。

options.chat.agent.max_think_round

整数

いいえ

10

思考ラウンドの数(最大 20)。

options.chat.agent.language

文字列

いいえ

AUTO

思考プロセスと言語の言語。

AUTO: クエリによって中国語または英語を選択します。

CN: 中国語。

EN: 英語。

説明

完全な Q&A パラメーターについては、「Q&A パラメーター」をご参照ください。

リクエストボディの例

{
    "question" : {
        "text" : "Recommend 3 Jay Chou albums", // 周杰倫のアルバムを3枚推薦してください
        "type" : "TEXT"
    },
    "options": {
      "retrieve": {
      "web_search": {
        "enable": true
        }
      },
      "chat": {
        "enable_deep_search": true,
        "model": "qwen3-235b-a22b"
      },
      "agent": {
        "think_process": true,
        "max_think_round": 10,
        "language": "AUTO"
      }
    }
  }

レスポンスパラメーター

パラメーター

タイプ

説明

request_id

文字列

リクエスト ID。

status

文字列

リクエストの処理ステータス。

  • OK: リクエストが成功したことを示します。

  • FAIL: リクエストが失敗したことを示します。

latency

浮動小数点数

サーバーによって消費された、成功したリクエストの時間。 単位: ミリ秒。

id

整数

プライマリキー ID。

title

文字列

ドキュメントのタイトル。

category

文字列

カテゴリ名。

url

文字列

ドキュメントリンク。

answer

文字列

Q&A 結果。

type

文字列

返された結果のタイプ。

scores

配列

ドキュメントコンテンツスコア。

event

文字列

思考イベント。

THINK+ACTION+ANSWER は 1 ラウンドです(THINK は必ずしも表示されるとは限りません)。 THINK は思考を示し、ACTION は実行されたアクションを示し、ANSWER はこのラウンドの思考の結論を示します。 SUMMARY は最終結果であり、テキストタイプの場合は 1つだけです。

event_status

文字列

結果が完全かどうかを示します。

PROCESSING: 回答中です。

FINISHED: 回答が完了しました。

code

文字列

エラーコード(エラーがない場合は返されません)。

message

文字列

エラーメッセージ(エラーがない場合は返されません)。

レスポンスボディの例

{
    "request_id": "f1b9*****************2853a",
    "status": "OK",
    "latency": 33967.562031,
    "result": {
        "data": [
            {
                "answer": "The user is asking for recommendations for 3 Jay Chou albums. I need to first understand what albums Jay Chou has, and then select 3 representative ones to recommend.", // ユーザーは周杰倫のアルバムを3枚推薦するように求めています。まず、周杰倫がどのようなアルバムを持っているかを理解し、次に代表的な3枚を選んで推薦する必要があります。
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "THINK",
                "event_status": "FINISHED"
            },
            {
                "answer": "List of all Jay Chou albums", // 周杰倫の全アルバムリスト
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "ACTION",
                "event_status": "FINISHED"
            },
            {
                "answer": "Jay Chou's album list (sorted by release year):  \n\n1. **《JAY》** (2000)  \n2. **《Fantasy》** (2001)  \n3. **《The Eight Dimensions》** (2002)  \n4. **《Ye Hui Mei》** (2003)  \n5. **《Common Jasmine Orange》** (2004)  \n6. **《November's Chopin》** (2005)  \n7. **《Still Fantasy》** (2006)  \n8. **《On the Run》** (2007)  \n9. **《Capricorn》** (2008)  \n10. **《The Era》** (2010)  \n11. **《Exclamation Mark》** (2011)  \n12. **《Opus 12》** (2012)  \n13. **《Aiyo, Not Bad》** (2014)  \n14. **《Jay Chou's Bedtime Stories》** (2016)  \n15. **《Greatest Works of Art》** (2022)  \n\nNote: Some search results mentioned songs that are actually tracks within albums. I have organized them into a complete album list.", // 周杰倫のアルバムリスト(発売年順):\n\n1. **《JAY》** (2000) \n2. **《ファンタジー》** (2001) \n3. **《八度空間》** (2002) \n4. **《葉惠美》** (2003) \n5. **《七里香》** (2004) \n6. **《11月のショパン》** (2005) \n7. **《依然范特西》** (2006) \n8. **《我很忙》** (2007) \n9. **《魔杰座》** (2008) \n10. **《跨時代》** (2010) \n11. **《驚嘆號》** (2011) \n12. **《12新作》** (2012) \n13. **《哎呦,不錯哦》** (2014) \n14. **《周杰倫的床邊故事》** (2016) \n15. **《最偉大的作品》** (2022) \n\n注:一部の検索結果では、実際にはアルバム内のトラックである曲が言及されていました。これらを完全なアルバムリストにまとめました。
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "ANSWER",
                "event_status": "FINISHED"
            },
            {
                "answer": "\nFirst, the user's question is: \"Recommend 3 Jay Chou albums\". I need to answer based on known information. The known information includes multiple documents describing Jay Chou's albums.\n\nReviewing the known information:\n- [Document 01] lists Jay Chou's albums and songs, but seems to only mention the \"JAY\" album and lists some songs. The document begins by saying \"Jay Chou's musical works include six official personal albums and four EP albums\", but doesn't completely list the specific album names. It lists songs, but only \"JAY\" is explicitly mentioned as an album name.\n- [Document 02] mentions albums such as \"The Eight Dimensions\", \"Jay Chou's Bedtime Stories\", \"Fantasy\", \"Jay\" and provides years.\n- [Document 03] is similar to [Document 02], mentioning albums like \"Greatest Works of Art\", \"Jay Chou's Bedtime Stories\", \"Aiyo, Not Bad\", \"Opus 12\", \"Exclamation Mark\".\n- [Document 04] mentions \"JAY\" and \"Fantasy\" and describes them.\n- [Document 05] is similar to [Document 02] and [Document 03], mentioning the same albums.\n\nFrom these documents, I can extract Jay Chou's album list:\n- [Document 02] and [Document 03] clearly list album names and years:\n  - \"Greatest Works of Art\" 2022\n  - \"Jay Chou's Bedtime Stories\" 2016\n  - \"Aiyo, Not Bad\" 2014\n  - \"Opus 12\" 2012\n  - \"Exclamation Mark\" 2011\n- Additionally, [Document 01] mentions \"JAY\" 2000, [Document 04] also mentions \"JAY\" and \"Fantasy\".\n- [Document 02] also mentions \"The Eight Dimensions\" 2002, \"Fantasy\" 2001, \"Jay\" 2000 (possibly referring to \"JAY\").\n\nCombining all documents, Jay Chou's albums include the following:\n- \"JAY\" 2000 [Document 01][Document 04]\n- \"Fantasy\" 2001 [Document 02][Document 04]\n- \"The Eight Dimensions\" 2002 [Document 02]\n- \"Exclamation Mark\" 2011 [Document 02][Document 03]\n- \"Opus 12\" 2012 [Document 02][Document 03]\n- \"Aiyo, Not Bad\" 2014 [Document 02][Document 03]\n- \"Jay Chou's Bedtime Stories\" 2016 [Document 02][Document 03]\n- \"Greatest Works of Art\" 2022 [Document 02][Document 03]\n\nThe user asks for 3 album recommendations. I need to base my recommendations on known information and ensure each point has source support.\n\nRecommendation criteria: I should select some classic or representative albums. From the documents:\n- [Document 02] and [Document 03] highly praise \"Fantasy\", calling it \"the peak of Jay Chou's music career and a benchmark of the era that many musicians have tried to imitate but found difficult to surpass.\" [Document 02][Document 03]\n- [Document 01] mentions \"JAY\" as the first album.\n- [Document 02] mentions that \"The Eight Dimensions\" continued the style of the first two albums and won multiple awards. [Document 02]\n- Other albums like \"Jay Chou's Bedtime Stories\" and \"Greatest Works of Art\" are also mentioned.\n\nSo, I can recommend:\n1. \"Fantasy\" - because it's described as a peak and benchmark.\n2. \"JAY\" - as the first album, it has historical significance.\n3. \"The Eight Dimensions\" - because it continued the success and won awards.\n\nOr, I could choose more recent ones, but the documents emphasize the importance of early albums.\n\nEnsuring source citations: Each fact must be cited in [Document xx] format.\n\nAnswer requirements:\n- Use Chinese.\n- If known information can answer the question, must use known information and cite sources.\n- Use rich markdown formatting: such as lists, tables, etc.\n- Natural tone, not stiff.\n- Accuracy, don't fabricate information.\n\nStructure the answer:\n- Begin by directly recommending 3 albums.\n- Provide reasons for each album, based on documents.\n- Organize using lists or tables.\n- Cite sources.\n\nFinal recommendations:\n1. \"Fantasy\" (2001) - Reason: Described as the peak of Jay Chou's music career and a benchmark of the era. [Document 02][Document 03]\n2. \"JAY\" (2000) - Reason: First album, established his music style. [Document 01][Document 04]\n3. \"The Eight Dimensions\" (2002) - Reason: Continued the style of previous works, won multiple awards, brought hope to the record industry. [Document 02]\n\nOr, consider \"Jay Chou's Bedtime Stories\" or \"Greatest Works of Art\", but the documents have less description of them, while early albums have more evaluations.\n\nIn [Document 02][Document 03], there is a detailed description of \"Fantasy\", other albums are just listed.\n\nSo, choosing these three is reasonable.\n\nUse markdown: Can use ordered lists or tables.\n\nFor example:\n- Use ### for titles\n- List descriptions\n- Bold album names\n\nEnsure no additional information is added: only based on documents.\n", // まず、ユーザーの質問は「周杰倫のアルバムを3枚推薦してください」です。既知の情報に基づいて回答する必要があります。既知の情報には、周杰倫のアルバムについて説明する複数のドキュメントが含まれています。\n\n既知の情報をレビューする:\n- [ドキュメント 01] には周杰倫のアルバムと曲がリストされていますが、「JAY」アルバムのみが言及され、いくつかの曲がリストされているようです。ドキュメントの冒頭には「周杰倫の音楽作品には、公式の個人アルバム6枚とEPアルバム4枚が含まれています」と記載されていますが、具体的なアルバム名は完全にはリストされていません。曲はリストされていますが、アルバム名として明示的に言及されているのは「JAY」のみです。\n- [ドキュメント 02] には、「八度空間」、「周杰倫の床邊故事」、「ファンタジー」、「JAY」などのアルバムが言及されており、年が記載されています。\n- [ドキュメント 03] は [ドキュメント 02] と似ておりおり、「最偉大的作品」、「周杰倫の床邊故事」、「哎呦,不錯哦」、「12新作」、「驚嘆號」などのアルバムが言及されています。\n- [ドキュメント 04] には「JAY」と「ファンタジー」が言及されており、それらについて説明されています。\n- [ドキュメント 05] は [ドキュメント 02] と [ドキュメント 03] と似ており、同じアルバムが言及されています。\n\nこれらのドキュメントから、周杰倫のアルバムリストを抽出できます。\n- [ドキュメント 02] と [ドキュメント 03] には、アルバム名と年が明確にリストされています。\n - 「最偉大的作品」2022\n - 「周杰倫の床邊故事」2016\n - 「哎呦,不錯哦」2014\n - 「12新作」2012\n - 「驚嘆號」2011\n- また、[ドキュメント 01] には「JAY」2000 が言及されており、[ドキュメント 04] にも「JAY」と「ファンタジー」が言及されています。\n- [ドキュメント 02] にも「八度空間」2002、「ファンタジー」2001、「Jay」2000(おそらく「JAY」を指す)が言及されています。\n\nすべてのドキュメントを組み合わせると、周杰倫のアルバムには次のものが含まれます。\n- 「JAY」2000 [ドキュメント 01][ドキュメント 04]\n- 「ファンタジー」2001 [ドキュメント 02][ドキュメント 04]\n- 「八度空間」2002 [ドキュメント 02]\n- 「驚嘆號」2011 [ドキュメント 02][ドキュメント 03]\n- 「12新作」2012 [ドキュメント 02][ドキュメント 03]\n- 「哎呦,不錯哦」2014 [ドキュメント 02][ドキュメント 03]\n- 「周杰倫の床邊故事」2016 [ドキュメント 02][ドキュメント 03]\n- 「最偉大的作品」2022 [ドキュメント 02][ドキュメント 03]\n\nユーザーは3枚のアルバムの推薦を求めています。既知の情報に基づいて推薦を行い、各ポイントにソースのサポートがあることを確認する必要があります。\n\n推薦基準:いくつかの古典的な、または代表的なアルバムを選択する必要があります。ドキュメントから:\n- [ドキュメント 02] と [ドキュメント 03] は「ファンタジー」を高く評価し、「周杰倫の音楽キャリアのピークであり、多くのミュージシャンが模倣しようとしたが、超えるのが難しい時代のベンチマーク」と呼んでいます。[ドキュメント 02][ドキュメント 03]\n- [ドキュメント 01] には「JAY」が最初のアルバムとして言及されています。\n- [ドキュメント 02] には、「八度空間」が最初の2枚のアルバムのスタイルを継続し、複数の賞を受賞したことが言及されています。[ドキュメント 02]\n- 「周杰倫の床邊故事」や「最偉大的作品」などの他のアルバムも言及されています。\n\nしたがって、次のように推薦できます。\n1. 「ファンタジー」- ピークでベンチマークとして説明されているため。\n2. 「JAY」- 最初のアルバムとして、歴史的な意義があるため。\n3. 「八度空間」- 成功を継続し、賞を受賞したため。\n\nまたは、もっと最近のものを選ぶこともできますが、ドキュメントでは初期のアルバムの重要性が強調されています。\n\nソースの引用を確実にする:各事実は [ドキュメント xx] 形式で引用する必要があります。\n\n回答の要件:\n- 中国語を使用する。\n- 既知の情報で質問に答えられる場合は、既知の情報を使用し、ソースを引用する必要があります。\n- リッチマークダウンフォーマットを使用する:リスト、表など。\n- 自然なトーンで、堅苦しくない。\n- 正確で、情報を捏造しない。\n\n回答の構成:\n- 最初に3枚のアルバムを直接推薦する。\n- ドキュメントに基づいて、各アルバムの理由を説明する。\n- リストまたは表を使用して整理する。\n- ソースを引用する。\n\n最終的な推薦:\n1. 「ファンタジー」(2001) - 理由:周杰倫の音楽キャリアのピークであり、時代のベンチマークとして説明されています。[ドキュメント 02][ドキュメント 03]\n2. 「JAY」(2000) - 理由:最初のアルバムであり、彼の音楽スタイルを確立しました。[ドキュメント 01][ドキュメント 04]\n3. 「八度空間」(2002) - 理由:以前の作品のスタイルを継続し、複数の賞を受賞し、レコード業界に希望をもたらしました。[ドキュメント 02]\n\nまたは、「周杰倫の床邊故事」または「最偉大的作品」を検討することもできますが、ドキュメントではそれらについての説明が少なく、初期のアルバムの方が評価が多いです。\n\n[ドキュメント 02][ドキュメント 03] には「ファンタジー」の詳細な説明があり、他のアルバムは単にリストされています。\n\nしたがって、これら3つを選択することは合理的です。\n\nマークダウンを使用する:順序付きリストまたは表を使用できます。\n\n例えば:\n- タイトルには ### を使用する\n- 説明をリストする\n- アルバム名を太字にする\n\n追加情報が追加されていないことを確認する:ドキュメントのみに基づいて。\n
                "type": "TEXT_MARKDOWN",
                "reference": [],
                "rich_text_ref": [],
                "event": "THINK",
                "event_status": "FINISHED"
            },
            {
                "answer": "\nBased on Jay Chou's music career, I recommend three classic albums that showcase his unique musical style (combining pop, R&B, rock and other elements). These albums are widely acclaimed for their artistic achievements and influence. My recommendations are based on reliable document information, with each recommendation reason strictly based on relevant document content and source notation (such as [Document xx]).\n\n### Three recommended Jay Chou albums\n\n1. **《Fantasy》 (2001)**  \n   - **Recommendation reason**: This album is recognized as the peak of Jay Chou's music career, establishing his creative paradigm and becoming a benchmark of the era that many musicians have tried to imitate but found difficult to surpass. Each song in the album is like a camera lens, creating images through sound, taking listeners through ancient and modern times, such as \"Love Before BC\" combining R&B and hip-hop to create a sense of time-space vortex; \"Ninja\" using a single chord and Japanese imagery to enhance presence; \"William Castle\" using organ playing to create an eerie medieval atmosphere. Overall, it established Jay Chou's mature methodology and is loved by fans globally[^2^][^3^].  \n   - **Representative songs**: \"Love Before BC\", \"Ninja\", \"William Castle\" (Source: [^2^][^3^]).\n\n2. **《JAY》 (2000)**  \n   - **Recommendation reason**: As Jay Chou's first personal album, it marks the beginning of his music career and includes many classic songs such as \"Cute Woman\", \"Perfectionism\", and \"Starry Mood\". This album showcases Jay Chou's unique musical talent, combining multiple elements, setting the tone for subsequent works, and quickly winning widespread recognition from fans[^1^][^4^].  \n   - **Representative songs**: \"Cute Woman\", \"Perfectionism\", \"Starry Mood\" (Source: [^1^][^4^]).\n\n3. **《The Eight Dimensions》 (2002)**  \n   - **Recommendation reason**: This album continues the arrangement style of the first two albums, with a more mature personal style, helping Jay Chou win multiple awards and creating new records in Chinese music. At the same time, its high sales brought hope to the record industry that was troubled by piracy at that time. The Hokkien song \"Where Is The Train Going\" in the album reflects Jay Chou's hometown sentiment, which is rare in his later works, highlighting his artistic depth[^2^].  \n   - **Representative songs**: \"Where Is The Train Going\", \"Secret Code\" (Source: [^2^]).\n\nThese three albums represent the breakthrough, innovation, and maturity stages of Jay Chou's early career and are excellent starting points for understanding his musical essence. Each album carries unique creative stories worth savoring!", // 周杰倫の音楽キャリアに基づいて、彼のユニークな音楽スタイル(ポップ、R&B、ロックなどの要素を組み合わせたもの)を示す3枚のクラシックアルバムを推薦します。これらのアルバムは、芸術的成果と影響力で広く高く評価されています。私の推薦は信頼できるドキュメント情報に基づいており、各推薦理由は関連ドキュメントの内容とソース表記([ドキュメント xx] など)に厳密に基づいています。\n\n### 周杰倫の推薦アルバム3枚\n\n1. **《ファンタジー》 (2001)**\n - **推薦理由**: このアルバムは周杰倫の音楽キャリアのピークとして認識されており、彼の創造的なパラダイムを確立し、多くのミュージシャンが模倣しようとしたが、超えるのが難しい時代のベンチマークとなっています。アルバムの各曲はカメラレンズのように、音を通してイメージを作り出し、リスナーを古代と現代へと連れて行きます。例えば、「愛在西元前」はR&Bとヒップホップを組み合わせて時空間の渦を作り出し、「忍者」は単一のコードと日本のイメージを使用して存在感を高め、「威廉古堡」はオルガン演奏を使用して不気味な中世の雰囲気を作り出しています。全体的に、周杰倫の成熟した方法論を確立し、世界中のファンに愛されています[^2^][^3^]。\n - **代表曲**: 「愛在西元前」、「忍者」、「威廉古堡」(出典:[ ^2^][^3^])。\n\n2. **《JAY》 (2000)**\n - **推薦理由**: 周杰倫の最初の個人アルバムとして、彼の音楽キャリアの始まりを示し、「可愛女人」、「完美主義」、「星晴」など多くのクラシック曲が含まれています。このアルバムは周杰倫のユニークな音楽的才能を示し、複数の要素を組み合わせ、後続の作品のトーンを設定し、すぐにファンから幅広い認知を得ました[^1^][^4^]。\n - **代表曲**: 「可愛女人」、「完美主義」、「星晴」(出典:[^1^][^4^])。\n\n3. **《八度空間》 (2002)**\n - **推薦理由**: このアルバムは最初の2枚のアルバムのアレンジスタイルを継続し、より成熟したパーソナルスタイルで、周杰倫が複数の賞を受賞し、中国音楽で新しい記録を樹立するのに役立ちました。同時に、その高い売上高は、当時海賊版に悩まされていたレコード業界に希望をもたらしました。アルバムの福建語の曲「最後的戰役」は、周杰倫の故郷への想いを反映しており、彼の後の作品では珍しく、彼の芸術的深みを際立たせています[^2^]。\n - **代表曲**: 「最後的戰役」、「暗號」(出典:[^2^])。\n\nこれら3枚のアルバムは、周杰倫の初期のキャリアにおけるブレークスルー、革新、成熟の段階を表しており、彼の音楽の本質を理解するための優れた出発点です。各アルバムには、味わう価値のあるユニークな創造的な物語が込められています!
                "type": "TEXT_MARKDOWN",
                "reference": [
                    {
                        "title": "Who knows all the names of Jay Chou's albums", // 周杰倫のアルバムの名前をすべて知っている人はいますか?
                        "category": "webSearch",
                        "url": "https://zhidao.baidu.com/question/317142607014917724.html"
                    },
                    {
                        "title": "Jay Chou", // 周杰倫
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/300117743"
                    },
                    {
                        "title": "\u200eJay Chou-Apple Music", //  周杰倫-Apple Music
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/a/300117743"
                    },
                    {
                        "title": "Complete list of Jay Chou's album names", // 周杰倫のアルバム名の完全なリスト
                        "category": "webSearch",
                        "url": "https://m.xueba5.com/xw/25426.html"
                    },
                    {
                        "title": "Jay Chou", // 周杰倫
                        "category": "webSearch",
                        "url": "https://music.apple.com/cn/artist/%E5%91%A8%E6%9D%B0%E4%BC%A6/300117743"
                    }
                ],
                "rich_text_ref": [],
                "event": "SUMMARY",
                "event_status": "FINISHED"
            }
        ]
    }
}

SDK からの呼び出し

環境変数の設定

環境変数 ALIBABA_CLOUD_ACCESS_KEY_IDALIBABA_CLOUD_ACCESS_KEY_SECRET を設定します。

重要
  • Alibaba Cloud アカウントの AccessKey には、すべての API オペレーションを呼び出す権限があります。 RAM ユーザーを使用して API オペレーションを呼び出したり、日常の O&M を実行することをお勧めします。 詳細については、「RAM ユーザーの作成」をご参照ください。

  • AccessKey ID と AccessKey シークレットの作成方法については、「AccessKey の作成」をご参照ください。

  • RAM ユーザーの AccessKey を使用する場合は、RAM ユーザーに AliyunOpenSearchFullAccess 権限が付与されていることを確認してください。

  • AccessKey ペアをプロジェクトコードに保存しないでください。 そうしないと、AccessKey が漏洩する可能性があります。 アカウントのすべてのリソースのセキュリティが脅かされます。

  • LinuxmacOS の設定方法:

    <access_key_id> を RAM ユーザーの AccessKey ID に、<access_key_secret> を RAM ユーザーの AccessKey シークレットに置き換えます。

    export ALIBABA_CLOUD_ACCESS_KEY_ID=<access_key_id> 
    export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<access_key_secret>
  • Windows の設定方法:

    1. 環境変数ファイルを作成し、環境変数 ALIBABA_CLOUD_ACCESS_KEY_IDALIBABA_CLOUD_ACCESS_KEY_SECRET を追加し、準備した AccessKey ID と AccessKey シークレットを書き込みます。

    2. Windows を再起動します。

依存関係を追加する

<dependency>
        <groupId>com.aliyun.opensearch</groupId>
        <artifactId>aliyun-sdk-opensearch</artifactId>
        <version>6.0.0</version>
</dependency>

コード

次のサンプルコードを参照して、呼び出しを完了します。

package com.aliyun.opensearch;

import com.aliyun.opensearch.OpenSearchClient;
import com.aliyun.opensearch.sdk.generated.OpenSearch;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchClientException;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchException;
import com.aliyun.opensearch.sdk.generated.commons.OpenSearchResult;

import java.util.HashMap;
import java.util.Map;

public class LLMSearch {
    private static String accesskey = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_ID");
    private static String secret = System.getenv("ALIBABA_CLOUD_ACCESS_KEY_SECRET");
    
    private static String appName = "アプリケーション名。"; // The application name.
    private static String host = "アプリケーションの API エンドポイント。"; // The API endpoint of the application.
    private static String path = "/apps/%s/actions/multi-search";

    public static void main(String[] args) {

        String appPath = String.format(path, appName);
        //ApiReadTimeOut
        OpenSearch openSearch = new OpenSearch(accesskey, secret, host);
        openSearch.setTimeout(90000);

        OpenSearchClient openSearchClient = new OpenSearchClient(openSearch);

        Map<String, String> params = new HashMap<String, String>() {{
            put("format", "full_json");
            put("_POST_BODY", "{\"question\":{\"text\":\"Recommend 3 Jay Chou albums\",\"type\":\"TEXT\",\"session\":\"\"},\"options\":{\"chat\":{\"stream\":true,\"enable_deep_search\":true,\"model\":\"opensearch-qwen\"}}}"); //{\"question\":{\"text\":\"周杰倫のアルバムを3枚推薦してください\",\"type\":\"TEXT\",\"session\":\"\"},\"options\":{\"chat\":{\"stream\":true,\"enable_deep_search\":true,\"model\":\"opensearch-qwen\"}}}

        }};
        try {
            OpenSearchResult openSearchResult = openSearchClient
                    .callAndDecodeResult(appPath, params, "POST");
            System.out.println("RequestID=" + openSearchResult.getTraceInfo().getRequestId());
            System.out.println(openSearchResult.getResult());
        } catch (
                OpenSearchException e) {
            System.out.println("RequestID=" + e.getRequestId());
            System.out.println("ErrorCode=" + e.getCode());
            System.out.println("ErrorMessage=" + e.getMessage());
        } catch (
                OpenSearchClientException e) {
            System.out.println("ErrorMessage=" + e.getMessage());
        }
    }
}