SlideShare a Scribd company logo
XPath AI Extension
Functions
© 2024 Syncro Soft SRL. All rights reserved
Octavian Nadolu, Syncro Soft
octavian_nadolu@oxygenxml.com
@OctavianNadolu
XPath AI Extension Functions
XPath AI Extension Functions
Transform Content Using AI
● Examples:
– Make the text easy to read and understand
– Correct spelling and grammar
– Rephrase to use active voice
– Rephrase to have 20 words
– Rephrase paragraph to answer to the following question
– Translate content
XPath AI Extension Functions
XPath AI Extension Functions
Generate Content Using AI
● Examples:
– Generate a template file
– Add missing cells from table
– Generate content based on a schema
– Generate documentation for code
– Explain current code
XPath AI Extension Functions
XPath AI Extension Functions
Verify Content Using AI
Examples of verification with AI:
– Is the text easy to read and understand?
– Is spelling and grammar correct?
– Is active/passive voice used in the description?
– Is this written according to the style guide?
– Does the topic answers to this <question>?
XPath AI Extension Functions
XPath AI Extension Functions
XPath AI Extension Functions
● Call AI engine API using an XPath extension function
● Implementation can differ depending on the AI model you are using
● Extension functions
● Transform the content using an instruction from the user, return the generated content
xs:string ai:transform-content(xs:string instruction, xs:string content)
● Verify the content using an instruction from the user, return true or false
xs:boolean ai:verify-content(xs:string instruction, xs:string content)
XPath AI Extension Functions
XPath AI Extension Functions
Transform Content Function
● Function provides a specific built-in prompt
● User specifies the instruction and the content to be transformed
ai:transform-content(instruction, content)
The function has the string parameters:
– instruction - The instruction to be performed on the content.
– content - The content to be transformed.
– It returns a string that represents the transformed content.
“You are a developer and you need perform the following task:“
+ Rephrase to use active voice + content
XPath AI Extension Functions
XPath AI Extension Functions
Verify Content Function
● Function can provide a specific built-in prompt
● User can specify the instruction and the content to be verified
ai:verify-content(instruction, content)
The function has the string parameters:
– instruction - The OpenAI instruction to be performed on the content.
– content - The content to be verified.
– It returns a boolean value that represents the result of the verification.
“You are a technical writer and you need to verify the following
and respond with true or false:“
+ Is active voice used in the description? + content
XPath AI Extension Functions
XPath AI Extension Functions
Transform Content Function+
● Provide a more detailed context using (user, agent) pairs
ai:transform-content(instruction, (user, agent)*, content)
“Act as a technical writer and perform the following task:“
+ Rephrase to use active voice. Choose the best variant based to the strong points
+ (Rephrase and provide 3 variants + agentResult)
+ (Provide the strong points for each variant + agentResult)
+ content
XPath AI Extension Functions
XPath AI Extension Functions
Verify Content Function+
● Provide a more detailed context using (user, agent) pairs
● ai:verify-content(instruction, (user, agent)*, content)
● “You are a technical writer and you need to verify the following
and respond with true or false:“
+ Is active voice used in the description?
+ (user + agent)
+ (user + agent)
+ content
XPath AI Extension Functions
XPath AI Extension Functions
Examples of using AI XPath Functions
XPath AI Extension Functions
XPath AI Extension Functions
AI functions in Schematron and SQF
● Schematron - verify document content automatically using AI
● SQF - correct problems in document using AI
XPath AI Extension Functions
XPath AI Extension Functions
Verify content using Schematron
● Example of a rule that checks if the text uses active voice
In the description we should use active voice
XPath AI Extension Functions
XPath AI Extension Functions
Check the text voice
● Rule that verifies if the text voice is active
<sch:rule context="shortdesc">
<sch:assert test="ai:verify-content('Is active voice used?', .)">
In the description we should use active voice.</sch:assert>
</sch:rule>
XPath AI Extension Functions
XPath AI Extension Functions
Correct the text voice
● Example fix that reformulates the text to use active voice
Reformulate the text to use active voice
XPath AI Extension Functions
XPath AI Extension Functions
Correct the text voice
● SQF fix that that reformulates the text to use active voice
<sqf:fix id="rephrase">
<sqf:description>
<sqf:title>Reformulate the text to use active voice</sqf:title>
</sqf:description>
<sqf:replace match="text()" select="ai:transform-content('
Reformulate to use active voice', .)"/>
</sqf:fix>
XPath AI Extension Functions
XPath AI Extension Functions
Check technical terms
● Example of a rule that checks if the technical terms are not explained
adequately
The text uses WIFI term that is not explained adequately
XPath AI Extension Functions
XPath AI Extension Functions
Specify how to reformulate the phrase
Correct terms
● Example fix that allows the user to specify how to reformulate the phrase
XPath AI Extension Functions
XPath AI Extension Functions
Correct terms
● SQF fix that allows the user to specify the prompt that will be sent to the AI
<sqf:fix id="reformulateUser">
<sqf:description>
<sqf:title>Specify how to reformulate the phrase</sqf:title>
</sqf:description>
<sqf:user-entry name="userInput" default="'
Reformulate phrase and replace the ambiguous terms with a more accurate one'">
<sqf:description><sqf:title>How to correct:</sqf:title>sqf:description>
</sqf:user-entry>
<sqf:replace match="text()" select="ai:transform-content($userInput, .)"/>
</sqf:fix>
XPath AI Extension Functions
XPath AI Extension Functions
AI functions in XSL and XQuery
● Transform content using AI
● Create refactoring actions based on AI
XPath AI Extension Functions
XPath AI Extension Functions
Refactor content using XSL and AI
• Rephrase the short description element content to have less than 30 words
<xsl:template match="shortdesc[count(tokenize(.,'s+')) > 30]">
<shortdesc>
<xsl:value-of select="ai:transform-content('Rephrase this in less than 30 words:', .)"/>
</shortdesc>
</xsl:template>
XPath AI Extension Functions
XPath AI Extension Functions
Refactor content using XSL and AI
• Rephrase the short description element content to have less than 30 words
<xsl:template match="image[@keyref][not(alt)]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<alt>
<xsl:value-of select="
ai:transform-content(
'Create a short alternate text description for this image:',
concat('${attach(', ditaaccess:getKeyRefAbsoluteReference(@keyref, base-uri()), ')}'))" />
</alt>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
XPath AI Extension Functions
XPath AI Extension Functions
Refactor content using XSL and AI
• Translate text to French
<xsl:template match="text()">
<xsl:value-of select="ai:transform-content('Act as a translation specialist.
Translate following content to French:', text())"/>
</xsl:template>
XPath AI Extension Functions
XPath AI Extension Functions
Refactor content using XSL and AI
• Translate text to French and Verify
<xsl:template match="text()">
<xsl:variable name="agentFrench" select="ai:transform-content('Translate to French in 3 variants ', .)"/>
<xsl:variable name="agentEnglish" select="ai:transform-content('Translate content from French to English ', $agentFrench)"/>
<xsl:value-of select="ai:transform-content('Compare the English translation with original content
and use the correct French translation. ',
'Translate to french in 3 variants ', $agentFrench,
'Translate from french to english ', $agentEnglish, .)"/>
</xsl:template>
XPath AI Extension Functions
XPath AI Extension Functions
Conclusion
● AI can be used to generate and transform content
● Use XPath AI functions to automate the process
● Use AI in Schematron and SQF to verify and correct content
● Use AI in XSL and XQuery to transform and refactor content
● Always check the AI response
XPath AI Extension Functions
XPath AI Extension Functions
Resources
● oxygenxml.com/doc/ug-editor/topics/ai_positron.html
● blog.oxygenxml.com/topics/ai_positron.html
● https://github.com/f/awesome-chatgpt-prompts
● https://platform.openai.com/docs/guides/chat
Questions?
Octavian Nadolu
Project Manager at Syncro Soft
octavian.nadolu@oxygenxml.com
Twitter: @OctavianNadolu
LinkedIn: octaviannadolu

