@things-factory/integration-openai 8.0.0-beta.0 → 8.0.0-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-openai",
3
- "version": "8.0.0-beta.0",
3
+ "version": "8.0.0-beta.2",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -23,9 +23,9 @@
23
23
  "clean": "npm run clean:server"
24
24
  },
25
25
  "dependencies": {
26
- "@things-factory/codelingua": "^8.0.0-beta.0",
27
- "@things-factory/integration-base": "^8.0.0-beta.0",
26
+ "@things-factory/codelingua": "^8.0.0-beta.2",
27
+ "@things-factory/integration-base": "^8.0.0-beta.2",
28
28
  "ses": "^1.5.0"
29
29
  },
30
- "gitHead": "add6fb8224b2cb19cbea47bed6a5ecb0424c9a28"
30
+ "gitHead": "f03431a09435511b2595515658f9cb8f78ba4ebb"
31
31
  }
@@ -1 +0,0 @@
1
- import './task'
@@ -1 +0,0 @@
1
- import './openai-completion'
@@ -1,54 +0,0 @@
1
- import { TaskRegistry } from '@things-factory/integration-base'
2
- import { chatCompletion } from '@things-factory/codelingua'
3
- import 'ses'
4
-
5
- async function OpenAICompletion(step, context) {
6
- var {
7
- params: { prompt }
8
- } = step
9
-
10
- var { domain, user, data, variables } = context
11
-
12
- // SES Compartment 설정
13
- const compartment = new Compartment({
14
- domain,
15
- user,
16
- data,
17
- variables,
18
- console
19
- })
20
-
21
- let evalPrompt
22
- try {
23
- evalPrompt = compartment.evaluate('`' + prompt + '`')
24
- } catch (err) {
25
- throw new Error(`Failed to evaluate prompt: ${err.message}`)
26
- }
27
-
28
- const completion = await chatCompletion({
29
- content: evalPrompt
30
- })
31
-
32
- return {
33
- data: completion
34
- }
35
- }
36
-
37
- OpenAICompletion.parameterSpec = [
38
- {
39
- type: 'textarea',
40
- name: 'prompt',
41
- label: 'prompt',
42
- property: {
43
- language: 'text',
44
- showLineNumbers: true
45
- },
46
- styles: {
47
- flex: '1'
48
- }
49
- }
50
- ]
51
- OpenAICompletion.help = 'integration/task/openai-completion'
52
- OpenAICompletion.connectorFree = true
53
-
54
- TaskRegistry.registerTaskHandler('openai-completion', OpenAICompletion)
package/server/index.ts DELETED
@@ -1 +0,0 @@
1
- import './engine'