GenAI
Generative artificial intelligence (GenAI) can create certain types of images, text, videos, and other media in response to prompts ..

HTML Data Source
Transformation

Filepath
Open the following transformation:
Windows
C:/Projects/genai/html/HTML Parser - Xpath.ktr
Linux
~/Projects/genai/html/HTML Parser - Xpath.ktr
Double-click on the hp: html and configure with the following settings:

3. RUN and preview the results.

Select the main title:
Select all navigation links:
Select all article titles (h3 elements within articles):
Select all paragraph content within articles:
Select all author names:
Select the latest news items:
Select the footer text:
Select all section titles (h2 elements that are direct children of section elements):
Select the second article:
Select all elements with a class attribute:
Filepath from stream
Enable the hop between: dg: filepath from stream -> hp: parse html xpath.
Disable the hop between: Data Grid -> hp: parse html xpath
dg: html from stream -> hp: parse html xpath

Double-click on the hp: html and configure with the following settings:

RUN and preview the results.

HTML from stream
Enable the hop between: dg: html from stream -> hp: parse html xpath.
Disable the hop between: dg: filepath from stream -> hp: parse html xpath
Data Grid -> hp: parse html xpath

Double-click on the hp: html and configure with the following settings:

RUN and preview the results.

Basic Selectors
a) Element Selector:
b) Class Selector:
c) ID Selector:
d) Universal Selector:
Combinators
a) Descendant Selector (space):
b) Child Selector (>):
c) Adjacent Sibling Selector (+):
d) General Sibling Selector (~):
Attribute Selectors
a) [attribute]:
b) [attribute="value"]:
c) [attribute~="value"]:
d) [attribute^="value"]:
e) [attribute$="value"]:
f) [attribute*="value"]:
Pseudo-classes
Combining Selectors
HTML Data Source
Transformation

Filepath
Open the following transformation:
Windows
C:/Projects/genai/html/HTML Parser - CSS.ktr
Linux
~/Projects/genai/html/HTML Parser - CSS.ktr
Double-click on the hp: html and configure with the following settings:

RUN preview the results.

Select the main title:
Select all navigation links:
Select all product titles:
Select all product descriptions:
Select all product prices:
Select the "About Us" section:
Select the newsletter form:
Select all section titles (h2 elements):
Select the footer text:
Select all elements with a class of "product":
Filepath from stream
Enable the hop between: dg: filepath from stream -> hp: parse html xpath.
Disable the hop between: Data grid -> hp: parse html css
dg: html from stream -> hp: parse html css

Double-click on the hp: html and configure with the following settings:

RUN preview results.

HTML from stream
Enable the hop between: dg: html from stream -> hp: parse html css.
Disable the hop between: dg: filepath from stream -> hp: parse html css
Data grid -> hp: parse html css

Double-click on the hp: html and configure with the following settings:

RUN preview results.

Word Document
Open the following transformation:

Windows
C:/Projects/genai/tika/Read Unstructured Document- Word Doc.ktr
Linux
~/Projects/genai/tika/Read Unstructured Document- Word Doc.ktr
Double-click on the Read Unstructured Document step and configure with the following settings:

RUN and preview the results.

Open the following transformation:

Windows
C:/Projects/genai/tika/Read Unstructured Document- Password PDF.ktr
Linux
~/Projects/genai/tika/Read Unstructured Document- Password PDF.ktr.
Double-click on the Read Unstructured Document step and configure with the following settings:

RUN and preview the results.

Open the following transformation:

Windows
C:/Projects/genai/tika/Read Unstructured Document- Stream Multiple Files.ktr
Linux
~/Projects/genai/tika/Read Unstructured Document- Stream Multiple Files.ktr.
Double-click on the Javascript: Add password column.

Double-click on the Read Unstructured Document step and configure with the following settings:

RUN and preview the results.





Open the following transformation.

