This is a Node.js module for mocking OpenAI API responses in a development environment. It's useful for testing and development purposes when you don'

openai-api-mock - npm

submited by
Style Pass
2024-06-06 16:00:06

This is a Node.js module for mocking OpenAI API responses in a development environment. It's useful for testing and development purposes when you don't want to make actual API calls. The module also supports mocking function_calling

This function intercepts HTTP calls to the OpenAI endpoint and returns a mock response. The mock response is generated based on the requestBody of the code , and it supports complex (function call) requestBody structures like arrays and nested objects.

The force parameter is a boolean that determines whether the mock response should be used regardless of the environment. If force is true, the mock response will be used regardless of the environment. If force is false or not provided, the mock response will only be used if the NODE_ENV environment variable is set to 'development'.

Leave a Comment