Semarchy GenAI Amazon Bedrock Cohere enricher

The Semarchy GenAI Amazon Bedrock Cohere enricher generates a single text response based on a user prompt.

Plugin ID

Semarchy GenAI Amazon Bedrock Cohere Enricher - com.semarchy.engine.plugins.genai.amazon.bedrock.simple

Description

The GenAI Amazon Bedrock Cohere enricher is designed to enhance text data using Cohere language models available through the Amazon Bedrock service. Users can leverage this enricher to improve the quality, relevance, and depth of their text data using advanced AI capabilities.

Plugin parameters

The following table lists the plugin parameters.

Parameter name Mandatory Type Description

Model Name

Yes

String

Language model to be used (e.g., cohere.command-text-v14).

Temperature

No

Number

Value ranging from 0 to 1 for balancing between conservative and coherent outputs (0) and creative variations (1) during text generation.
Default value: 0

Max Tokens

No

Integer

Maximum number of tokens allowed in the generated output during text generation.
Default value: 20

The total length of input and generated tokens is limited by the context length of the model.
Setting an insufficient number of tokens may result in a runtime error during response processing. Make sure to adjust the Max Tokens parameter to accommodate the number of generated tokens, considering your requirements and the terms of your OpenAI license.

Top P

No

Number

Value ranging from 0 to 1 for defining the cumulative probability threshold for nucleus sampling (i.e., token selection).
Default value: 0.75

Nucleus sampling is an alternative to temperature sampling. Ignore this parameter if you configured the Temperature parameter.

Top K

No

Number

Value ranging from 0 to 500 for limiting the model’s predictions to the most probable tokens at each step of generation.
Default value: 0

If both Top P and Top K are configured, the model first narrows down the tokens to the top k most probable ones, then applies the Top P filtering to this subset.

Stop Sequences

No

Integer

Number of predefined sequences (up to four) acting as signals for the model to halt the generation of further tokens.

The final returned text does not include the stop sequence itself.

Return Likelihoods

No

String

Choice of whether and how the model should return token likelihoods with the response. Possible values are:

  • GENERATION: only returns likelihoods for generated tokens.

  • ALL: returns likelihoods for all tokens.

  • NONE (default): does not return any likelihoods.

Token likelihoods provide a measure of the probability that a particular token appears in the output, which can be useful for analyzing the model’s confidence in its predictions.

Stream

No

Boolean

Choice of whether to return the response piece-by-piece in real-time (true) or to return the complete response after the process finishes (false). Setting this parameter is required to support streaming.

Logit Bias

No

String

Adjustment, formatted as {token_id: bias} where bias is a float between -10 and 10, for either preventing the model from generating unwanted tokens or encouraging the inclusion of desired tokens. For more information, see the official Cohere documentation.

Num Generations

No

Number

Maximum number of generations that the model should return. Possible values range from 1 to 5.
Default value: 1

Truncate

No

String

Preferred approach to handling inputs longer than the maximum token length. Possible values are:

  • NONE: returns an error when the input exceeds the maximum input token length.

  • START: discards the start of the input.

  • END (default): discards the end of the input.

If you specify START or END, the model discards the input until the remaining input is exactly the maximum input token length for the model.

Language models

Language models are AI systems trained on vast amounts of text data to understand and generate human-like language, enabling tasks like text completion, translation, summarization, and sentiment analysis.

Amazon Bedrock offers a range of models with distinct capabilities. For more information on Cohere models and a list of stable model versions available on Amazon Bedrock, see the official Cohere documentation and official Amazon Bedrock documentation.

Tokens

Tokens are units of text that language models use to process and generate language. They can range from individual characters to entire words, depending on the language and the specific model being used.

Plugin inputs

The following table lists the plugin inputs.

Input name Mandatory Type Description

User Prompt

Yes

String

Input query specifying the user’s particular needs, intentions, or requests for the generated text.

System Prompt

No

String

Initial instruction designed to guide the model towards specific topics, styles, tones, or formats of generated text.

Plugin outputs

The following table lists the plugin outputs.

Output name Type Description

Response

String

Generated response applied to a designated attribute.

Examples and use cases

Social media blurb generation: summarizing product descriptions

Imagine a scenario where a user needs a condensed version of a detailed product description for social media, where character or space limits apply. In practice, during record creation or editing, the user wants a brief social media blurb to be generated based on the Description field’s content.

For instance, consider the Velocity Pro Carbon Bike product record with the following description:
"Introducing the Velocity Pro Carbon Bike from Italy, a high-performance masterpiece meticulously crafted for speed enthusiasts. This aerodynamic marvel boasts cutting-edge design and lightweight materials, providing an unparalleled riding experience. Elevate your cycling adventures with the pinnacle of Italian engineering. Price: 134."

Suppose the enricher is configured as follows:

  • In the plugin input properties:

    • User Prompt: 'Summarize the following description in less than 150 characters: ' || Description

  • In the plugin output properties:

    • Attribute Name: SocialMediaBlurb

In this setup, the response provided by the enricher may populate the Social Media Blurb field of the Velocity Pro Carbon Bike record with the following:
"Introducing the Velocity Pro Carbon Bike from Italy: a high-performance marvel, aerodynamic design, lightweight materials, ultimate riding experience. Price: $134."

Additional use cases

Below are just a few examples of the diverse range of use cases that the GenAI Amazon Bedrock Cohere enricher can support:

  • Content generation: create detailed descriptions of products or customer personas; generate captions for social media posts, ads, or campaigns.

  • Content synthesis: capture the essence of a text to create titles or names for products, services, or features.

  • Content quality: enhance clarity, refine structure, and adjust tone to meet specific communication goals; correct spelling and grammar errors to adhere to standard language conventions.

  • Custom tone of voice: adapt the tone of the text to align with specific communication objectives, conveying neutrality, professionalism, empathy, education, or casualness.

  • Language translation: translate text into one or several other languages.

  • Price conversion: convert product prices from one currency to another.