Windows
C:/Projects/genai/base64/Base64 Encode.ktr
Linux
~/Projects/genai/base64/Base64.ktr.
Double-click on the Base64 Encoder step and configure with the following settings:

Check the Select values step.

RUN and preview the results.

RAW Text
Enable the hop between: Data grid - Raw Text Input -> Base64 Encoder.
Disable the hop between: Data grid -> Base64 Encoder
Get file names images -> Base64 Encoder

Double-click on the Data grid -Raw Input Text step - Data tab

Check the Select values.

RUN and preview the results

Multiple Files
Enable the hop between: Get file names - Images -> Base64 Encoder
Disable the hop between: Data grid - Raw Text Input -> Base64 Encoder.
Data grid -> Base64 Encoder

Double-click on the Get File names - Images step.

Double-click on the Base64 Encoder and configure with the following settings:

Check the Select values.

RUN and preview the results.

Resources
Pentaho Data Integration

Enter Prompt
Enable the hop between: Data Grid -> AI Chat.
Disable the hop bewteen: User Input -> AI Chat.

Open the following transformation:
Windows
C:/Projects/genai/ai chat/.ktr
Linux
~/Projects/genai/html/HTML Parser - Xpath.ktr
Double-click on the hp: html and configure with the following settings:
Double-click on the AI Chat step and configure with the following settings:

Click on the Model tab.


RUN and preview the result.

Prompt from Data Stream fields

Disable the hop between: Data Grid -> AI Chat.
Enable the hop bewteen: User Input -> AI Chat.
Double-click on the User Input step and the Data tab.

Double-click on the AI Chat step and configure with the following settings:

RUN and preview result.

Configure Model with your own account details
Double-click anywhere on the canvas to configure the Parameters.

Enter your own OpenAI Key.
Double-click on the AI Chat step and configure with the following settings.

RUN and preview the result. Should be the same as the previous scenario ..!!
Non-persistant RAG
Enable the hop between: Data Grid -> AI Chat.

Double-click on the AI Chat step and configure with the following settings:

Click on the Embedding tab.

RUN and preview the result.

Embedding - Write
Double-click on the AI Chat step and then on the Embedding tab.
Configure with the following settings.

RUN & check that the embedding has been stored.
Embedding - READ
Double-click on the AI Chat step and configure with the following settings:

Ensure you select the Attach Document(s) option - enables the embedding options.
Click on the Embedding tab and confiure with the following settings:

RUN and preview the result.

Double-click anywhere on the canvas to set the parameters.

Double-click on the Chat AI step and configure with the following settings:

RUN and preview the result.

Prompt - Template
Double-click on the Chat AI step and configure with the following settings:

RUN and preview the result.

Open the following transformation:
Windows
C:/Projects/genai/aichat/Usecase - Log Analysis.ktr
Linux
~/Projects/genai/aichat/Usecase - Log Analysis.ktr
Double-click on the hp: html and configure with the following settings:

Double-click on the AI Chat step to view the settings.

Message / Prompt
Document
Model
Click on the Model tab.

Embedding
Click on the Embedding tab.

Response
Click on the Response tab.

Double-click on the Process generated JSON result step.

Click on the Fields tab.

JSON Notation
$
Root object
$ returns the whole JSON structure
.
Child operator; it's used to access different levels of the JSON structure
$..Issue returns the Issue
RUN and preview result - Output - log-analysis.csv


Double-click on the AI Chat step.

RUN and preview result - Text file output.


Review the main steps of the
The previous step - Get file names returns the paths to the PDFs.

Double-click on the Read Unstructured Document step to view settings.

Double-click on the AI Chat step to view the settings.

Click on the Model tab.

Click on Embedding tab.

Click on the Response tab.

generated_response
Double-click on the Select values step.

RUN and preview the result.

Double-click on Write the Sales Forecast to Excel.

Click on the Content tab.

RUN and open the file:
~/Projects/genai/Use Case - Analyzing Financial Reports/data/Sales Report AI Generated.xlsx

Last updated
Was this helpful?



