Operations (sample payloads)

Main operations

AI Generation (Run Inference)

Use a wide range of Frontier and Open Source GenerativeAI models, backed by the security and privacy of AWS. Sample Input

{
    "modelId": "anthropic.claude-v2",
    "messages": [
        {
            "system_content": "You are a helpful AI assistant."
        },
        {
            "user_content": "What are the main differences between Python and JavaScript?"
        }
    ],
    "maxGenLen": 500,
    "temperature": 0.2,
    "topP": 1
}

Sample Output

{
    "chatResponse": {
        "output": {
            "message": {
                "role": "assistant",
                "content": [
                    {
                        "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."
                    }
                ]
            }
        },
        "stopReason": "end_turn",
        "usage": \{
            "inputTokens": 24,
            "outputTokens": 237,
            "totalTokens": 261
        \},
        "metrics": {
            "latencyMs": 2150
        }
    }
}

Create Embeddings

Turn content into vector embeddings so you can store it in a Vector database as part of your RAG pipelines (and more). Sample Input

{
    "modelGroup": \{
        "titanModelId": "amazon.titan-embed-text-v1",
        "inputText": "Artificial intelligence is transforming various industries, from healthcare to finance.",
        "normalize": true,
        "dimensions": 1024
    \}
}

Sample Output

\{
    "modelResponse": "[0.023, -0.015, 0.067, ..., 0.041]"
\}

List Models

List all possible models offered by AWS Bedrock currently. Sample Input

\{
    "outputModality": "TEXT",
    "modelNameFilter": "anthropic"
\}

Sample Output

{
    "models": [
        {
            "modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-v2",
            "modelId": "anthropic.claude-v2",
            "modelName": "Claude V2",
            "providerName": "Anthropic",
            "inputModalities": [
                "TEXT"
            ],
            "outputModalities": [
                "TEXT"
            ],
            "responseStreamingSupported": true,
            "customizationsSupported": [],
            "inferenceTypesSupported": [
                "ON_DEMAND"
            ],
            "modelLifecycle": {
                "status": "ACTIVE"
            }
        },
        {
            "modelArn": "arn:aws:bedrock:us-west-2::foundation-model/anthropic.claude-instant-v1",
            "modelId": "anthropic.claude-instant-v1",
            "modelName": "Claude Instant V1",
            "providerName": "Anthropic",
            "inputModalities": [
                "TEXT"
            ],
            "outputModalities": [
                "TEXT"
            ],
            "responseStreamingSupported": true,
            "customizationsSupported": [],
            "inferenceTypesSupported": [
                "ON_DEMAND"
            ],
            "modelLifecycle": {
                "status": "ACTIVE"
            }
        }
    ]
}

Raw HTTP request (advanced)

Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication. Sample Input

{
    "method": "POST",
    "url": {
        "fullUrl": "https://api.aws.amazon.com/bedrock/2023-04-20/models/anthropic.claude-v2/invoke"
    },
    "headers": \{
        "Content-Type": "application/json",
        "X-Amz-Content-Sha256": "UNSIGNED-PAYLOAD",
        "X-Amz-Date": "20230915T120000Z"
    \},
    "body": {
        "raw": \{
            "prompt": "Human: What is the capital of France?\n\nAssistant: The capital of France is Paris.",
            "max_tokens_to_sample": 300,
            "temperature": 0.7,
            "top_p": 1
        \}
    }
}

Sample Output

{
    "status": 200,
    "headers": \{
        "Content-Type": "application/json",
        "Date": "Fri, 15 Sep 2023 12:00:01 GMT",
        "x-amzn-RequestId": "1234a567-b89c-12d3-e456-789012f34567"
    \},
    "body": \{
        "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.",
        "stop_reason": "stop_sequence",
        "stop": "\n\nHuman:"
    \}
}

DDL operations

ListModels(DDL)

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

\{
    "outputModality": "TEXT",
    "modelNameFilter": "ai21"
\}

Sample Output

{
    "result": [
        \{
            "value": "ai21.j2-ultra-v1",
            "text": "AI21 Labs Jurassic-2 Ultra"
        \},
        \{
            "value": "ai21.j2-mid-v1",
            "text": "AI21 Labs Jurassic-2 Mid"
        \},
        \{
            "value": "ai21.j2-large-v1",
            "text": "AI21 Labs Jurassic-2 Large"
        \}
    ]
}

Was this page helpful?