More Related Content

Similar to Artificia Intellicence and XPath Extension Functions

AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
Amazon Web Services
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Build text analytics solutions with AWS ML Services
Build text analytics solutions with AWS ML ServicesBuild text analytics solutions with AWS ML Services
Build text analytics solutions with AWS ML Services
Amazon Web Services
 
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdfKate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
Amazon Web Services
 
Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)
Andrey Volobuev
 
C++ functions
C++ functionsC++ functions
C++ functions
Mayank Jain
 
Build Text Analytics Solutions with Amazon Comprehend & Amazon Translate
Build Text Analytics Solutions with Amazon Comprehend & Amazon TranslateBuild Text Analytics Solutions with Amazon Comprehend & Amazon Translate
Build Text Analytics Solutions with Amazon Comprehend & Amazon Translate
Amazon Web Services
 
Technical Utilities for your Site
Technical Utilities for your SiteTechnical Utilities for your Site
Technical Utilities for your Site
Compare Infobase Limited
 
Technologies for Websites
Technologies for WebsitesTechnologies for Websites
Technologies for Websites
Compare Infobase Limited
 
Guidelines to understand durable functions with .net core, c# and stateful se...
Guidelines to understand durable functions with .net core, c# and stateful se...Guidelines to understand durable functions with .net core, c# and stateful se...
Guidelines to understand durable functions with .net core, c# and stateful se...
Concetto Labs
 
