openai-api-mock 0.1.33 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -4
- package/dist/index.cjs +163 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +163 -7
- package/dist/index.js.map +1 -1
- package/index.d.ts +24 -0
- package/package.json +7 -3
package/index.d.ts
CHANGED
|
@@ -12,6 +12,14 @@ export interface MockOptions {
|
|
|
12
12
|
* Logs incoming requests to console for debugging
|
|
13
13
|
*/
|
|
14
14
|
logRequests?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Seed value for consistent/deterministic responses
|
|
17
|
+
*/
|
|
18
|
+
seed?: number | string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to use predefined fixed response templates
|
|
21
|
+
*/
|
|
22
|
+
useFixedResponses?: boolean;
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
export interface MockControl {
|
|
@@ -23,6 +31,22 @@ export interface MockControl {
|
|
|
23
31
|
* Stops all active mocks
|
|
24
32
|
*/
|
|
25
33
|
stopMocking: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Resets the faker seed to ensure consistent outputs for subsequent requests
|
|
36
|
+
*/
|
|
37
|
+
setSeed: (seed: number | string) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Resets faker to use random values (removes deterministic behavior)
|
|
40
|
+
*/
|
|
41
|
+
resetSeed: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Get available response templates
|
|
44
|
+
*/
|
|
45
|
+
getResponseTemplates: () => Record<string, any>;
|
|
46
|
+
/**
|
|
47
|
+
* Create a custom response template
|
|
48
|
+
*/
|
|
49
|
+
createResponseTemplate: (templateType: string, overrides?: Record<string, any>) => Record<string, any>;
|
|
26
50
|
/**
|
|
27
51
|
* Adds a custom endpoint mock
|
|
28
52
|
* @param method - HTTP method (GET, POST, etc.)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openai-api-mock",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A Node.js module for mocking OpenAI API responses in a development environment",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A Node.js module for mocking OpenAI API responses in a development environment with consistency mechanisms for deterministic testing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/chihebnabil/openai-api-mock.git"
|
|
@@ -21,7 +21,11 @@
|
|
|
21
21
|
"mocking",
|
|
22
22
|
"ai",
|
|
23
23
|
"artificial intelligence",
|
|
24
|
-
"machine learning"
|
|
24
|
+
"machine learning",
|
|
25
|
+
"deterministic",
|
|
26
|
+
"consistency",
|
|
27
|
+
"seeding",
|
|
28
|
+
"templates"
|
|
25
29
|
],
|
|
26
30
|
"scripts": {
|
|
27
31
|
"build": "vite build",
|