[vc_row][vc_column width=”1/6″][/vc_column][vc_column width=”2/3″][vc_text_separator title=”Marketplace Product” css=”.vc_custom_1556216295263{padding-top: 5px !important;}”][vc_column_text]In the fast-paced world of technology, conversational AI has emerged as a powerful tool to engage with users, provide support, and automate various processes. OpenAI’s ChatGPT has been at the forefront of this revolution, showcasing its remarkable language capabilities and natural conversation flow.
Now, taking it a step further, we are thrilled to unveil the OpenAI API Service – an innovative API service that puts the power of ChatGPT directly into the hands of developers, enabling you to programmatically interact with this cutting-edge language model.[/vc_column_text][vc_single_image image=”22503″ img_size=”800×450″ alignment=”center”][/vc_column][vc_column width=”1/6″][/vc_column][/vc_row][vc_row][vc_column width=”1/6″][/vc_column][vc_column width=”2/3″][vc_column_text]
The OpenAI API service offers a seamless and structured approach to harnessing the capabilities of ChatGPT. It opens up exciting possibilities for you to integrate conversational AI into your applications, products, and services with ease. By providing a well-defined API, you can now interact with ChatGPT programmatically and unleash its full potential across various domains.
The core functionality of the OpenAI API service centers around creating dynamic ChatGPT sessions and conducting conversations through prompts. This allows you to simulate back-and-forths with the model, creating engaging dialogues in a user-friendly and interactive manner. The process is intuitive, and responses are generated with impressive fluency and coherence.
With the OpenAI API service, managing conversations is as simple as it gets. You can easily create, maintain, and extend dialogue sessions. Each session accumulates prompts and responses, transforming the interaction into a dynamic and evolving exchange. Retrieving the entire dialogue history, including prompts and model-generated responses, is effortlessly achievable through a dedicated method.
The potential use cases for the OpenAI API service are diverse and far-reaching. From building chatbots that provide personalized customer support to creating interactive virtual assistants that assist users in real-time, the possibilities are limited only by your imagination.
We invite developers from all domains to explore the OpenAI API service and unlock new dimensions of creativity. By integrating this powerful API into your projects, you can harness the full potential of ChatGPT and deliver unparalleled conversational experiences to your users.[/vc_column_text][vc_separator][vc_column_text]
[/vc_column_text][vc_separator][vc_column_text]
To utilize the service, begin by invoking the “createSession” method. This function establishes a session capable of storing prompts and ChatGPT responses. While creating the session, you have the option to customize the GPT model by specifying a preferred model name. Moreover, the method allows the inclusion of a boolean argument “persistInDB,” which, when set to “true,” saves the chat session messages in the database. By default, the argument value is “false,” ensuring messages are not persisted unless specified otherwise.
To interact with ChatGPT and receive responses, you can utilize the “sendMessage” method. This method requires two essential arguments:
Upon invoking the “sendMessage” method with the specified arguments, the response from ChatGPT will be automatically generated, added to the ongoing session dialogue, and returned by the method. This allows for a seamless and dynamic exchange with the language model, fostering an interactive and engaging conversational experience.
For developers seeking to access the complete message history of a specific session, the “getSessionMessages” method is available. This method necessitates a single argument, namely the “sessionId” that serves to uniquely identify the session of interest.
Upon successful invocation, the “getSessionMessages” method returns a structured data representation encompassing the following components:
By leveraging the “getSessionMessages” method, you can seamlessly retrieve and analyze the entire dialogue history of a session, enabling you to gain valuable insights and further enhance your conversational AI applications.[/vc_column_text][vc_separator][vc_column_text]
Method
POST
Endpoint URL
The xxxx.backendless.app
is a subdomain assigned to your application. For more information, see the Client-side Setup section of the Backendless documentation.
https://xxxx.backendless.app/api/services/OpenAI/session
Request Headers
Content-Type:application/json
Request Body
{ "aiModel":"value", "persistInDB": true or false }
Request Body Parameters
Response Body
{ "sessionId": "value" }
Response Body Parameters
Codeless Reference
The Codeless logic below creates a new ChatGPT session with the default model and memory-based persistence of the session’s messages:
[/vc_column_text][vc_separator][vc_column_text]
Method
POST
Endpoint URL
The xxxx.backendless.app
is a subdomain assigned to your application. For more information, see the Client-side Setup section of the Backendless documentation.
https://xxxx.backendless.app/api/services/OpenAI/message
Request Headers
Content-Type:application/json
Request Body
{ "message": "string", "sessionId": "string" }
Request Body Parameters
Response Body
{ "sessionId": "value", "responseMessage":"value" }
Response Body Parameters
Codeless Reference
The Codeless logic below sends a prompt to OpenAI and receives a response. For simplicity’s sake, it is assumed that the prompt is available through data binding via Page Data. The actual response is available through the responseMessage
property of the returned value.
[/vc_column_text][vc_separator][vc_column_text]
Method
GET
Endpoint URL
The xxxx.backendless.app
is a subdomain assigned to your application. For more information, see the Client-side Setup section of the Backendless documentation.
https://xxxx.backendless.app/api/services/OpenAI/session-messages?sessionId=value
Request URL Parameter
Request Headers
Content-Type:application/json
Request Body
N/A
Response Body
{ "messages": [ { "role": "user", "content": "prompt1" }, { "role": "assistant", "content": "response1" }, { "role": "user", "content": "prompt2" }, { "role": "assistant", "content": "response2" } ], "aiModel": "value", "id": "value", "persistInDB": true or false }
Sample response:
{ "messages": [ { "role": "user", "content": "Write a description for a product that can grind coffee beans and brew coffee" }, { "role": "assistant", "content": "Introducing the CoffeeGrind Brewmaster, your ultimate companion for indulging in freshly ground coffee right at home. This ingenious product seamlessly combines the functionalities of a coffee grinder and a coffee brewer, ensuring that every cup you brew is bursting with the rich aroma and robust flavors of freshly ground beans.\n\nThe CoffeeGrind Brewmaster boasts a powerful grinder, equipped with stainless steel blades that effortlessly crush coffee beans to perfection. With adjustable settings, you can easily customize the grind size, from coarse for a satisfying French press to fine for a meticulously brewed espresso. Say goodbye to the hassle of manually grinding beans or compromising on flavor with pre-ground coffee.\n\nOnce your coffee beans are ground to your desired texture, the CoffeeGrind Brewmaster seamlessly transitions into a state-of-the-art coffee brewer. Its advanced filtration system ensures that there are no impurities or residue in your cup, delivering a seamless brewing process every time. The brewer features a programmable timer, allowing you to wake up to the tantalizing aroma of freshly brewed coffee or relax with a perfectly brewed cup after a long day.\n\nDesigned with user-friendliness in mind, the CoffeeGrind Brewmaster boasts an intuitive LED control panel, where you can easily adjust settings, choose from various brewing options, and even monitor the water level to ensure an optimal brewing experience. Its sleek and modern design seamlessly complements any kitchen décor, making it an elegant addition to your countertop.\n\nSafety is also paramount, and the CoffeeGrind Brewmaster is equipped with automatic shut-off and overheating protection features, giving you peace of mind while enjoying your coffee. The removable parts are dishwasher safe, offering effortless cleaning and maintenance.\n\nIndulge in the incredible flavor and aroma of freshly ground coffee beans with the CoffeeGrind Brewmaster. Experience the true joy of having a professional-grade coffee grinder and brewer in one remarkable product. Elevate your coffee brewing experience to new heights and delight in perfect, aromatic cups of coffee every day." }, { "role": "user", "content": "What is the capital of India?" }, { "role": "assistant", "content": "The capital of India is New Delhi." } ], "aiModel": "gpt-3.5-turbo", "id": "258cd588-422b-4b7f-b705-d9132e9e1226", "persistInDB": false }
Response Body Parameters
Codeless Reference
The Codeless logic below retrieves a collection of messages for a session. The sessionMessagesData
is the complete response object which contains the messages property containing a collection of the actual prompts and responses.
[/vc_column_text][/vc_column][vc_column width=”1/6″][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]
[/vc_column_text][/vc_column][/vc_row]