Salesforce Basic Development
Salesforce Basic DevelopmentSalesforce Basic Development
Salesforce Basic Development
Naveen Dhanaraj
 
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
Amazon Web Services
 
C++ Functions
C++ FunctionsC++ Functions
C++ Functions
sathish sak
 
Exploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - DevelopmentExploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - Development
Octavian Nadolu
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
lailoesakhan
 
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could giveN hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
Woonsan Ko
 
Integrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXFIntegrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXF
coheigea
 
Arrays &amp; functions in php
Arrays &amp; functions in phpArrays &amp; functions in php
Arrays &amp; functions in php
Ashish Chamoli
 
Ember components
Ember componentsEmber components
Ember components
Sarath Chandra
 
Nancy CLI. Automated Database Experiments
Nancy CLI. Automated Database ExperimentsNancy CLI. Automated Database Experiments
Nancy CLI. Automated Database Experiments
Nikolay Samokhvalov
 

Similar to Artificia Intellicence and XPath Extension Functions (20)

AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
AWS Machine Learning Week SF: Build text analytics solutions with AWS ML Serv...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Build text analytics solutions with AWS ML Services
Build text analytics solutions with AWS ML ServicesBuild text analytics solutions with AWS ML Services
Build text analytics solutions with AWS ML Services
 
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdfKate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
Kate Werling - Build text analytics solutions with AWS ML Services (300) _BP.pdf
 
Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)Prompt engineering for iOS developers (How LLMs and GenAI work)
Prompt engineering for iOS developers (How LLMs and GenAI work)
 
C++ functions
C++ functionsC++ functions
C++ functions
 
Build Text Analytics Solutions with Amazon Comprehend & Amazon Translate
Build Text Analytics Solutions with Amazon Comprehend & Amazon TranslateBuild Text Analytics Solutions with Amazon Comprehend & Amazon Translate
Build Text Analytics Solutions with Amazon Comprehend & Amazon Translate
 
Technical Utilities for your Site
Technical Utilities for your SiteTechnical Utilities for your Site
Technical Utilities for your Site
 
Technologies for Websites
Technologies for WebsitesTechnologies for Websites
Technologies for Websites
 
Guidelines to understand durable functions with .net core, c# and stateful se...
Guidelines to understand durable functions with .net core, c# and stateful se...Guidelines to understand durable functions with .net core, c# and stateful se...
Guidelines to understand durable functions with .net core, c# and stateful se...
 
