OPEN AI - ASSISTANTS WITH STREAMING
==================================
ELEMENT DESCRIPTION
----------------------------------
OPEN AI - ASSISTANT STREAMING provides streaming capabilities to your assistants.
STEP-BY-STEP SETUP
--------------------------------
0) Register on OpenAI and get your OPEN AI API KEY.
1) Register on plugins.wiseable.io. Create a new Credential which associates your BUBBLE APP URL and your OPENAI AI KEY.
The registration service will generate your PUBLIC ACCESS KEY. This key serves as a secure proxy for your real API key. It allows your application to communicate with the service without exposing your real API key. Since this PUBLIC ACCESS KEY is explicitly tied to your registered BUBBLE APP URL, it can only be used from that domain, ensuring that even if the key is publicly visible, it remains safe and cannot be misused by unauthorized sources.
2) In the Plugin Settings, enter your PUBLIC ACCESS KEY generated at the previous step.
3) Add the OPEN AI - ASSISTANT STREAMING to the page on which the chat must be integrated
4) Add an element supporting input text for the use prompt
5) Create a Repeating Group with the "GET THREAD MESSAGES BODY DATA (OPENAI)" data type to display the conversation. Make sure in the data source to use the OPENAI - GET THREAD MESSAGES API with a TIME dynamic field which will trigger the refresh at the desired moment, typically once the user has send its request This data source will be merged with the OPEN AI - ASSISTANT STREAMING element to ensure streaming.
6) Integrate the logic into your application using the following OPEN AI - ASSISTANT STREAMING element's states and actions:
FIELDS :
- RESULT TYPE : Must always be "GET THREAD MESSAGES BODY DATA (OPENAI)".
EVENTS :
- ERROR : Event triggered when an error occurs.
- STREAMING STARTED : Event triggered when the streaming starts.
- STREAMING ENDED : Event triggered when the streaming ends.
- CALL FUNCTION : Event triggered when a function triggers, as defined in FUNCTIONS of SEND USER PROMPT action.
EXPOSED STATES:
Use any element able to show/process the data of interest (such as a Group with a Text field) stored within the result of the following states of the OPEN AI - ASSISTANT STREAMING :
- ERROR : Error message upon Error event trigger.
- IS STREAMING : Returns true when streaming is in progress.
- STREAMED RESPONSE : List of the messages of the current Thread ID along with the RUN ID.
- FUNCTION NAME : Name of the function, set upon CALL FUNCTION event.
- FUNCTION ARGUMENTS : Arguments of the function, set upon CALL FUNCTION event.
- FUNCTION TOOL ID : Tool ID of the called function from FUNCTION TOOL ID state of the element, which is set upon set upon CALL FUNCTION event.
- FUNCTION RUN ID : Run ID of the called function from FUNCTION RUN ID state of the element, which is set upon set upon CALL FUNCTION event.
- FUNCTION THREAD ID : Thread ID of the called function from FUNCTION THREAD ID state of the element, which is set upon set upon CALL FUNCTION event.
- LATEST PROMPT TOKEN USAGE : Latest prompt token usage, triggered upon STREAMING ENDED event.
- LATEST COMPLETION TOKEN USAGE : Latest completion token usage, triggered upon STREAMING ENDED event.
ELEMENT ACTIONS - TRIGGERED IN WORKFLOW:
- RUN ASSISTANT : Run Assistant on the specified assistant and thread.
Inputs Fields :
- ASSISTANT ID : The ID of the assistant to use to execute this run.
- THREAD ID : The ID of the thread to run.
- ADDITIONAL INSTRUCTIONS : Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions.
- SEND FUNCTION RESULT : Send the function results. See
https://platform.openai.com/docs/api-reference/runs/submitToolOutputs Inputs Fields :
- FUNCTION THREAD ID : Thread ID of the called function from FUNCTION THREAD ID state of the element, which is set upon set upon CALL FUNCTION event.
- FUNCTION TOOL ID : Tool ID of the called function from FUNCTION TOOL ID state of the element, which is set upon set upon CALL FUNCTION event.
- FUNCTION RUN ID : Run ID of the called function from FUNCTION RUN ID state of the element, which is set upon set upon CALL FUNCTION event.
- FUNCTION RESULT : Result of the function to pass.
6) (Optional) Add the OPENAI - MARKDOWN & LATEX PARSER element to display markdown formatting
FIELDS:
- MARKDOWN INPUT : Input formatted as Markdown Text.
- CSS STYLING : CSS styling to applyt to rendered HTML output.
- CODE THEME NAME : Highlight.js theme name to style the highlighted code blocks. See
https://highlightjs.org/examples EVENTS :
- CODE COPIED : Event triggered when code is copied from the element.
EXPOSED STATES:
- HTML : Outputs the input formatted as HTML code.
IMPLEMENTATION EXAMPLE
======================
Feel free to browse the app editor in the Service URL for an implementation example.
TROUBLESHOOTING
================
Any plugin related error will be posted to the the Logs tab, "Server logs" section of your App Editor.
Make sure that "Plugin server side output" and "Plugin server side output" is selected in "Show Advanced".
> Server Logs Details:
https://manual.bubble.io/core-resources/bubbles-interface/logs-tab#server-logsPERFORMANCE CONSIDERATIONS
===========================
N/A
QUESTIONS ?
===========
Contact us at
[email protected] for any additional feature you would require or support question.