1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 08:45:04 -05:00
xeps/inbox/xep-ai.xml

274 lines
13 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
<!ENTITY ns "urn:xmpp:ai:0">
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Communicate &amp; Ask to AI</title>
<abstract>This document defines a protocol for asking questions to an artificial intelligence or requesting it to make predictions.</abstract>
&LEGALNOTICE;
<number>xxxx</number>
<status>ProtoXEP</status>
<type>Standards Track</type>
<sig>Standards</sig>
<approver>Council</approver>
<dependencies>
<spec>XMPP Core</spec>
<spec>XEP-0001</spec>
<spec>Etc.</spec>
</dependencies>
<supersedes/>
<supersededby/>
<shortname>NOT_YET_ASSIGNED</shortname>
<tags>
<tag>template</tag>
</tags>
<author>
<firstname>Abdurrahman</firstname>
<surname>Eker</surname>
<email>abdurrahman.eker@detaysoft.com</email>
<jid>abdurrahman.eker@detaysoft.com</jid>
</author>
<revision>
<version>0.0.1</version>
<date>2023-03-13</date>
<initials>ae</initials>
<remark><p>First draft.</p></remark>
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<p>Using artificial intelligence can be useful for quickly finding documentation or for classification operations that would take a human a long time. This feature enables asking questions to an artificial intelligence and getting guidance from it. It allows fine-tuning the usage limits of the artificial intelligence, making detailed adjustments, and making custom settings for the user.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>When a question is asked to an artificial intelligence, it SHOULD:</p>
<ol>
<li>Be able to be asked questions and analyze them simultaneously.</li>
<li>Detect parameters and work with the relevant artificial intelligence engine.</li>
<li>Review the limits and permissions of the requester and provide a rejection response if they are not sufficient.</li>
</ol>
</section1>
<section1 topic='Discovery Support' anchor='discovery'>
<p>If the client is implementing artificial intelligence messages, it MUST provide the 'urn:xmpp:ai:0' feature in the features section as specified in &xep0030; and &xep0115;.</p>
<example caption='Client queries for server features'><![CDATA[
<iq from='romeo@montague.net/orchard'
id='disco1'
to='juliet@capulet.lit'
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption='Server responds with features'><![CDATA[
<iq to='romeo@montague.net/orchard'
id='disco1'
from='juliet@capulet.lit'
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
<feature var='urn:xmpp:ai:0'/>
</query>
</iq>
]]></example>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
<section2 topic='Asking to ai a question' anchor='asking-ai'>
<p>To ask a question to an artificial intelligence, the <strong>message</strong> package SHOULD be used. This way, the conversation with the artificial intelligence can be recorded and viewed in the message history. The <strong>&lt;ai&gt;</strong> element MUST be present in the message package, MUST be qualified with the 'urn:xmpp:ai:0' domain, and the <strong>model</strong> attribute value MUST be entered.</p>
<example caption='A user is asking a question to an artificial intelligence'><![CDATA[
<message id='1' from='romeo@montague.lit' to='ai@example.com' type='chat'>
<body>Is love a tender thing?</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'/>
</message>
]]></example>
<example caption='The artificial intelligence responds to the user'><![CDATA[
<message id='2' from='ai@example.com' to='romeo@montague.lit' type='chat'>
<body>
Yes, love can be a tender thing. Love is a complex and multi-faceted emotion that can
manifest in many different ways, but at its core, it often involves a deep feeling of
affection, care, and tenderness towards another person.
</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'/>
</message>
]]></example>
</section2>
<section2 topic='Asking to ai with model specific parameters'>
<p>If an AI model needs to be supported with specific parameters, &xep0004; can be used. It should be defined within the &lt;message&gt; element with the 'jabber:x:data' namespace.</p>
<example caption='The user sends custom parameters to the AI for a short response.'><![CDATA[
<message id='3' from='romeo@montague.lit' to='ai@example.com' type='chat'>
<body>Is love a tender thing?</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'/>
<x xmlns='jabber:x:data' type='submit'>
<field type='hidden' var='FORM_TYPE'>
<value>urn:xmpp:ai:0</value>
</field>
<field var='max_word' type='text-single'>
<value>10</value>
</field>
</x>
</message>
]]></example>
<example caption='The AI returns a specific result to the user based on the parameters sent.'><![CDATA[
<message id='4' from='ai@example.com' to='romeo@montague.lit' type='chat'>
<body>Yes, love can be a tender thing.</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'/>
<x xmlns='jabber:x:data' type='result'>
<field type='hidden' var='FORM_TYPE'>
<value>urn:xmpp:ai:0</value>
</field>
<field var='max_word' type='text-single'>
<value>10</value>
</field>
</x>
</message>
]]></example>
</section2>
<section2 topic='Asking artificial intelligence to make predictions based on a past conversation'>
<p>The desired speech must be sent to the artificial intelligence to estimate the next message. To predict the next message, the past conversation MUST be sent to the AI using the <strong>&lt;suggest&gt;</strong> element inside the <strong>&lt;ai&gt;</strong> element, along with the message archive history &xep0313;.</p>
<example caption='The user sends local messages to AI for a suggestion.'><![CDATA[
<message id='5' from='romeo@montague.lit' to='ai@example.com' type='chat'>
<body>What should I say?</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'>
<suggest xmlns='urn:xmpp:ai:0'>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>
<message xmlns='jabber:client' from='juliet@capulet.lit' to='romeo@montague.lit'>
<body>Romeo!</body>
</message>
</forwarded>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:28Z'/>
<message xmlns='jabber:client' from='romeo@montague.lit' to='juliet@capulet.lit'>
<body>My dear?</body>
</message>
</forwarded>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:30Z'/>
<message xmlns='jabber:client' from='juliet@capulet.lit' to='romeo@montague.lit'>
<body>
At what o'clock to-morrow
Shall I send to thee?
</body>
</message>
</forwarded>
</suggest>
</ai>
</message>
]]></example>
<example caption='The AI returns a suggestion'><![CDATA[
<message id='6' from='ai@example.com' to='romeo@montague.lit' type='chat'>
<body>At the hour of nine.</body>
<ai xmlns='urn:xmpp:ai:0' model='http://example.ai/model-capulet'>
<suggest xmlns='urn:xmpp:ai:0'>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:25Z'/>
<message xmlns='jabber:client' from='juliet@capulet.lit' to='romeo@montague.lit'>
<body>Romeo!</body>
</message>
</forwarded>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:28Z'/>
<message xmlns='jabber:client' from='romeo@montague.lit' to='juliet@capulet.lit'>
<body>My dear?</body>
</message>
</forwarded>
<forwarded xmlns='urn:xmpp:forward:0'>
<delay xmlns='urn:xmpp:delay' stamp='2010-07-10T23:08:30Z'/>
<message xmlns='jabber:client' from='juliet@capulet.lit' to='romeo@montague.lit'>
<body>
At what o'clock to-morrow
Shall I send to thee?
</body>
</message>
</forwarded>
</suggest>
</ai>
</message>
]]></example>
</section2>
</section1>
<section1 topic='Business Rules' anchor='rules'>
<section2 topic='General' anchor='rules-general'>
<ul>
<li>The artificial intelligence should only be used for lawful and ethical purposes, and in compliance with all applicable laws and regulations.</li>
<li>The use of the artificial intelligence should not violate the privacy rights of any individuals, and all data should be handled in accordance with privacy laws and policies.</li>
</ul>
</section2>
<section2 topic='User Interface' anchor='rules-ui'>
<ol>
<li>The messaging app should provide a clear indication that the suggested messages are generated by an AI service, and provide an option for the user to opt-out of the feature.</li>
<li>The suggested messages should be presented in a way that distinguishes them from the user's own messages, and allows the user to edit or customize them before sending.</li>
<li>The user interface should provide a way for the user to provide feedback on the suggested messages, such as rating them or reporting inappropriate suggestions.</li>
</ol>
</section2>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<p>There is no implementation to make the AI have a default setting and return a response from that setting.</p>
</section1>
<section1 topic='Accessibility Considerations' anchor='access'>
<p>The value returned by artificial intelligence consists entirely of text. Returned text can be accessed using voice-over technologies.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>Determining when an AI question can be executed based on permissions or rights is considered outside the scope of this document. Although such mechanisms are considered specific to the application and/or implementation of this document, future specifications may address these concerns.</p>
<p>When processing reported AI questions, the requester SHOULD consider any question node that does not match the JID of the responder to be suspicious, and ignore those AI questions nodes. Responders MUST report their own AI question nodes only, and not the AI question nodes of other entities. This can help prevent limited cases of spoofing and "social engineering".</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>This document requires no interaction with the &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<section2 topic='Protocol Namespaces' anchor='registrar-ns'>
<p>This specification defines the following XML namespace:</p>
<ul>
<li>urn:xmpp:ai:0</li>
</ul>
<p>Upon advancement of this specification from a status of Experimental to a status of Draft, the &REGISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.</p>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
&NSVER;
</section2>
</section1>
<section1 topic='Design Considerations' anchor='design'>
<p>The results of artificial intelligence have not been put into any classification. In addition to the response it returns, &xep0004; can be used to specify which parameters it obtained this different result from.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>REQUIRED for protocol specifications.</p>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:ai:0'
xmlns='urn:xmpp:ai:0'
xmlns:forward='urn:xmpp:forward:0'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-xxxx: http://www.xmpp.org/extensions/xep-xxxx.html
</xs:documentation>
</xs:annotation>
<xs:import namespace='urn:xmpp:forward:0'
schemaLocation='http://xmpp.org/schemas/forward.xsd'/>
<xs:element name='ai'>
<xs:complexType>
<xs:sequence>
<xs:element name="suggest" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" ref="forward:forwarded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name='model' type='xs:string' use='required'/>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
</xep>