Operations (sample payloads)
Main operationsCopy
Copy
AI Generation (Run Inference)Copy
Copy
Use a wide range of Frontier and Open Source GenerativeAI models, backed by the security and privacy of AWS.
Sample Input
1{2"modelId": "anthropic.claude-v2",3"messages": [4{5"system_content": "You are a helpful AI assistant."6},7{8"user_content": "What are the main differences between Python and JavaScript?"9}10],11"maxGenLen": 500,12"temperature": 0.2,13"topP": 114}
Sample Output
1{2"chatResponse": {3"output": {4"message": {5"role": "assistant",6"content": [7{8"text": "Here are the main differences between Python and JavaScript:\n\n1. Language type:\n - Python is a general-purpose programming language\n - JavaScript was originally designed for web development, but can now be used for various purposes\n\n2. Execution environment:\n - Python runs on a Python interpreter\n - JavaScript primarily runs in web browsers, but can also run on servers using Node.js\n\n3. Syntax:\n - Python uses indentation for code blocks\n - JavaScript uses curly braces {} for code blocks\n\n4. Data types:\n - Python has more built-in data types (e.g., tuples, sets)\n - JavaScript has fewer primitive data types\n\n5. Object-oriented programming:\n - Python uses class-based OOP\n - JavaScript uses prototype-based OOP\n\n6. Typing:\n - Python is dynamically typed but supports type hinting\n - JavaScript is dynamically typed\n\n7. Concurrency:\n - Python has built-in support for multi-threading and multiprocessing\n - JavaScript is single-threaded but uses an event loop for asynchronous operations\n\n8. Standard library:\n - Python has a large standard library\n - JavaScript has a smaller standard library but extensive third-party packages\n\nBoth languages have their strengths and are widely used in different domains."9}10]11}12},13"stopReason": "end_turn",14"usage": {15"inputTokens": 24,16"outputTokens": 237,17"totalTokens": 26118},19"metrics": {20"latencyMs": 215021}22}23}
Create EmbeddingsCopy
Copy
Turn content into vector embeddings so you can store it in a Vector database as part of your RAG pipelines (and more).
Sample Input
1{2"modelGroup": {3"titanModelId": "amazon.titan-embed-text-v1",4"inputText": "Artificial intelligence is transforming various industries, from healthcare to finance.",5"normalize": true,6"dimensions": 10247}8}
Sample Output
1{2"modelResponse": "[0.023, -0.015, 0.067, ..., 0.041]"3}
List ModelsCopy
Copy
List all possible models offered by AWS Bedrock currently.
Sample Input
1{2"outputModality": "TEXT",3"modelNameFilter": "anthropic"4}
Sample Output
1{2"models": [3{4"modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-v2",5"modelId": "anthropic.claude-v2",6"modelName": "Claude V2",7"providerName": "Anthropic",8"inputModalities": [9"TEXT"10],11"outputModalities": [12"TEXT"13],14"responseStreamingSupported": true,15"customizationsSupported": [],16"inferenceTypesSupported": [17"ON_DEMAND"18],19"modelLifecycle": {20"status": "ACTIVE"21}22},23{24"modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-instant-v1",25"modelId": "anthropic.claude-instant-v1",26"modelName": "Claude Instant V1",27"providerName": "Anthropic",28"inputModalities": [29"TEXT"30],31"outputModalities": [32"TEXT"33],34"responseStreamingSupported": true,35"customizationsSupported": [],36"inferenceTypesSupported": [37"ON_DEMAND"38],39"modelLifecycle": {40"status": "ACTIVE"41}42}43]44}
Raw HTTP request (advanced)Copy
Copy
Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication.
Sample Input
1{2"method": "POST",3"url": {4"fullUrl": "https://api.aws.amazon.com/bedrock/2023-04-20/models/anthropic.claude-v2/invoke"5},6"headers": {7"Content-Type": "application/json",8"X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD",9"X-Amz-Date": "20230915T120000Z"10},11"body": {12"raw": {13"prompt": "Human: What is the capital of France?\n\nAssistant: The capital of France is Paris.",14"max_tokens_to_sample": 300,15"temperature": 0.7,16"top_p": 117}18}19}
Sample Output
1{2"status": 200,3"headers": {4"Content-Type": "application/json",5"Date": "Fri, 15 Sep 2023 12:00:01 GMT",6"x-amzn-RequestId": "1234a567-b89c-12d3-e456-789012f34567"7},8"body": {9"completion": "The capital of France is indeed Paris. Paris is not only the capital city but also the largest city in France. It is a global center for art, fashion, gastronomy, and culture. Some of its famous landmarks include the Eiffel Tower, the Louvre Museum, and Notre-Dame Cathedral.",10"stop_reason": "stop_sequence",11"stop": "\n\nHuman:"12}13}
DDL operationsCopy
Copy
ListModels(DDL)Copy
Copy
Note that DDL operations can only be called directly by Connectors API, or when using CustomJS in the Embedded solution editor for e.g. DDL-dependent data mapping
Sample Input
1{2"outputModality": "TEXT",3"modelNameFilter": "ai21"4}
Sample Output
1{2"result": [3{4"value": "ai21.j2-ultra-v1",5"text": "AI21 Labs Jurassic-2 Ultra"6},7{8"value": "ai21.j2-mid-v1",9"text": "AI21 Labs Jurassic-2 Mid"10},11{12"value": "ai21.j2-large-v1",13"text": "AI21 Labs Jurassic-2 Large"14}15]16}