@openfn/language-chatgpt 1.0.10 → 2.0.1

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/ast.json CHANGED
@@ -52,6 +52,59 @@
52
52
  ]
53
53
  },
54
54
  "valid": false
55
+ },
56
+ {
57
+ "name": "deepResearch",
58
+ "params": [
59
+ "message",
60
+ "opts"
61
+ ],
62
+ "docs": {
63
+ "description": "Prompt GPT deep research interface",
64
+ "tags": [
65
+ {
66
+ "title": "example",
67
+ "description": "deepResearch(\n `Evaluate if the following company qualifies as a sustainable fashion brand:\n\n INPUT: ${JSON.stringify($.data)}\n Return JSON only with:\n - sustainabilityStatus: \"Certified\", \"Likely\", or \"Unverified\"\n - materialsUsed\n - certifications\n - confidenceLevel (0–5)\n - researchNotes`,\n {\n model: 'o3-deep-research',\n max_tool_calls: 1\n }\n)"
68
+ },
69
+ {
70
+ "title": "public",
71
+ "description": null,
72
+ "type": null
73
+ },
74
+ {
75
+ "title": "function",
76
+ "description": null,
77
+ "name": null
78
+ },
79
+ {
80
+ "title": "param",
81
+ "description": "The prompt",
82
+ "type": {
83
+ "type": "NameExpression",
84
+ "name": "string"
85
+ },
86
+ "name": "message"
87
+ },
88
+ {
89
+ "title": "param",
90
+ "description": "Model, tools and other parameters (https://platform.openai.com/docs/guides/deep-research)",
91
+ "type": {
92
+ "type": "NameExpression",
93
+ "name": "DeepResearchOptions"
94
+ },
95
+ "name": "options"
96
+ },
97
+ {
98
+ "title": "returns",
99
+ "description": null,
100
+ "type": {
101
+ "type": "NameExpression",
102
+ "name": "operation"
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ "valid": false
55
108
  }
56
109
  ],
57
110
  "exports": [],
package/dist/index.cjs CHANGED
@@ -30,6 +30,7 @@ __export(src_exports, {
30
30
  dataPath: () => import_language_common2.dataPath,
31
31
  dataValue: () => import_language_common2.dataValue,
32
32
  dateFns: () => import_language_common2.dateFns,
33
+ deepResearch: () => deepResearch,
33
34
  default: () => src_default,
34
35
  each: () => import_language_common2.each,
35
36
  execute: () => execute,
@@ -52,6 +53,7 @@ __export(Adaptor_exports, {
52
53
  dataPath: () => import_language_common2.dataPath,
53
54
  dataValue: () => import_language_common2.dataValue,
54
55
  dateFns: () => import_language_common2.dateFns,
56
+ deepResearch: () => deepResearch,
55
57
  each: () => import_language_common2.each,
56
58
  execute: () => execute,
57
59
  field: () => import_language_common2.field,
@@ -102,11 +104,30 @@ function prompt(message, opts) {
102
104
  );
103
105
  const payload = {
104
106
  model: "o3-mini-2025-01-31",
105
- reasoning_effort: "low",
106
107
  messages: [{ role: "user", content: resolvedMessage }],
107
108
  ...resolvedOpts
108
109
  };
109
110
  const msg = await client.chat.completions.create(payload);
111
+ console.log("\u221A Prompt operation completed");
112
+ return (0, import_language_common.composeNextState)(state, msg);
113
+ };
114
+ }
115
+ function deepResearch(message, opts) {
116
+ return async (state) => {
117
+ const [resolvedMessage, resolvedOpts] = (0, import_util.expandReferences)(
118
+ state,
119
+ message,
120
+ opts
121
+ );
122
+ const payload = {
123
+ model: "o3-deep-research",
124
+ input: resolvedMessage,
125
+ tools: (resolvedOpts == null ? void 0 : resolvedOpts.tools) || [{ type: "web_search_preview" }],
126
+ ...resolvedOpts
127
+ };
128
+ console.log("Preparing deep search operation...");
129
+ const msg = await client.responses.create(payload);
130
+ console.log("\u221A Deep search operation completed");
110
131
  return (0, import_language_common.composeNextState)(state, msg);
111
132
  };
112
133
  }
@@ -120,6 +141,7 @@ var src_default = Adaptor_exports;
120
141
  dataPath,
121
142
  dataValue,
122
143
  dateFns,
144
+ deepResearch,
123
145
  each,
124
146
  execute,
125
147
  field,
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ __export(Adaptor_exports, {
12
12
  dataPath: () => dataPath,
13
13
  dataValue: () => dataValue,
14
14
  dateFns: () => dateFns,
15
+ deepResearch: () => deepResearch,
15
16
  each: () => each,
16
17
  execute: () => execute,
17
18
  field: () => field,
@@ -77,11 +78,30 @@ function prompt(message, opts) {
77
78
  );
78
79
  const payload = {
79
80
  model: "o3-mini-2025-01-31",
80
- reasoning_effort: "low",
81
81
  messages: [{ role: "user", content: resolvedMessage }],
82
82
  ...resolvedOpts
83
83
  };
84
84
  const msg = await client.chat.completions.create(payload);
85
+ console.log("\u221A Prompt operation completed");
86
+ return composeNextState(state, msg);
87
+ };
88
+ }
89
+ function deepResearch(message, opts) {
90
+ return async (state) => {
91
+ const [resolvedMessage, resolvedOpts] = expandReferences(
92
+ state,
93
+ message,
94
+ opts
95
+ );
96
+ const payload = {
97
+ model: "o3-deep-research",
98
+ input: resolvedMessage,
99
+ tools: (resolvedOpts == null ? void 0 : resolvedOpts.tools) || [{ type: "web_search_preview" }],
100
+ ...resolvedOpts
101
+ };
102
+ console.log("Preparing deep search operation...");
103
+ const msg = await client.responses.create(payload);
104
+ console.log("\u221A Deep search operation completed");
85
105
  return composeNextState(state, msg);
86
106
  };
87
107
  }
@@ -94,6 +114,7 @@ export {
94
114
  dataPath,
95
115
  dataValue,
96
116
  dateFns,
117
+ deepResearch,
97
118
  src_default as default,
98
119
  each,
99
120
  execute,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@openfn/language-chatgpt",
3
3
  "label": "ChatGPT",
4
- "version": "1.0.10",
5
- "description": "OpenFn chatgpt adaptor",
4
+ "version": "2.0.1",
5
+ "description": "OpenFn adaptor for ChatGPT",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
@@ -21,14 +21,14 @@
21
21
  "configuration-schema.json"
22
22
  ],
23
23
  "dependencies": {
24
- "openai": "^4.86.2",
24
+ "openai": "^4.104.0",
25
25
  "@openfn/language-common": "3.0.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "assertion-error": "2.0.0",
29
29
  "chai": "4.3.6",
30
30
  "deep-eql": "4.1.1",
31
- "mocha": "^10.7.3",
31
+ "mocha": "^10.8.2",
32
32
  "rimraf": "3.0.2",
33
33
  "undici": "^5.29.0"
34
34
  },
@@ -24,8 +24,37 @@ export function execute(...operations: any[]): operation;
24
24
  * @returns {operation}
25
25
  */
26
26
  export function prompt(message: string, opts: any): operation;
27
+ /**
28
+ * Prompt GPT deep research interface
29
+ * @example
30
+ * deepResearch(
31
+ * `Evaluate if the following company qualifies as a sustainable fashion brand:
32
+ *
33
+ * INPUT: ${JSON.stringify($.data)}
34
+ * Return JSON only with:
35
+ * - sustainabilityStatus: "Certified", "Likely", or "Unverified"
36
+ * - materialsUsed
37
+ * - certifications
38
+ * - confidenceLevel (0–5)
39
+ * - researchNotes`,
40
+ * {
41
+ * model: 'o3-deep-research',
42
+ * max_tool_calls: 1
43
+ * }
44
+ * )
45
+ * @public
46
+ * @function
47
+ * @param {string} message - The prompt
48
+ * @param {DeepResearchOptions} options - Model, tools and other parameters (https://platform.openai.com/docs/guides/deep-research)
49
+ * @returns {operation}
50
+ */
51
+ export function deepResearch(message: string, opts: any): operation;
27
52
  /**
28
53
  * Options provided to Chat Completions Create (https://platform.openai.com/docs/api-reference/chat/create)
29
54
  */
30
55
  export type PromptOptions = any;
56
+ /**
57
+ * Options provided to Chat Responses Create (https://platform.openai.com/docs/guides/deep-research)
58
+ */
59
+ export type DeepResearchOptions = any;
31
60
  export { dataPath, dataValue, dateFns, cursor, each, field, fields, fn, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";