Generate Text
Generate text for various purposes, such as summarizing information, answering questions, or creating natural language responses. Use the Prompt Template to guide the text generation. The $field_source_column notation specifies the source column and the $column_<column_name> notation specifies all other columns in your dataset.
Parameters
- Destination Column: The column name that will hold the manipulated text. Defaults to
manipulated_text
. - LLM: The large language model used for text generation. Defaults to
gpt-3.5-turbo
. - Credential ID: The connector from your Mantium account. This is a required field.
- String Template: The template that guides the manipulation of text. Defaults to empty string.
Usage
To use the Generate Text transformation, you will need to have a valid API key configured in Mantium for the third-party service (e.g., OpenAI) you want to use. If you don't have one, see the guide here
To use this Mantium Enrichment, follow these steps:
- Configure the Destination Column parameter by specifying the new name for the column that will hold the generated text.
- Configure the LLM Model parameter by selecting the LLM model to use for the text generation.
- Configure the Credential ID parameter by selecting the appropriate credential from the list of available credentials in your Mantium account.
- Add text in the StringTemplate field to provide details to the model on how to generate the text. See example below.
- Optional: Preview the transform to see how the generated text can look based on your data.
- Run the transformation by clicking the Save and Run Transforms button. The resulting dataset will have a new column with the specified name containing the generated text data.
Example 1: Generate Product Descriptions
Suppose you have a dataset containing product names and features, and you want to generate a short description for each product. You can use the Generate Text transformation to create natural language descriptions based on the product features.
The video below demonstrates how to use the Generate Text transformation in just a few seconds. If you prefer text, please continue reading.
ID | Product Name | Features |
---|---|---|
1 | SmartPhone X | 5G, 128GB storage, 6.5-inch display |
2 | Tablet Pro | 10.2-inch display, Wi-Fi, 64GB storage |
To do this, you would configure the transformation as follows:
Source Column: features
Destination Column: description
LLM Model: gpt-3.5-turbo
Credential ID: OpenAI
String Template: "Write a short description for a product with the following features: {features}"
The resulting dataset would look like this:
ID | Product Name | Features | Description |
---|---|---|---|
1 | SmartPhone X | 5G, 128GB storage, 6.5-inch display | The SmartPhone X is a 5G-enabled device with a large 6.5-inch display and 128GB storage capacity, perfect for all your multimedia needs. |
2 | Tablet Pro | 10.2-inch display, Wi-Fi, 64GB storage | The Tablet Pro offers a stunning 10.2-inch display, Wi-Fi connectivity, and 64GB storage, making it the perfect device for browsing, streaming, and more. |
Example 2: Generate Frequently Asked Questions (FAQs) Responses
Suppose you have a dataset containing frequently asked questions about your products or services, and you want to generate responses for each question. You can use the Generate Text transformation to create natural language responses based on the given questions.
ID | FAQ Question |
---|---|
1 | What are the warranty options for SmartPhone X? |
2 | Can I connect my Tablet Pro to a wireless printer? |
To do this, you would configure the transformation as follows:
Source Column: faq_question
Destination Column: faq_answer
LLM Model: gpt-3.5-turbo
Credential ID: OpenAI
String Template: "Provide a helpful response to this customer's question: {faq_question}"
The resulting dataset would look like this:
ID | FAQ Question | Description |
---|---|---|
1 | What are the warranty options for SmartPhone X? | Thank you for your question. The warranty options for SmartPhone X may vary depending on the retailer or carrier that you purchase it from. It is best to check with the specific retailer or carrier for information on their warranty options. However, many smartphones typically come with a manufacturer's warranty that covers defects and malfunctions for a certain period of time. Additionally, some retailers or carriers may offer extended warranty options for an additional fee. |
2 | Can I connect my Tablet Pro to a wireless printer? | Yes, you can connect your Tablet Pro to a wireless printer. You can do this by going to the settings on your tablet and selecting "Printing". From there, you can add your wireless printer and start printing. Make sure that your tablet and printer are connected to the same wireless network. If you need further assistance, you can refer to the user manual for your specific tablet or printer. |
Updated over 1 year ago