ElementalInference / Client / update_function
update_function¶
- ElementalInference.Client.update_function(**kwargs)¶
Updates a function. Include only the parameters that you want to change; parameters that you don’t include aren’t affected. Elemental Inference validates the updated expressions in the same way as CreateFunction.
While a feed references the function, you can change only its expressions and its description, and you can set eventBridgeDelivery to DISABLED but not to ENABLED. The request expression must keep referencing the same media context, as reported in contextTypes. Changing an expression changes the behavior of every feed that references the function.
See also: AWS API Documentation
Request Syntax
response = client.update_function( id='string', name='string', target={ 'bedrock': { 'api': 'INVOKE_MODEL', 'model': 'string' }, 'passthrough': {} }, requestExpression='string', responseExpression='string', description='string', eventBridgeDelivery='ENABLED'|'DISABLED' )
- Parameters:
id (string) –
[REQUIRED]
The ID of the function.
name (string) – A new name for the function. You can’t change the name while the function is referenced by a feed.
target (dict) –
A new target for the function. You can’t change the target while the function is referenced by a feed.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
bedrock,passthrough.bedrock (dict) –
Send the request to an Amazon Bedrock model.
api (string) – [REQUIRED]
The Amazon Bedrock API to call. The only valid value is INVOKE_MODEL.
model (string) – [REQUIRED]
The model to invoke. Specify one of the following:
A model ID.
An inference profile ID.
The ARN of a custom model.
The ARN of a provisioned model.
Elemental Inference invokes the model in the Region of the feed. To use a model in other Regions, specify a cross-Region inference profile ID. A custom or provisioned model must be in the Region of the feed.
The request expression must produce a request body that this model accepts, and the model must accept the kind of media that the request expression references. For example, a text-only model can’t accept a request that references media.frames.
passthrough (dict) –
Send the request nowhere. Use this target to reshape the metadata that Elemental Inference already produces, with no model invocation and no model charges.
requestExpression (string) – A new request expression for the function. Elemental Inference derives contextTypes again from the new expression. While a feed references the function, the new expression must reference the same media context as the current one.
responseExpression (string) – A new response expression for the function. To remove the response expression, specify an empty string. A function with a Bedrock target and eventBridgeDelivery set to ENABLED must keep a response expression.
description (string) – A new description for the function.
eventBridgeDelivery (string) – Specifies whether Elemental Inference also sends this function’s marked results to Amazon EventBridge, as described for CreateFunction. If you omit this parameter, the current value is kept. While a feed references the function, you can change this value to DISABLED, but not to ENABLED.
- Return type:
dict
- Returns:
Response Syntax
{ 'name': 'string', 'target': { 'bedrock': { 'api': 'INVOKE_MODEL', 'model': 'string' }, 'passthrough': {} }, 'requestExpression': 'string', 'responseExpression': 'string', 'description': 'string', 'eventBridgeDelivery': 'ENABLED'|'DISABLED', 'arn': 'string', 'id': 'string', 'status': 'CREATING'|'AVAILABLE'|'REFERENCED'|'DELETING'|'DELETED', 'references': [ 'string', ], 'contextTypes': [ 'FRAMES'|'SUBTITLES'|'CONTEXTUAL_METADATA'|'CLIP_METADATA', ], 'tags': { 'string': 'string' } }
Response Structure
(dict) –
name (string) –
The name of the function.
target (dict) –
The destination for the request that the function builds.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
bedrock,passthrough. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
bedrock (dict) –
Send the request to an Amazon Bedrock model.
api (string) –
The Amazon Bedrock API to call. The only valid value is INVOKE_MODEL.
model (string) –
The model to invoke. Specify one of the following:
A model ID.
An inference profile ID.
The ARN of a custom model.
The ARN of a provisioned model.
Elemental Inference invokes the model in the Region of the feed. To use a model in other Regions, specify a cross-Region inference profile ID. A custom or provisioned model must be in the Region of the feed.
The request expression must produce a request body that this model accepts, and the model must accept the kind of media that the request expression references. For example, a text-only model can’t accept a request that references media.frames.
passthrough (dict) –
Send the request nowhere. Use this target to reshape the metadata that Elemental Inference already produces, with no model invocation and no model charges.
requestExpression (string) –
The JSONata expression that builds the request. Elemental Inference evaluates it against the media object of the feed, which holds the media and metadata that the function asked for.
responseExpression (string) –
The JSONata expression that selects what to store. Elemental Inference evaluates it against the result as its root: the model response for a Bedrock target, or the output of the request expression for a passthrough target. If a function has no response expression, Elemental Inference stores the entire result.
description (string) –
The description of the function.
eventBridgeDelivery (string) –
Indicates whether Elemental Inference also sends this function’s results to Amazon EventBridge. With ENABLED, each result that is a JSON object with a top-level
eventBridgefield set totrueis also sent as a Function Metadata Generated event to the default event bus in your account.arn (string) –
The ARN of the function.
id (string) –
The ID of the function.
status (string) –
The status of the function.
references (list) –
The IDs of the feeds that have a function output, enabled or disabled, that references this function. While this list isn’t empty, the function can’t be deleted, and its name and target can’t be changed.
(string) –
contextTypes (list) –
The kinds of media context that this function uses. Elemental Inference derives this field from the media paths that the request expression references; you can’t set it. An empty list means that the expression references no media, so Elemental Inference supplies none at run time.
(string) –
One kind of media context that a function reads. Elemental Inference derives this value from the media paths that the request expression references:
FRAMES – Derived from media.frames.
SUBTITLES – Derived from media.transcript.
CONTEXTUAL_METADATA – Derived from media.contextual.
CLIP_METADATA – Derived from media.clip.
A request expression can reference at most one of SUBTITLES, CONTEXTUAL_METADATA, and CLIP_METADATA, in addition to FRAMES.
tags (dict) –
The tags associated with the function.
(string) –
(string) –
Exceptions