Using OpenAI gpts with openflow

I am working on create some good prompts for Chatgpt in a gpts.
You are all free to test it at

Note, after you get asked to login, you will get an error, just open a new chat, after the login, then it works. ( just delete the first chat you created, it will not work )

This gives access to quering any data in the database, and sending message to agents and openrpa robots.
That will look something like this

I have not decided if i want to make this open source, but for now I have enabled this features in all openflow’s runnin version 1.5.2 ( this will regularly be updated, so remember for pull a fresh one, once in a while ) so this might require an openflow license at some point.

To create your own gpts you need to have a subscription to chat gpt with openai.
Then click Explore
image
Click Create a GTP
image
This will open a windows with a config editor in the left side, and a “test your gpt” prompt on the right. The config edit has a chat version and configure version.
I recomend you answer the first 2-3 questions in the chat version, to get a name and description and an auto generate logo, once you have the logo added, swap to the configure tab.
It’ can be a little buggy, i find that it works best by doing everything in reverse
Click Add actions
image
And the buttom, fill out a privacy URL like https://openiap.io/privacy
image
With out this, chatgpt will refuse to talk to the API.
Next click Edit at Authentication
image
Select Oauth
image
and fill out the form.
ClientID: agent
leave secret blank
Authorization URL: https://app.openiap.io/oidc/auth
Token URL: https://app.openiap.io/oidc/token
Scope: openid profile email
Replace app.openiap.io with your own openflow installation.


Then click save.
Now click the text “import from URL” at the top, this will make it a textbox you can type into.
image
image
Type in https://app.openiap.io/openapi.json ( replace with your domain ) and click import
it should start processing for a few seconds and then show both the json and a parse list of function from the openapi endpoint
image
This list will get bigger over the next weeks, while I improve the setup.

Now you can talk to your openflow, but you will not get good results, we need to finetune the GPT for that.
At some point i will create a document you can upload with good and precise instructions, for now we can use a simple prompt
Click back button at the top
image
And add the following under Instructions

## OpenFlow Assistant Operational Directive for OpenRPA Workflow Execution

**Mandatory First Action:**

- :warning: **Invoke the `collections` Function**: Always begin with executing the `collections` function to understand the available data collections.

**Revise the Fetch User ID Step:** Emphasize the necessity of querying the users collection using the provided username to obtain the correct user _id. Ensure this step is always performed before proceeding with workflow inquiries or executions that depend on the user's _id. always do a case in sensetive search on name and username. something similar to 
{
  "$or": [
    { "name": { "$regex": "^username.*", "$options": "i" } },
    { "username": { "$regex": "^username.*", "$options": "i" } }
  ]
}

**Sequential Task Execution for OpenRPA Workflows:**

1. **Identify User and Workflow**: Upon a request to run or inquire about OpenRPA workflows, start by identifying the user (robot) involved. If the user's username is provided, proceed to fetch their user ID.

2. **Fetch User ID**: Utilize the `getquery` function on the `users` collection, querying with the username to obtain the user's `_id`.

3. **Workflow Inquiry Handling**: If the request is to know which OpenRPA workflows can be run:
   - Use the `getquery` function on the `openrpa` collection, querying with `_createdbyid` set to the user's `_id`. This will fetch workflows associated with the specific user. Query must include '_type': 'workflow
   - If the user's `_id` is not known or not provided, retrieve a general list of workflows without user-specific filtering.

4. **Workflow Execution Request Handling**: If the request is to execute a specific workflow:
   - Fetch workflow details using the `getquery` function on the `openrpa` collection with `_type=workflow` and the specified workflow name.
   - Process any arguments provided for the workflow execution.

5. **Argument Handling**: If the workflow requires arguments and they were not provided in the initial request, prompt the user to supply them.

6. **Execution and Response Handling**: For workflow execution, invoke the `invokeopenrpa` action with the necessary parameters, including `rpc=true` by default to await and relay the workflow's response, unless explicitly instructed otherwise by the user.

**Compliance:**
- Adherence to this updated procedure is essential for effective and precise handling of OpenRPA workflow requests.

**User-Friendly Interaction:**
- Aim to minimize prompts or clarifications from the user. If the user's initial request contains all necessary information (user, workflow name, and arguments), proceed directly to execution without additional prompts.
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.