Verwendung von Amazon Nova-Modellen in Elasticsearch
Erfahren Sie, wie Sie Amazon Nova-Modelle in Elasticsearch verwenden können, um Sentiment, Authentizität, Zusammenfassungen und Schlüsselwörter automatisch aus Produktbewertungen in Elasticsearch zu extrahieren.
In diesem Artikel werden wir Amazons KI-Modellfamilie Amazon Nova besprechen und lernen, wie man sie zusammen mit Elasticsearch verwendet.
Über Amazon Nova
Amazon Nova ist eine Familie von künstlichen Intelligenzmodellen von Amazon, die auf Amazon Bedrock verfügbar sind und auf hohe Leistung und Kosteneffizienz ausgelegt sind. Diese Modelle arbeiten mit Text-, Bild- und Videoeingaben, erzeugen Textausgaben und sind für unterschiedliche Anforderungen an Genauigkeit, Geschwindigkeit und Kosten optimiert.
Amazon Nova Hauptmodelle
Amazon Nova Micro: Dieses Modell konzentriert sich ausschließlich auf Textverarbeitung und ist schnell und kostengünstig. Es eignet sich ideal für Übersetzungen, logisches Schlussfolgern, Codevervollständigung und die Lösung mathematischer Probleme. Mit einer Generierungsrate von über 200 Token pro Sekunde eignet es sich ideal für Anwendungen, die sofortige Reaktionen erfordern.
Amazon Nova Lite: Ein kostengünstiges multimodales Modell, das Bilder, Videos und Text schnell verarbeiten kann. Es zeichnet sich durch seine Schnelligkeit und Genauigkeit aus und ist für interaktive und hochvolumige Anwendungen geeignet, bei denen Kosten ein wichtiger Faktor sind.
Amazon Nova Pro: Die fortschrittlichste Option, die hohe Genauigkeit, Geschwindigkeit und Kosteneffizienz vereint. Ideal für komplexe Aufgaben wie Videozusammenfassung, Frage-Antwort-Systeme, Softwareentwicklung und KI-Agenten. Expertenrezensionen bestätigen seine hervorragende Text- und Bildverarbeitungsfähigkeit sowie seine Fähigkeit, Anweisungen zu befolgen und automatisierte Arbeitsabläufe auszuführen.
Die Amazon Nova-Modelle eignen sich für eine Vielzahl von Anwendungen, von der Content-Erstellung und Datenanalyse bis hin zur Softwareentwicklung und KI-gestützten Prozessautomatisierung.
Im Folgenden zeigen wir Ihnen, wie Sie Amazon Nova-Modelle in Verbindung mit Elasticsearch für die automatisierte Analyse von Produktbewertungen verwenden können.
Was wir tun werden:
Erstellen Sie einen Endpunkt über die Inference API, der Amazon Bedrock mit Elasticsearch integriert.
Erstellen Sie eine Pipeline mithilfe des Inference Processors, die Aufrufe an den Inference API-Endpunkt durchführt.
Indexieren Sie Produktbewertungen und generieren Sie mithilfe der Pipeline automatisch eine Analyse der Bewertungen.
Analysieren Sie die Ergebnisse der Integration.
Erstellung eines Endpoint in der Inference API mit Amazon Nova Lite
Zunächst konfigurieren wir die Inference API, um Amazon Bedrock mit Elasticsearch zu integrieren. Wir definieren Amazon Nova Lite, ID amazon.nova-lite-v1:0, als das zu verwendende Modell, da es ein ausgewogenes Verhältnis zwischen Geschwindigkeit, Genauigkeit und Kosten bietet.
Hinweis: Sie benötigen gültige Zugangsdaten, um Amazon Bedrock nutzen zu können. Die Dokumentation zum Erhalt von Zugriffsschlüsseln finden Sie hier:
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"
}
}Erstellung der Pipeline für die Bewertungsanalyse
Nun erstellen wir eine Verarbeitungspipeline, die den Inferenzprozessor verwendet, um eine Überprüfungsanalyseaufforderung auszuführen. Diese Aufforderung sendet die Bewertungsdaten an Amazon Nova Lite, das Folgendes ausführt:
Sentimentklassifizierung (positiv, negativ oder neutral).
Zusammenfassung der Rezension.
Schlüsselwortgenerierung.
Authentizitätsmessung (authentisch | verdächtig | generisch).
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"
}
}
]
}Indexierungsrezensionen
Wir indexieren Produktbewertungen nun mithilfe der Bulk-API. Die zuvor erstellte Pipeline wird automatisch angewendet und fügt die vom Nova-Modell generierte Analyse den indizierten Dokumenten hinzu.
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." }Abfragen und Analysieren der Ergebnisse
Zum Schluss führen wir eine Abfrage durch, um zu sehen, wie das Amazon Nova Lite-Modell die Rezensionen analysiert und klassifiziert. Durch Ausführen von GET products/_search erhalten wir die Dokumente, die bereits mit den aus dem Rezensionsinhalt generierten Feldern angereichert sind.
Das Modell ermittelt die vorherrschende Stimmung (positiv, neutral oder negativ), generiert prägnante Zusammenfassungen, extrahiert relevante Schlüsselwörter und schätzt die Authentizität jeder Rezension ein. Diese Felder helfen dabei, die Meinung des Kunden zu verstehen, ohne den gesamten Text lesen zu müssen.
Zur Interpretation der Ergebnisse betrachten wir Folgendes:
Sentiment, das die allgemeine Wahrnehmung des Produkts durch den Konsumenten widerspiegelt.
Die Zusammenfassung, in der die wichtigsten Punkte hervorgehoben werden.
Schlüsselwörter, die verwendet werden können, um ähnliche Rezensionen zu gruppieren oder Feedbackmuster zu identifizieren.
Authentizität, die ein Indikator dafür ist, ob die Rezension vertrauenswürdig erscheint. Dies ist nützlich für die Kuratierung oder Moderation.
"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."
}
}
]Fazit
Die Integration von Amazon Nova Lite und Elasticsearch demonstrierte, wie Sprachmodelle Rohrezensionen in strukturierte und wertvolle Informationen umwandeln können. Durch die Verarbeitung der Rezensionen mittels einer Pipeline konnten wir Stimmungsanalyse, Authentizität, Zusammenfassungen und Schlüsselwörter automatisch und konsistent extrahieren.
Die Ergebnisse zeigen, dass das Modell den Kontext der Rezensionen verstehen, Nutzermeinungen klassifizieren und die relevantesten Punkte jeder Erfahrung hervorheben kann. Dadurch entsteht ein wesentlich umfangreicherer Datensatz, der zur Verbesserung der Suchfunktionen genutzt werden kann.




