- info@krescitus.com
- Mon - Sat: 8.00 am - 7.00 pm
We are creative, ambitious and ready for challenges! Hire Us
Amazon Nova Micro is a lightweight, powerful, and efficient large language model (LLM) offered through Amazon Bedrock. It specializes in generating natural language responses, summaries, and contextually relevant content in real-time, enabling a wide range of applications like conversational AI, content generation, and text-based automation.
At its core, Amazon Nova Micro generates human-like text based on the input provided. This text can vary widely depending on the use case and input configuration. Here’s what it can generate:
Amazon Nova Micro uses a pre-trained deep learning model optimized for generating and understanding human language. It works as follows:
Step-by-Step Implementation of Amazon Nova Micro with AWS Lambda
STEP-1:
Go to Amazon Bedrock -> Model Access -> Request model access
Search for Nova Models
Click Next, then Submit
STEP-2:
Create an API Gateway and a Lambda Function.
Use the following Lambda Code written in Python
import boto3
import json
def lambda_handler(event, context):
try:
# Print the incoming event for debugging
print(“Received event:”, json.dumps(event))
# Parse input text from the API Gateway event
body = json.loads(event.get(‘body’, ‘{}‘))
print(“Parsed body:”, body)
input_text = body.get(‘text’, ”)
print(“Input text:”, input_text)
if not input_text:
print(“No input text provided.”)
return {
“statusCode”: 400,
“body”: json.dumps({“error”: “Input text is required”})
}
# Prepare payload for Amazon Bedrock Nova
payload = {
“messages”: [
{
“role”: “user”,
“content”: [{“text”: input_text}] # Wrap content in an array of JSON objects
}
],
“inferenceConfig”: {
“max_new_tokens”: 1000
}
}
print(“Payload for Bedrock:”, json.dumps(payload))
# Initialize Bedrock client
client = boto3.client(“bedrock-runtime”)
print(“Initialized Bedrock client.”)
# Call Bedrock for inference
response = client.invoke_model(
modelId=“amazon.nova-micro-v1:0”,
contentType=“application/json”,
accept=“application/json”,
body=json.dumps(payload)
)
print(“Response from Bedrock:”, response)
# Parse Bedrock response
response_body = json.loads(response[‘body’].read())
print(“Parsed response body:”, response_body)
return {
“statusCode”: 200,
“body”: json.dumps({“result”: response_body})
}
except Exception as e:
# Print the exception for debugging
print(“Error occurred:”, str(e))
return {
“statusCode”: 500,
“body”: json.dumps({“error”: str(e)})
}
STEP-3:
Set up your Angular frontend and use the API Gateway URL to get the result.
Amazon Nova Micro stands out for its ability to generate meaningful, high-quality text efficiently. Whether you need a detailed explanation, a creative idea, or a real-time response, Nova Micro adapts to deliver the best possible output. Its seamless integration with the Amazon Bedrock platform and its ability to produce versatile text outputs make it a valuable tool for developers, businesses, and creative professionals alike.