Salesforce Basic Development
Salesforce Basic DevelopmentSalesforce Basic Development
Salesforce Basic Development
 
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
Bring Your Own Apache MXNet and TensorFlow Scripts to Amazon SageMaker (AIM35...
 
C++ Functions
C++ FunctionsC++ Functions
C++ Functions
 
Exploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - DevelopmentExploring the new features in Oxygen XML Editor 20 - Development
Exploring the new features in Oxygen XML Editor 20 - Development
 
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdfProgFund_Lecture_4_Functions_and_Modules-1.pdf
ProgFund_Lecture_4_Functions_and_Modules-1.pdf
 
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could giveN hidden gems you didn't know hippo delivery tier and hippo (forge) could give
N hidden gems you didn't know hippo delivery tier and hippo (forge) could give
 
Integrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXFIntegrating Apache Syncope with Apache CXF
Integrating Apache Syncope with Apache CXF
 
Arrays &amp; functions in php
Arrays &amp; functions in phpArrays &amp; functions in php
Arrays &amp; functions in php
 
Ember components
Ember componentsEmber components
Ember components
 
Nancy CLI. Automated Database Experiments
Nancy CLI. Automated Database ExperimentsNancy CLI. Automated Database Experiments
Nancy CLI. Automated Database Experiments
 

More from Octavian Nadolu

YAML Editing and Validation In Oxygen
YAML Editing and Validation In OxygenYAML Editing and Validation In Oxygen
YAML Editing and Validation In Oxygen
Octavian Nadolu
 
Oxygen JSON Editor
Oxygen JSON EditorOxygen JSON Editor
Oxygen JSON Editor
Octavian Nadolu
 
OpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in OxygenOpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in Oxygen
Octavian Nadolu
 
Validating XML and JSON Documents Using Oxygen Scripting
 Validating XML and JSON Documents Using Oxygen Scripting Validating XML and JSON Documents Using Oxygen Scripting
Validating XML and JSON Documents Using Oxygen Scripting
Octavian Nadolu
 
OpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and DocumentingOpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and Documenting
Octavian Nadolu
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPI
Octavian Nadolu
 
Create an Design JSON Schema
Create an Design JSON SchemaCreate an Design JSON Schema
Create an Design JSON Schema
Octavian Nadolu
 
Compare And Merge Scripts
Compare And Merge ScriptsCompare And Merge Scripts
Compare And Merge Scripts
Octavian Nadolu
 
JSON Schema Design
JSON Schema DesignJSON Schema Design
JSON Schema Design
Octavian Nadolu
 
Schematron For Non-XML Languages
Schematron For Non-XML LanguagesSchematron For Non-XML Languages
Schematron For Non-XML Languages
Octavian Nadolu
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in OxygenJSON and JSON Schema in Oxygen
JSON and JSON Schema in Oxygen
Octavian Nadolu
 
HTML5 Editing Validation
HTML5 Editing ValidationHTML5 Editing Validation
HTML5 Editing Validation
Octavian Nadolu
 
Documentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO SchematronDocumentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO Schematron
Octavian Nadolu
 
Introduction to Schematron
Introduction to SchematronIntroduction to Schematron
Introduction to Schematron
Octavian Nadolu
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
Octavian Nadolu
 
JSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and ConvertJSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and Convert
Octavian Nadolu
 
The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019
Octavian Nadolu
 
Collaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation ProcessCollaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation Process
Octavian Nadolu
 
Schematron step-by-step
Schematron step-by-stepSchematron step-by-step
Schematron step-by-step
Octavian Nadolu
 
Comparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual ModeComparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual Mode
Octavian Nadolu
 

More from Octavian Nadolu (20)

YAML Editing and Validation In Oxygen
YAML Editing and Validation In OxygenYAML Editing and Validation In Oxygen
YAML Editing and Validation In Oxygen
 
Oxygen JSON Editor
Oxygen JSON EditorOxygen JSON Editor
Oxygen JSON Editor
 
OpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in OxygenOpenAPI/AsyncAPI Support in Oxygen
OpenAPI/AsyncAPI Support in Oxygen
 
Validating XML and JSON Documents Using Oxygen Scripting
 Validating XML and JSON Documents Using Oxygen Scripting Validating XML and JSON Documents Using Oxygen Scripting
Validating XML and JSON Documents Using Oxygen Scripting
 
OpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and DocumentingOpenAPI Editing, Testing, and Documenting
OpenAPI Editing, Testing, and Documenting
 
JSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPIJSON, JSON Schema, and OpenAPI
JSON, JSON Schema, and OpenAPI
 
Create an Design JSON Schema
Create an Design JSON SchemaCreate an Design JSON Schema
Create an Design JSON Schema
 
Compare And Merge Scripts
Compare And Merge ScriptsCompare And Merge Scripts
Compare And Merge Scripts
 
JSON Schema Design
JSON Schema DesignJSON Schema Design
JSON Schema Design
 
Schematron For Non-XML Languages
Schematron For Non-XML LanguagesSchematron For Non-XML Languages
Schematron For Non-XML Languages
 
JSON and JSON Schema in Oxygen
JSON and JSON Schema in OxygenJSON and JSON Schema in Oxygen
JSON and JSON Schema in Oxygen
 
HTML5 Editing Validation
HTML5 Editing ValidationHTML5 Editing Validation
HTML5 Editing Validation
 
Documentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO SchematronDocumentation Quality Assurance with ISO Schematron
Documentation Quality Assurance with ISO Schematron
 
Introduction to Schematron
Introduction to SchematronIntroduction to Schematron
Introduction to Schematron
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
 
JSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and ConvertJSON Edit, Validate, Query, Transform, and Convert
JSON Edit, Validate, Query, Transform, and Convert
 
The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019The Power Of Schematron Quick Fixes - XML Prague 2019
The Power Of Schematron Quick Fixes - XML Prague 2019
 
Collaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation ProcessCollaboration Tools to Help Improve Documentation Process
Collaboration Tools to Help Improve Documentation Process
 
Schematron step-by-step
Schematron step-by-stepSchematron step-by-step
Schematron step-by-step
 
Comparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual ModeComparing and Merging XML Documents in Visual Mode
Comparing and Merging XML Documents in Visual Mode
 

Recently uploaded

Introduction_to_Security_Assessments.ppt
Introduction_to_Security_Assessments.pptIntroduction_to_Security_Assessments.ppt
Introduction_to_Security_Assessments.ppt
sudsdeep
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
sheqnetworkmarketing
 
The Ultimate Guide to Phone Spy Apps: Everything You Need to Know
The Ultimate Guide to Phone Spy Apps: Everything You Need to KnowThe Ultimate Guide to Phone Spy Apps: Everything You Need to Know
The Ultimate Guide to Phone Spy Apps: Everything You Need to Know
onemonitarsoftware
 
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
aslasdfmkhan4750
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
neshakor5152
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
sofiafernandezon
 
Folding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a seriesFolding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a series
Philip Schwarz
 
Il Data Streaming per un’AI real-time di nuova generazione
Il Data Streaming per un’AI real-time di nuova generazioneIl Data Streaming per un’AI real-time di nuova generazione
Il Data Streaming per un’AI real-time di nuova generazione
confluent
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
jealousviolet
 
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
Srinivas Dukka
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
Task Tracker
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
ThousandEyes
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
shivamt017
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
miso_uam
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS Construction ERP Software
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
SimonedeGijt
 
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
josephinedrea942
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
kalichargn70th171
 
Leading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptxLeading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptx
taskroupseo
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
908dutch
 

Recently uploaded (20)

Introduction_to_Security_Assessments.ppt
Introduction_to_Security_Assessments.pptIntroduction_to_Security_Assessments.ppt
Introduction_to_Security_Assessments.ppt
 
Safe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work PermitsSafe Work Permit Management Software for Hot Work Permits
Safe Work Permit Management Software for Hot Work Permits
 
The Ultimate Guide to Phone Spy Apps: Everything You Need to Know
The Ultimate Guide to Phone Spy Apps: Everything You Need to KnowThe Ultimate Guide to Phone Spy Apps: Everything You Need to Know
The Ultimate Guide to Phone Spy Apps: Everything You Need to Know
 
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
Independent Girls Call ServiCe Hyderabad 0000000000 Tanisha Best High Class H...
 
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in CityGirls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
Girls Call Mysore 000XX00000 Provide Best And Top Girl Service And No1 in City
 
ENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentationENISA Threat Landscape 2023 documentation
ENISA Threat Landscape 2023 documentation
 
Folding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a seriesFolding Cheat Sheet #7 - seventh in a series
Folding Cheat Sheet #7 - seventh in a series
 
Il Data Streaming per un’AI real-time di nuova generazione
Il Data Streaming per un’AI real-time di nuova generazioneIl Data Streaming per un’AI real-time di nuova generazione
Il Data Streaming per un’AI real-time di nuova generazione
 
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
VVIP Girls Call Mumbai 9910780858 Provide Best And Top Girl Service And No1 i...
 
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
AWS DevOps-Tutorial CHANAKYA SRIYAN DUKKA.
 
Attendance Tracking From Paper To Digital
Attendance Tracking From Paper To DigitalAttendance Tracking From Paper To Digital
Attendance Tracking From Paper To Digital
 
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
Cisco Live Announcements: New ThousandEyes Release Highlights - July 2024
 
Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.Shivam Pandit working on Php Web Developer.
Shivam Pandit working on Php Web Developer.
 
Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)Software development... for all? (keynote at ICSOFT'2024)
Software development... for all? (keynote at ICSOFT'2024)
 
NYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction InnovationNYGGS 360: A Complete ERP for Construction Innovation
NYGGS 360: A Complete ERP for Construction Innovation
 
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptxWired_2.0_Create_AmsterdamJUG_09072024.pptx
Wired_2.0_Create_AmsterdamJUG_09072024.pptx
 
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
HIRE A HACKER FOR CHEATING HUSBAND/WIFE)
 
11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf11 Top Cross Browser Testing Tools to Know About.pdf
11 Top Cross Browser Testing Tools to Know About.pdf
 
Leading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptxLeading Project Management Tool Taskruop.pptx
Leading Project Management Tool Taskruop.pptx
 
Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …Prada Group Reports Strong Growth in First Quarter …
Prada Group Reports Strong Growth in First Quarter …
 

Artificia Intellicence and XPath Extension Functions

  • 1. XPath AI Extension Functions © 2024 Syncro Soft SRL. All rights reserved Octavian Nadolu, Syncro Soft octavian_nadolu@oxygenxml.com @OctavianNadolu
  • 2. XPath AI Extension Functions XPath AI Extension Functions Transform Content Using AI ● Examples: – Make the text easy to read and understand – Correct spelling and grammar – Rephrase to use active voice – Rephrase to have 20 words – Rephrase paragraph to answer to the following question – Translate content
  • 3. XPath AI Extension Functions XPath AI Extension Functions Generate Content Using AI ● Examples: – Generate a template file – Add missing cells from table – Generate content based on a schema – Generate documentation for code – Explain current code
  • 4. XPath AI Extension Functions XPath AI Extension Functions Verify Content Using AI Examples of verification with AI: – Is the text easy to read and understand? – Is spelling and grammar correct? – Is active/passive voice used in the description? – Is this written according to the style guide? – Does the topic answers to this <question>?
  • 5. XPath AI Extension Functions XPath AI Extension Functions XPath AI Extension Functions ● Call AI engine API using an XPath extension function ● Implementation can differ depending on the AI model you are using ● Extension functions ● Transform the content using an instruction from the user, return the generated content xs:string ai:transform-content(xs:string instruction, xs:string content) ● Verify the content using an instruction from the user, return true or false xs:boolean ai:verify-content(xs:string instruction, xs:string content)
  • 6. XPath AI Extension Functions XPath AI Extension Functions Transform Content Function ● Function provides a specific built-in prompt ● User specifies the instruction and the content to be transformed ai:transform-content(instruction, content) The function has the string parameters: – instruction - The instruction to be performed on the content. – content - The content to be transformed. – It returns a string that represents the transformed content. “You are a developer and you need perform the following task:“ + Rephrase to use active voice + content
  • 7. XPath AI Extension Functions XPath AI Extension Functions Verify Content Function ● Function can provide a specific built-in prompt ● User can specify the instruction and the content to be verified ai:verify-content(instruction, content) The function has the string parameters: – instruction - The OpenAI instruction to be performed on the content. – content - The content to be verified. – It returns a boolean value that represents the result of the verification. “You are a technical writer and you need to verify the following and respond with true or false:“ + Is active voice used in the description? + content
  • 8. XPath AI Extension Functions XPath AI Extension Functions Transform Content Function+ ● Provide a more detailed context using (user, agent) pairs ai:transform-content(instruction, (user, agent)*, content) “Act as a technical writer and perform the following task:“ + Rephrase to use active voice. Choose the best variant based to the strong points + (Rephrase and provide 3 variants + agentResult) + (Provide the strong points for each variant + agentResult) + content
  • 9. XPath AI Extension Functions XPath AI Extension Functions Verify Content Function+ ● Provide a more detailed context using (user, agent) pairs ● ai:verify-content(instruction, (user, agent)*, content) ● “You are a technical writer and you need to verify the following and respond with true or false:“ + Is active voice used in the description? + (user + agent) + (user + agent) + content
  • 10. XPath AI Extension Functions XPath AI Extension Functions Examples of using AI XPath Functions
  • 11. XPath AI Extension Functions XPath AI Extension Functions AI functions in Schematron and SQF ● Schematron - verify document content automatically using AI ● SQF - correct problems in document using AI
  • 12. XPath AI Extension Functions XPath AI Extension Functions Verify content using Schematron ● Example of a rule that checks if the text uses active voice In the description we should use active voice
  • 13. XPath AI Extension Functions XPath AI Extension Functions Check the text voice ● Rule that verifies if the text voice is active <sch:rule context="shortdesc"> <sch:assert test="ai:verify-content('Is active voice used?', .)"> In the description we should use active voice.</sch:assert> </sch:rule>
  • 14. XPath AI Extension Functions XPath AI Extension Functions Correct the text voice ● Example fix that reformulates the text to use active voice Reformulate the text to use active voice
  • 15. XPath AI Extension Functions XPath AI Extension Functions Correct the text voice ● SQF fix that that reformulates the text to use active voice <sqf:fix id="rephrase"> <sqf:description> <sqf:title>Reformulate the text to use active voice</sqf:title> </sqf:description> <sqf:replace match="text()" select="ai:transform-content(' Reformulate to use active voice', .)"/> </sqf:fix>
  • 16. XPath AI Extension Functions XPath AI Extension Functions Check technical terms ● Example of a rule that checks if the technical terms are not explained adequately The text uses WIFI term that is not explained adequately
  • 17. XPath AI Extension Functions XPath AI Extension Functions Specify how to reformulate the phrase Correct terms ● Example fix that allows the user to specify how to reformulate the phrase
  • 18. XPath AI Extension Functions XPath AI Extension Functions Correct terms ● SQF fix that allows the user to specify the prompt that will be sent to the AI <sqf:fix id="reformulateUser"> <sqf:description> <sqf:title>Specify how to reformulate the phrase</sqf:title> </sqf:description> <sqf:user-entry name="userInput" default="' Reformulate phrase and replace the ambiguous terms with a more accurate one'"> <sqf:description><sqf:title>How to correct:</sqf:title>sqf:description> </sqf:user-entry> <sqf:replace match="text()" select="ai:transform-content($userInput, .)"/> </sqf:fix>
  • 19. XPath AI Extension Functions XPath AI Extension Functions AI functions in XSL and XQuery ● Transform content using AI ● Create refactoring actions based on AI
  • 20. XPath AI Extension Functions XPath AI Extension Functions Refactor content using XSL and AI • Rephrase the short description element content to have less than 30 words <xsl:template match="shortdesc[count(tokenize(.,'s+')) > 30]"> <shortdesc> <xsl:value-of select="ai:transform-content('Rephrase this in less than 30 words:', .)"/> </shortdesc> </xsl:template>
  • 21. XPath AI Extension Functions XPath AI Extension Functions Refactor content using XSL and AI • Rephrase the short description element content to have less than 30 words <xsl:template match="image[@keyref][not(alt)]"> <xsl:copy> <xsl:apply-templates select="@*"/> <alt> <xsl:value-of select=" ai:transform-content( 'Create a short alternate text description for this image:', concat('${attach(', ditaaccess:getKeyRefAbsoluteReference(@keyref, base-uri()), ')}'))" /> </alt> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template>
  • 22. XPath AI Extension Functions XPath AI Extension Functions Refactor content using XSL and AI • Translate text to French <xsl:template match="text()"> <xsl:value-of select="ai:transform-content('Act as a translation specialist. Translate following content to French:', text())"/> </xsl:template>
  • 23. XPath AI Extension Functions XPath AI Extension Functions Refactor content using XSL and AI • Translate text to French and Verify <xsl:template match="text()"> <xsl:variable name="agentFrench" select="ai:transform-content('Translate to French in 3 variants ', .)"/> <xsl:variable name="agentEnglish" select="ai:transform-content('Translate content from French to English ', $agentFrench)"/> <xsl:value-of select="ai:transform-content('Compare the English translation with original content and use the correct French translation. ', 'Translate to french in 3 variants ', $agentFrench, 'Translate from french to english ', $agentEnglish, .)"/> </xsl:template>
  • 24. XPath AI Extension Functions XPath AI Extension Functions Conclusion ● AI can be used to generate and transform content ● Use XPath AI functions to automate the process ● Use AI in Schematron and SQF to verify and correct content ● Use AI in XSL and XQuery to transform and refactor content ● Always check the AI response
  • 25. XPath AI Extension Functions XPath AI Extension Functions Resources ● oxygenxml.com/doc/ug-editor/topics/ai_positron.html ● blog.oxygenxml.com/topics/ai_positron.html ● https://github.com/f/awesome-chatgpt-prompts ● https://platform.openai.com/docs/guides/chat
  • 26. Questions? Octavian Nadolu Project Manager at Syncro Soft octavian.nadolu@oxygenxml.com Twitter: @OctavianNadolu LinkedIn: octaviannadolu