Insertion Location and External APIs

Post here questions and problems related to bundled or custom AI actions, connectors and in general configuring and working with the AI Positron Assistant add-ons.
Ali-a
Posts: 7
Joined: Tue May 05, 2020 7:34 am

Insertion Location and External APIs

Post by Ali-a »

Hello,

I've created a prompt and custom action that scans a DITA XML file for revisions and summarizes them inside a <briefing></briefing> tag. The summarization works well, but I'm having trouble with tag placement. I want the <briefing> tag inserted right after </prolog>, but despite various prompt tweaks, it defaults to the cursor location.

In the chat interface, the output usually appears where the cursor is prior to hitting send. When invoking the custom action, it often replaces the entire document, even when the prompt clearly says to preserve the existing content and only insert the new part. Has anyone been able to control XML tag placement reliably using either the chat interface or custom actions? For reference, I’ll share the custom action JSON here. However, the associated prompt Markdown file contains some sensitive content, so I’m not able to post it publicly. I’m happy to share it individually with anyone who’s actively helping or has relevant experience.

Code: Select all

{
  "id": "custom.create.briefing",
  "title": "Create briefing",
  "type": "replace-selection-with-fragment",
  "input-type": "markup",
  "prompt_ref": "create-briefing.md",
  "parameters": {
        "function_refs": [
            {
                "ref": "get_current_document_marked_up_content"
            }
        ]
    },
   "additional_info": {
      "input_content": "document",
      "input_flavor": "line_numbers"
    },
  "embed-assist": true
}
Unrelated, I'm also looking into whether a prompt or custom action can call an external REST API. For example, retrieving a file status and injecting that value into the output. Would it make more sense to handle that through Azure OpenAI with Prompt Flow making the API call and returning the value to Positron? Appreciate any tips or examples if you've tried something similar.

Additional Details:
XML Author 26.1, build 2024091606
Oxygen AI Positron Assistant Enterprise v5.0.0
Azure OpenAI 4o model

Thanks,
Ahmed Ali
Radu
Posts: 9467
Joined: Fri Jul 09, 2004 5:18 pm

Re: Insertion Location and External APIs

Post by Radu »

Hello Ahmed,
Sorry for not providing enough documentation for creating custom AI actions, we will work on doing this in a future AI Positron release.
I just created a sample AI action here which updates the title of a DITA XML topic based on the contents and then either replaces or inserts a new title in a specified location, hope this helps:
https://github.com/oxygenxml-incubator/ ... title.json

About this other question:
Unrelated, I'm also looking into whether a prompt or custom action can call an external REST API. For example, retrieving a file status and injecting that value into the output. Would it make more sense to handle that through Azure OpenAI with Prompt Flow making the API call and returning the value to Positron?
We have this specific AI function "get_content_for_document_url" which could be used:
https://www.oxygenxml.com/doc/ug-addons ... _s3f_y2c12

I created a sample AI action for you:
https://github.com/oxygenxml-incubator/ ... bsite.json
In order for it to work, in the Preferences=>"Plugins / Oxygen AI Positron Assistant Enterprise / Functions & RAG" page you will need to change the "Limit read/write access to" setting to be something like: ${pdu}, ${rootMapDirURL}, https://

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9467
Joined: Fri Jul 09, 2004 5:18 pm

Re: Insertion Location and External APIs

Post by Radu »

Hi,

As an update I created recently two blog posts which might help people create custom AI actions and also setting up a context prompt specific for an organization:

(1) An article about customizing the AI Positron to fit your company rules (terminology, style guide, maybe custom DITA XML vocavulary):

https://blog.oxygenxml.com/topics/custo ... oject.html

(2) An article I just finished about creating custom AI actions and what parameters can be configured:

https://blog.oxygenxml.com/topics/creat ... dd_on.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply