@cobrowser/chatgpt
v0.7.51
Published
chatgpt services to connect our projects with chatgpt api
Downloads
3,326
Readme
ChatGpt Lib
it is a list of services to use to work with ChatGPT API
Before working with the API make sure you have the `OPEN AI API KEY` in the env variables
it should be avaliable with process.env.OPEN_AI_API_KEYthe API key will be used to make authorization with the openAI APIs
OPEN_AI_API_KEY
process.env.OPEN_AI_API_KEY
Current Available Services
we will have a list of services to use for different purposes
CoPilotService
a service that can be used to make products recommendation and quick replies suggestion
Usage
to suggest some quick replies for a conversation
const { CopilotService } = require('@cobrowser/chatgpt');
const copilotService = new CopilotService();
const conversation = `
Customer: Hello
Agent: Hello
Customer: Need some help
`;
/**
* return a promise that will resolve a string ( a list of suggestions ) or an undefined or an error
*/
copilotService.suggest(conversation);
Translation Service
can be used to translate a text from one language to another
Usage
const { TranslationService } = require('@cobrowser/chatgpt');
const service = new TranslationService();
const translation = await service.translate('Text to Translate');translate(text: string, toLanguage = 'English', fromLanguage?: string)By Default if languages didn't specifed the default language to translate to will be English All services will have their API documentation (thanks to Typescript)
