Semarchy GenAI OpenAI enricher

The Semarchy GenAI OpenAI enricher generates a single text response based on a user prompt.

Plug-in ID

Semarchy GenAI OpenAI Enricher - com.semarchy.engine.plugins.genai.openai

Description

The GenAI OpenAI enricher is designed to enhance text data using OpenAI’s language models. Users can leverage this enricher to improve the quality, relevance, and depth of their text data using advanced AI capabilities.

Plug-in parameters

The following table lists the plug-in parameters.

Parameter name Mandatory Type Description

API Key

Yes

String

Client-side API key for establishing connectivity with the OpenAI API.

The API key is the only way to establish a connection to the OpenAI API. OpenAI API keys grant access to specific models and services based on account details such as type, subscription, and permissions.

Model

Yes

String

Language model to be used. Possible values are:

  • gpt-3.5-turbo

  • gpt-4

The accessibility of models is determined by the API key.

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.

Frequency Penalty

No

Number

Value between -2.0 and 2.0 used to discourage the model from repeatedly sampling the same sequences of tokens during text generation. Reasonable values typically range from 0.1 to 1.
Default value: 0.

Max Tokens

No

Integer

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

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.

Presence Penalty

No

Number

Value between -2.0 and 2.0 used to reduce the likelihood of the model generating repetitive sequences of tokens during text generation. Reasonable values typically range from 0.1 to 1.
Default value: 0.

Top P

No

Number

Value ranging from 0 to 1 for defining the cumulative probability threshold for nucleus sampling.

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

Max Retries

No

Integer

Maximum number of attempts allowed for API requests before considering them unsuccessful.
Default value: 3.

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.

The OpenAI API offers a range of models with distinct capabilities. The models supported by the OpenAI enricher include:

  • gpt-3.5-turbo: the latest iteration of GPT-3.5 Turbo.

  • gpt-4: this model builds upon the advancements of GPT-3.5, with continuous upgrades.

Both gpt-3.5-turbo and gpt-4 theoretically point to the latest versions of their respective models.

For more information on OpenAI models, see the official OpenAI 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.

For more information about tokens, see the official OpenAI documentation.

Plug-in inputs

The following table lists the plug-in 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.

Plug-in outputs

The following table lists the plug-in 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 plug-in input properties:

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

  • In the plug-in output properties:

    • Attribute Name: SocialMediaBlurb

In this setup, the response provided by the enricher will 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 OpenAI 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.