在 Elasticsearch 中使用 Amazon Nova 模型

作者:來自 Elastic?Andre Luiz

了解如何在 Elasticsearch 中使用 Amazon Nova 系列模型。

在本文中,我們將討論 Amazon 的 AI 模型家族——Amazon Nova,并學習如何將其與 Elasticsearch 結合使用。

關于 Amazon Nova

Amazon Nova 是 Amazon 的一系列人工智能模型,可在 Amazon Bedrock 上使用,旨在提供高性能和成本效益。這些模型支持文本、圖像和視頻輸入,生成文本輸出,并針對不同的準確性、速度和成本需求進行了優化。

Amazon Nova 主要模型

  • Amazon Nova Micro:專注于文本處理的快速、經濟高效模型,適用于翻譯、推理、代碼補全和數學問題求解。其生成速度超過 200 個 token 每秒,非常適合需要即時響應的應用。

  • Amazon Nova Lite:一種低成本的多模態模型,可快速處理圖像、視頻和文本。其速度和準確性表現突出,適用于交互式和高數據量的應用,尤其是成本敏感的場景。

  • Amazon Nova Pro:最高級的選擇,結合了高準確性、速度和成本效益。適用于視頻摘要、問答、軟件開發和 AI 代理等復雜任務。專家評測表明,它在文本和視覺理解方面表現卓越,并且能夠遵循指令執行自動化工作流。

Amazon Nova 模型適用于多種應用場景,包括內容創作、數據分析、軟件開發以及基于 AI 的流程自動化。

我們將展示如何將 Amazon Nova 模型與 Elasticsearch 結合使用,以實現自動化的產品評論分析。

我們將進行以下步驟:
  1. 通過 Inference API 創建一個端點,將 Amazon Bedrock 與 Elasticsearch 集成。

  2. 使用 Inference Processor 創建一個數據處理管道,該管道將調用 Inference API 端點。

  3. 索引產品評論,并使用管道自動生成評論分析。

  4. 分析集成后的結果。

在 Inference API 中創建端點

首先,我們配置 Inference API 以將 Amazon Bedrock 與 Elasticsearch 集成。我們選擇 Amazon Nova Lite 作為使用的模型,其 ID 為 amazon.nova-lite-v1:0,因為它在速度、準確性和成本之間提供了良好的平衡。

注意:你需要有效的憑據才能使用 Amazon Bedrock。你可以在此處查看文檔以獲取訪問密鑰:

PUT _inference/completion/bedrock_completion_amazon_nova-lite
{"service": "amazonbedrock","service_settings": {"access_key": "#access_key#","secret_key": "#secret_key#","region": "us-east-1","provider": "amazontitan","model": "amazon.nova-lite-v1:0"}
}

創建評論分析 pipeline

現在,我們創建一個處理流水線,該流水線將使用 Inference Processor 來執行評論分析提示(prompt)。該提示會將評論數據發送到 Amazon Nova Lite,并執行以下操作:

  • 情感分類(正面、負面或中立)

  • 評論摘要生成

  • 關鍵詞提取

  • 真實性評估(真實 | 可疑 | 泛化)

