SysOpenAI Package
No edit summary
Tag: 2017 source edit
(Added Edited template with July 12, 2025.)
 
Line 1: Line 1:
{{Edited|July|12|2025}}
SysOpenAI model pattern is a model for integrating OpenAI functionality into your application.
SysOpenAI model pattern is a model for integrating OpenAI functionality into your application.



Latest revision as of 06:35, 20 January 2025

SysOpenAI model pattern is a model for integrating OpenAI functionality into your application.

This model can be merged from TK Live View.

Open AI has a wide variety of use cases from processing data, analyzing data, searching through data and automating other tasks in information systems or apps.

SysOpenAI has three classes:

SysOpenAISingleton

This class points to the instance on azure where ChatGPT is deployed.

SysOpenAIChatSession

This class is for creating a new AI session and making requests to the AI instance.

SysOpenAIMessage

This class contains interactions between the AI and User.

SysOpenAI Pattern



Chat Roles are used to separate the different contexts of the interactions between the person and the AI,

#system - this role is used to give instructions to the AI. It helps to guide and structure the interactions between the user and the AI. This is the context the AI follows to yield responses.

#user - this role is for issuing tasks to the AI. This is the input from person interacting with the AI

#assistance - this role is for AI response. The AI uses the context set by the system role and user role to generate a reply.

Using SysOpenAI With OCL

-- new session to interact with AI
let sess=SysOpenAIChatSession.Create in
(
    let message1=SysOpenAIMessage.Create in
    (
        let message2=SysOpenAIMessage.Create in
        (
            -- instructions to AI
            message1.ChatRole:=#system;
            message1.Text:='<text string instruction on how AI should behave>';
            sess.SysOpenAIMessages.Add(message1);

            -- user input for issuing task
            message2.ChatRole:=#user;
            message2.Text:='<text string input from user>';
            sess.SysOpenAIMessages.Add(message2)

            sess.Generate;

            let response:=sess.SysOpenAIMessages->last in 
            (
                -- response from AI
                reponse.Text
            )
        )
    )
)

This page was edited 55 days ago on 01/20/2025. What links here