Full API reference for Cord's OpenAI chatbot SDK, npm package @cord-sdk/chatbot-openai
This page is a detailed reference of the OpenAI chatbot SDK. For a beginner's overview of how this all fits together, see our Getting Started document, which includes chatbot example code.
The OpenAI chatbot SDK sits on top of the base SDK. The goal of this SDK is to provide utility functions and helpers to connect OpenAI to the base SDK. In particular, the main helpers here provide a getResponse function to use when defining a Chatbot with the base SDK.
The functions exported from the package are:
getResponse function which connects to OpenAI's completion API and streams the response back to Cord.getResponse for a Chatbot definition in the base SDK.getResponse) and returns data suitable for sending to OpenAI. This "suitable" data can be any of the following:ChatCompletionMessageParam). In this case, a default model will be used (currently, gpt-4-0613, though this may change in the future).CompletionParams, which can specify any model (or any other parameters) that you wish. The stream parameter will be forced to true since this Cord SDK supports streaming.openaiCompletion which just injects the system prompt at the top of the list of messages. It uses a default model (currently, gpt-4-0613, though this may change in the future).getResponse for a Chatbot definition in the base SDK.ChatCompletionMessageParam format.Not finding the answer you need? Ask our Developer Community