Interface

AWSTextAdapterConfig (ai/adapters)

@ckeditor/ckeditor5-ai/src/adapters/awstextadapter

interface

The configuration for the Amazon Bedrock adapter.

The properties defined in this configuration are set in the config.ai.aws namespace.

ClassicEditor
	.create( editorElement, {
		ai: {
		    aws: {
		        apiUrl: 'https://url.to.your.application/ai'
		    }
		}
	} )
	.then( ... )
	.catch( ... );

See the full AI configuration.

See all editor options.

Filtering

Properties

  • apiUrl : string | undefined

    The URL to which the AI service request will be sent.

    Set this value only if you want to connect to Amazon Bedrock using a proxy endpoint.

    If apiUrl is not provided, the AWS-SDK library will be used to process the request. It will set a proper URL on its own.

  • bedrockClientConfig : BedrockRuntimeClientConfig | undefined

    The configuration for AWS-SDK Bedrock Runtime Client.

    If apiUrl is not provided, this configuration will be used to initialize the Bedrock Runtime Client which will be used to process the requests. The adapter will make requests directly to the Amazon Bedrock service.

  • requestHeaders : RequestHeaders | undefined

    An object with headers to set in the request to the AI service.

    These headers are only used when connecting to AWS through the proxy endpoint (that is, when apiUrl is set).

    Otherwise, the AWS-SDK library is used, and it sets the request headers on its own. In this mode, the request headers cannot be customized.

    If the provided value is an object, it is simply used as provided.

    {
    	ai: {
    		aws: {
    			requestHeaders: {
    		 		'Authorization': 'Bearer YOUR_API_KEY'
    			}
    		}
    		// ...
    	}
    }
    

    If the provided value is a function, it should be a function that returns a promise which resolves with the headers object. This way, you can perform an authorization request to your application and receive the authorization token (and also implement any custom logic on the backend side). The headers object is then used to make the actual call to the AI service.

    {
    	ai: {
    		aws: {
    			requestHeaders: async () => {
    				const jwt = await fetch( 'https://example.com/jwt-endpoint' );
    
    				return {
    					'Authorization': 'Bearer ' + jwt
    				}
    			}
    		}
    		// ...
    	}
    }
    

    The function is passed the actionId parameter to make it possible to further customize the headers.

    If the function fails for any reason, the promise should be rejected. In this case, a feature that made the request should display an error notification.

  • requestParameters : RequestParameters | undefined

    Additional configuration parameters for the AI service request. Use it to customize how the AI service generates responses. Note that the value you will set here will fully overwrite the default value.

    The exact configuration (available parameters) depends on the used model. Keep in mind that some properties are not supported by some models.

    See AWS model parameters reference to learn more.

    If the provided value is an object, it is passed to the request as provided.

    If the provided value is a function, it should be a function that returns a promise which resolves with the request parameters object. This gives you more flexibility to provide parameters for the AI model.

    The function is passed the actionId parameter to make it possible to further customize the parameters.

    If the function fails for any reason, the promise should be rejected. In this case, the feature that made the request should display an error notification.

    Defaults to:

    {
    	model: 'anthropic.claude-v2',
    	max_tokens_to_sample: 500,
    	temperature: 1,
    	top_k: 250,
    	top_p: 1,
    	anthropic_version: 'bedrock-2023-05-31',
    	stream: true
    }