PUT /_ingest/pipeline/review_analyzer_ai
{"processors": [{"script": {"source": """ctx.prompt = "Analyze the following product review and return a structured JSON. Task: - Summarize the review concisely. - Detect and classify the sentiment as positive, neutral, or negative.- Generate relevant tags (keywords) based on the review content and detected sentiment. - Evaluate the authenticity of the review (authentic, suspicious, or generic). Review: " + ctx.review + " Respond in JSON format with the following fields: \"review_analyze\": {\"sentiment\": \"<positive | neutral | negative>\", \"authenticity\": \"<authentic | suspicious | generic>\",\"summary\": \"<short review summary>\", \"keywords\": [\"<keyword 1>\", \"<keyword 2>\", \"...\"]}}}""""}},{"inference": {"model_id": "bedrock_completion_amazon_nova-lite","input_output": {"input_field": "prompt","output_field": "result"}}},{"gsub": {"field": "result","pattern": "```json","replacement": ""} },{"json" : {"field" : "result","strict_json_parsing": false,"add_to_root" : true}},{"remove": {"field": "result"}},{"remove": {"field": "prompt"}}]
}

索引評論

現在,我們使用 Bulk API 索引產品評論。之前創建的流水線將自動應用,并將 Nova 模型生成的分析結果添加到索引的文檔中。

POST bulk/
{ "index": { "_index" : "products", "_id": 1, "pipeline":"review_analyzer_ai" } }
{ "product": "Pampers Pants Premium Care Fralda", "review": "Best diaper ever! Great material, lots of cotton, without all that plastic. Doesn't leak! My baby is a boy and every diaper leaked around the waist, this model solved the problem. Even on a small baby it's worth the effort of putting on the short diaper. I put it on my baby at 9 pm and only take it off in the morning, without any leaks." }
{ "index": { "_index" : "products", "_id": 2, "pipeline":"review_analyzer_ai" } }
{ "product": "Portable Electric Body Massager", "review": "It broke in three months for no apparent reason, thank goodness I didn't review it before. I don't recommend buying it because it has a short lifespan." }
{ "index": { "_index" : "products", "_id": 3, "pipeline":"review_analyzer_ai" } }
{ "product": "Havit Fuxi-H3 Black Quad-Mode Wired and Wireless Gaming Headset", "review": "The sound is good for the price, but the connectivity is horrible. You always need to be playing audio, otherwise it loses connection (I work from home, and this is very annoying). Sometimes it loses connection and you have to turn it off and on again to get it back on. The microphone is very sensitive, so it loses connection frequently and you have to turn the headset off and on for the microphone to work again. The flexibility of the stem is useless, because if you move it, the microphone can turn off. Sometimes I need to use Linux and the headset simply doesn't work. It's light and comfortable, the sound is adequate, but the connectivity is terrible." }
{ "index": { "_index" : "products", "_id": 4, "pipeline":"review_analyzer_ai" } }
{ "product": "Air Fryer 4L Oil Free Fryer Mondial", "review": "For those looking for value for money, it's a good option, but the tray (which is underneath the perforated basket) is already peeling a lot. My mother has one just like it and said that hers is even rusting, in other words, the material is MUCH inferior. There's also something that bothers me, because it looks like a microwave, it doesn't fry evenly, it's weaker in the middle and stronger on the sides. Buy at your own risk." }

查詢和分析結果

最后,我們運行查詢以查看 Amazon Nova Lite 模型如何分析和分類評論。通過執行 GET products/_search,我們可以獲取已經被評論內容增強的文檔。

該模型能夠識別主要情感(正面、中立或負面),生成簡要摘要,提取相關關鍵詞,并評估每條評論的 真實性。這些字段有助于理解客戶的意見,而無需閱讀完整文本。

在解釋結果時,我們關注以下方面:

  • 情感:指示消費者對產品的整體感受。

  • 摘要:提煉評論中提及的主要觀點。

  • 關鍵詞:可用于分組相似評論或識別反饋模式。

  • 真實性:判斷評論是否可信,對內容審核或篩選有幫助。

   "hits": [{"_index": "products","_id": "1","_score": 1,"_ignored": ["review.keyword"],"_source": {"product": "Pampers Pants Premium Care Fralda","model_id": "bedrock_completion_amazon_nova-lite","review_analyze": {"summary": "The reviewer praises the diaper for its great material, high cotton content, and leak-proof design, especially highlighting its effectiveness for their baby.","sentiment": "positive","keywords": ["best diaper","great material","cotton","no plastic","leak-proof","baby","effective"],"authenticity": "authentic"},"review": "Best diaper ever! Great material, lots of cotton, without all that plastic. Doesn't leak! My baby is a boy and every diaper leaked around the waist, this model solved the problem. Even on a small baby it's worth the effort of putting on the short diaper. I put it on my baby at 9 pm and only take it off in the morning, without any leaks."}},{"_index": "products","_id": "2","_score": 1,"_source": {"product": "Portable Electric Body Massager","model_id": "bedrock_completion_amazon_nova-lite","review_analyze": {"summary": "The product broke in three months for no apparent reason and the reviewer does not recommend it due to its short lifespan.","sentiment": "negative","keywords": ["broke","short lifespan","not recommend"],"authenticity": "authentic"},"review": "It broke in three months for no apparent reason, thank goodness I didn't review it before. I don't recommend buying it because it has a short lifespan."}},{"_index": "products","_id": "3","_score": 1,"_ignored": ["review.keyword"],"_source": {"product": "Havit Fuxi-H3 Black Quad-Mode Wired and Wireless Gaming Headset","model_id": "bedrock_completion_amazon_nova-lite","review_analyze": {"summary": "The headset has good sound quality for the price but suffers from poor connectivity, especially when using the microphone or moving the headset. It also has compatibility issues with Linux.","sentiment": "negative","keywords": ["sound","connectivity","microphone","compatibility","annoying","turn off and on","Linux","flexible stem","work from home"],"authenticity": "authentic"},"review": "The sound is good for the price, but the connectivity is horrible. You always need to be playing audio, otherwise it loses connection (I work from home, and this is very annoying). Sometimes it loses connection and you have to turn it off and on again to get it back on. The microphone is very sensitive, so it loses connection frequently and you have to turn the headset off and on for the microphone to work again. The flexibility of the stem is useless, because if you move it, the microphone can turn off. Sometimes I need to use Linux and the headset simply doesn't work. It's light and comfortable, the sound is adequate, but the connectivity is terrible."}},{"_index": "products","_id": "4","_score": 1,"_ignored": ["review.keyword"],"_source": {"product": "Air Fryer 4L Oil Free Fryer Mondial","model_id": "bedrock_completion_amazon_nova-lite","review_analyze": {"summary": "The product offers value for money but has issues with peeling, rusting, and uneven frying.","sentiment": "negative","keywords": ["value for money","peeling","rusting","uneven frying","weaker in the middle"],"authenticity": "authentic"},"review": "For those looking for value for money, it's a good option, but the tray (which is underneath the perforated basket) is already peeling a lot. My mother has one just like it and said that hers is even rusting, in other words, the material is MUCH inferior. There's also something that bothers me, because it looks like a microwave, it doesn't fry evenly, it's weaker in the middle and stronger on the sides. Buy at your own risk."}}]

最終想法

Amazon Nova LiteElasticsearch 的集成展示了語言模型如何將原始評論轉化為結構化且有價值的信息。通過流水線處理評論,我們能夠自動且一致地提取 情感、真實性、摘要關鍵詞

結果表明,該模型能夠理解評論的上下文、分類用戶的意見,并突出顯示每個體驗中最相關的點。這使數據集更加豐富,可用于提升搜索能力。

想要獲得 Elastic 認證?查看下一次 Elasticsearch Engineer 培訓時間!

Elasticsearch 擁有眾多新功能,可幫助你構建最佳搜索解決方案。探索我們的示例 notebooks 了解更多信息,開啟 免費云試用,或立即在本地機器嘗試 Elastic

原文:https://www.elastic.co/search-labs/blog/amazon-nova-models-elasticsearch

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/bicheng/75952.shtml
繁體地址,請注明出處:http://hk.pswp.cn/bicheng/75952.shtml
英文地址,請注明出處:http://en.pswp.cn/bicheng/75952.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

MySQL8.0.40編譯安裝(Mysql8.0.40 Compilation and Installation)

MySQL8.0.40編譯安裝 近期MySQL發布了8.0.40版本&#xff0c;與之前的版本相比&#xff0c;部分依賴包發生了變化&#xff0c;因此重新編譯一版&#xff0c;也便于大家參考。 1. 下載源碼 選擇對應的版本、選擇源碼、操作系統 如果沒有登錄或者沒有MySQL官網賬號&#xff0…

python中pyside6多個py文件生成exe

網上見到的教程大多數都是pyinstaller安裝單個py文件,針對多個py文件的打包,鮮有人提及;有也是部分全而多的解釋,讓人目不暇接,本次記錄自己設置一個聲波捕捉界面的打包過程。 1.pycharm中調用pyinstaller打包 參考鏈接:https://blog.csdn.net/weixin_45793544/articl…

Java中使用Function Call實現AI大模型與業務系統的集成?

這個理念實際上很早就出現了&#xff0c;只不過早期的模型推理理解能力比較差&#xff0c;用戶理解深度預測不夠&#xff0c;現在每天的迭代有了改進&#xff0c;逐步引入到我們本身的業務系統&#xff0c;讓AI大模型集成進來管理自身業務功能。當然現在也不是一個什么難事了。…

id 屬性自動創建 js 全局變量

給一個元素設置 id 屬性&#xff0c;它會在 js 中創建全局變量&#xff0c;如 <div class"test" click"test" id"idTest">test</div>test() {console.log(idTest:, window.idTest) }.test {height: 50px;width: 200px;background-c…

Android SELinux權限使用

Android SELinux權限使用 一、SELinux開關 adb在線修改seLinux(也可以改配置文件徹底關閉) $ getenforce; //獲取當前seLinux狀態,Enforcing(表示已打開),Permissive(表示已關閉) $ setenforce 1; //打開seLinux $ setenforce 0; //關閉seLinux二、命令查看sel…

【R語言繪圖】圈圖繪制代碼

繪制代碼 rm(list ls())# 加載必要包 library(data.table) library(circlize) library(ComplexHeatmap) library(rtracklayer) library(GenomicRanges) library(BSgenome) library(GenomicFeatures) library(dplyr)### 數據準備階段 ### # 1. 讀取染色體長度信息 df <- re…

vim 編輯器 使用教程

Vim是一款強大的文本&#xff08;代碼&#xff09;編輯器&#xff0c;它是由Bram Moolenaar于1991年開發完成。它的前身是Bill Joy開發的vi。名字的意義是Vi IMproved。 打開vim&#xff0c;直接在命令行輸入vim即可&#xff0c;或者vim <filename>. Vim分為四種模式&a…

C++20新增內容

C20 是 C 語言的一次重大更新&#xff0c;它引入了許多新特性&#xff0c;使代碼更現代化、簡潔且高效。以下是 C20 的主要新增內容&#xff1a; 1. 概念&#xff08;Concepts&#xff09; 概念用于約束模板參數&#xff0c;使模板編程更加直觀和安全。 #include <concept…

C++中常用的十大排序方法之4——希爾排序

成長路上不孤單&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a; 【&#x1f60a;///計算機愛好者&#x1f60a;///持續分享所學&#x1f60a;///如有需要歡迎收藏轉發///&#x1f60a;】 今日分享關于C中常用的排序方法之4——希爾排序的相…

詳細描述以太坊的gas、gaslimit、gasPrice

目錄 一、Gas 是什么? ? 簡要定義: ?? 舉例理解: 二、Gas Limit 是什么? ? 簡要定義: 分兩種: 舉例說明: 三、Gas Price 是什么? ? 簡要定義: 為什么它重要? 示例: 四、 EIP-1559 后的新機制(倫敦升級) 三個要素: 五、額外技巧(開發實用) 本文…

全國大學生數學建模競賽賽題深度分析報告(2010-2024)

全國大學生數學建模競賽賽題深度分析報告&#xff08;2010-2024&#xff09; 全國大學生數學建模競賽(CUMCM)是中國最具影響力的大學生科技競賽之一&#xff0c;本報告將對2010-2024年間的賽題進行全面統計分析&#xff0c;包括題目類型、領域分布、模型方法等多個維度&#x…

從獎勵到最優決策:動作價值函數與價值學習

從獎勵到最優決策&#xff1a;動作價值函數與價值學習 價值學習一、動作價值函數對 U t U_t Ut?求期望得到動作價值函數動作價值函數的意義最優動作價值函數(Optimal Action-Value Function)如何理解 Q ? Q^* Q?函數 二、價值學習的基本思想Deep Q-Network(DQN)DQN玩游戲的具…

智能手表該存什么音頻和文本?場景化存儲指南

文章目錄 為什么需要“場景化存儲”&#xff1f;智能手表的定位手機替代不了的場景碎片化的場景存儲 音頻篇&#xff1a;智能手表該存什么音樂和音頻&#xff1f;運動場景通勤場景健康場景 文本篇&#xff1a;哪些文字信息值得放進手表&#xff1f;&#xff08;部分情況可使用圖…

液態神經網絡技術指南

一、引言 1.從傳統神經網絡到液態神經網絡 神經網絡作為深度學習的核心工具&#xff0c;在圖像識別、自然語言處理、推薦系統等領域取得了巨大成功。尤其是卷積神經網絡&#xff08;CNN&#xff09;、循環神經網絡&#xff08;RNN&#xff09;、長短期記憶網絡&#xff08;LS…

hive通過元數據庫刪除分區操作步驟

刪除分區失敗&#xff1a; alter table proj_60_finance.dwd_fm_ma_kpi_di_mm drop partition(year2025,month0-3,typeADJ); 1、查詢分區的DB_ID、TBL_ID – 獲取數據庫ID-26110 SELECT DB_ID FROM DBS WHERE NAME ‘proj_60_finance’; – 獲取表ID-307194 SELECT TBL_ID FR…

1990-2019年各地級市GDP數據

1990-2019年各地級市GDP數據 1、時間&#xff1a;1990-2019年 2、來源&#xff1a;城市年鑒 3、指標&#xff1a;行政區劃代碼、年份、省份、城市、經度、緯度、地區生產總值(萬元) 4、范圍&#xff1a;250地級市 5、指標解釋&#xff1a;地區生產總值&#xff08;Gross R…

滄州鐵獅子

又名“鎮海吼”&#xff0c;是中國現存年代最久、形體最大的鑄鐵獅子&#xff0c;具有深厚的歷史文化底蘊和獨特的藝術價值。以下是關于滄州鐵獅子的詳細介紹&#xff1a; 歷史背景 ? 鑄造年代&#xff1a;滄州鐵獅子鑄造于后周廣順三年&#xff08;953年&#xff09;&#…

《Java八股文の文藝復興》第十一篇:量子永生架構——對象池的混沌邊緣(終極試煉·完全體)

Tags: - Java高并發 - 量子架構 - 混沌工程 - 賽博修真 - 三體防御 目錄&#xff1a; 卷首語&#xff1a;蝴蝶振翅引發的量子海嘯 第一章&#xff1a;混沌初開——對象池的量子涅槃&#xff08;深度擴展&#xff09; 第二章&#xff1a;混沌計算——對象復活的降維打擊&…

Java面試34-Kafka的零拷貝原理

在實際應用中&#xff0c;如果我們需要把磁盤中的某個文件內容發送到遠程服務器上&#xff0c;那么它必須要經過幾個拷貝的過程&#xff1a; 從磁盤中讀取目標文件內容拷貝到內核緩沖區CPU控制器再把內核緩沖區的數據復制到用戶空間的緩沖區在應用程序中&#xff0c;調用write…

TF-IDF忽略詞序問題思考

自從開始做自然語言處理的業務&#xff0c;TF-IDF就是使用很頻繁的文本特征技術&#xff0c;他的優點很多&#xff0c;比如&#xff1a;容易理解&#xff0c;不需要訓練&#xff0c;提取效果好&#xff0c;可以給予大規模數據使用&#xff0c;總之用的很順手&#xff0c;但是人…