1.0.5 • Published 9 months ago
openai-debugger v1.0.5
openai-debugger
Debug your client and server errors with OpenAI's API. Written in typescript, designed to be used as a dev dependency only.
Installation:
npm install -D openai-debugger
Methods
- errorHandlerNode(options)
- Handles errors in Node environments
- errorHandlerBrowser(options)
- Handles errors in Browser environment
Options Configuration
Options object is required, though most parameters are optional. See the official openAI API docs for more info
Option | Type | Description | Default |
---|---|---|---|
apiKey | string | Your OpenAI API key | - |
model | string | Model name | - |
temperature | number (optional) | Model temperature ranging from 0 to 2 | 0.2 |
top_p | number (optional) | Controls sampling | 1 |
n | number (optional) | Number of replies | 1 |
max_tokens | number (optional) | Maximum reply length | Infinity |
presence_penalty | number (optional) | Penalize repetition. Range 0-2 | 0 |
frequency_penalty | number (optional) | Penalize repetition. Range 0-2 | 0 |
Example Usage (Node)
import { errorHandlerNode, errorHandlerBrowser } from ('openai-debugger')
const optionsObj = {
apiKey: '...',
model: 'gpt-3.5-turbo',
temperature: 0.1,
};
errorHandlerNode(optionsObj)
Example Usage (Browser)
import { errorHandlerNode, errorHandlerBrowser } from ('openai-debugger')
const optionsObj = {
apiKey: '...',
model: 'gpt-3.5-turbo',
temperature: 0.1,
};
errorHandlerBrowser(optionsObj)