Family of Titan Text Models - Boto3 Demo
AWS Bedrock - Learning Series. Explore sample code for leveraging the Titan Text Model family, including Express, Lite, and Embedding.
Published Dec 13, 2023
Last Modified Mar 11, 2024
https://github.com/jayyanar/learning-aws-bedrock/blob/main/blog3-Titan/Bedrock_Titan_Learning.ipynb
I am using vscode local environment with AWS Credential configured.
#The code text = outputText[outputText.index('\n')+1:] extracts the substring following the first newline character in the outputText string. This is useful for scenarios where the initial content before the first newline is irrelevant, and you want to capture the text that comes after it. The index('\n')+1 locates the position of the first newline character, and the slicing [index+1:] fetches the subsequent text, assigning it to the variable text
Text completion:
AWS Lambda, an Amazon Web Services (AWS) serverless computing service, enables developers to execute code in response to events without managing infrastructure. It offers high scalability, automatically adjusting to application demand. With a pay-as-you-go model, it's cost-effective for unpredictable workloads. Supporting various languages like Python and Java, Lambda provides flexibility. Integration with AWS services like S3 and DynamoDB streamlines application development. To use AWS Lambda, developers create functions, configure event sources (e.g., CloudWatch, S3), and invoke functions through the AWS Lambda API or CLI, providing a versatile and efficient solution for building serverless applications.
AWS Lambda, an Amazon Web Services (AWS) serverless computing service, enables developers to execute code in response to events without managing infrastructure. It offers high scalability, automatically adjusting to application demand. With a pay-as-you-go model, it's cost-effective for unpredictable workloads. Supporting various languages like Python and Java, Lambda provides flexibility. Integration with AWS services like S3 and DynamoDB streamlines application development. To use AWS Lambda, developers create functions, configure event sources (e.g., CloudWatch, S3), and invoke functions through the AWS Lambda API or CLI, providing a versatile and efficient solution for building serverless applications.
Text completion:
Amazon DynamoDB is a fully managed NoSQL database service in the cloud that offers fast and predictable performance with seamless scalability. It is designed to run high-performance applications at any scale. On the other hand, Amazon Redis is a fully managed in-memory data structure store that provides real-time analytics, caching, and key-value data storage. It is suitable for applications that require fast data retrieval and low latency.
Amazon DynamoDB is a fully managed NoSQL database service in the cloud that offers fast and predictable performance with seamless scalability. It is designed to run high-performance applications at any scale. On the other hand, Amazon Redis is a fully managed in-memory data structure store that provides real-time analytics, caching, and key-value data storage. It is suitable for applications that require fast data retrieval and low latency.
#This code retrieves the "embedding" vector from the response body and prints its length along with a preview of the first three and last three values, showing a snippet of the embedding vector.
Text within this block will maintain its original spacing when publishedYou can find the Embedding Vector 1536 values
[0.40429688, -0.38085938, 0.19726562, '...', 0.2109375, 0.012573242, 0.18847656]
#This code retrieves the "embedding" vector from the response body and prints its length along with a preview of the first three and last three values, showing a snippet of the embedding vector.
Text within this block will maintain its original spacing when publishedYou can find the Embedding Vector 1024 values
[0.016090883, 0.03545449, 0.0026249958, '...', 0.0065908986, 0.0172727, 0.002738632]
[0.016090883, 0.03545449, 0.0026249958, '...', 0.0065908986, 0.0172727, 0.002738632]
Thanks for reading the blog3 --- Feel free to share your feedback