@lowdefy/connection-ai-gateway 6.1.0 → 7.0.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.
@@ -12,20 +12,38 @@
12
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
- */ import { createGenerateObject, createGenerateText } from '@lowdefy/ai-utils';
15
+ */ import { createDecide, createGenerateObject, createGenerateText } from '@lowdefy/ai-utils';
16
16
  import createProvider from './createProvider.js';
17
17
  import schema from './schema.js';
18
+ // maxOutputTokens and timeout are defaults for the agents on this connection; the
19
+ // request resolvers read them from the connection properties.
18
20
  function create({ connection }) {
21
+ const { maxOutputTokens, timeout } = connection ?? {};
19
22
  return {
20
23
  provider: createProvider({
21
24
  connection
22
- })
25
+ }),
26
+ maxOutputTokens,
27
+ timeout
23
28
  };
24
29
  }
25
30
  const AIGateway = {
26
31
  schema,
32
+ // An outside service, not app data: a journey on a data set keeps its real target.
33
+ meta: {
34
+ dataSet: 'external'
35
+ },
27
36
  create,
28
37
  requests: {
38
+ // Evaluation models (TypeSafe's Jev) answer by default; any language model
39
+ // on the gateway can with backend: structured-output.
40
+ Decide: createDecide({
41
+ createProvider,
42
+ backends: [
43
+ 'evaluation',
44
+ 'structured-output'
45
+ ]
46
+ }),
29
47
  GenerateObject: createGenerateObject({
30
48
  createProvider
31
49
  }),
@@ -163,7 +163,7 @@
163
163
  },
164
164
  pageContext: {
165
165
  type: 'boolean',
166
- description: 'When true, prepend page context (pageId, userId, conversationId, urlQuery) to instructions.',
166
+ description: 'When true, prepend page context (pageId, userId, conversationId, urlQuery, pathParams) to instructions.',
167
167
  errorMessage: {
168
168
  type: 'AIGatewayAgent agent property "pageContext" should be a boolean.'
169
169
  }
@@ -40,6 +40,24 @@
40
40
  errorMessage: {
41
41
  type: 'AIGateway connection property "headers" should be an object of strings.'
42
42
  }
43
+ },
44
+ maxOutputTokens: {
45
+ type: 'integer',
46
+ minimum: 1,
47
+ description: 'Default maximum number of tokens a model call generates, for the requests and agents on this connection that do not set their own.',
48
+ errorMessage: {
49
+ type: 'AIGateway connection property "maxOutputTokens" should be an integer.',
50
+ minimum: 'AIGateway connection property "maxOutputTokens" should be at least 1.'
51
+ }
52
+ },
53
+ timeout: {
54
+ type: 'integer',
55
+ minimum: 1,
56
+ description: 'Default milliseconds a model call may take, retries included, before it is cancelled, for the requests and agents on this connection that do not set their own.',
57
+ errorMessage: {
58
+ type: 'AIGateway connection property "timeout" should be an integer.',
59
+ minimum: 'AIGateway connection property "timeout" should be at least 1.'
60
+ }
43
61
  }
44
62
  },
45
63
  errorMessage: {
package/dist/types.js CHANGED
@@ -16,10 +16,18 @@
16
16
  connections: [
17
17
  'AIGateway'
18
18
  ],
19
+ // Non-scopable: the tenant wall does not cover this type, so its
20
+ // connections are never scoped and accept no tenant: declaration.
21
+ connectionMetas: {
22
+ AIGateway: {
23
+ tenant: false
24
+ }
25
+ },
19
26
  agents: [
20
27
  'AIGatewayAgent'
21
28
  ],
22
29
  requests: [
30
+ 'Decide',
23
31
  'GenerateObject',
24
32
  'GenerateText'
25
33
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/connection-ai-gateway",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "homepage": "https://lowdefy.com",
@@ -27,6 +27,9 @@
27
27
  "url": "https://github.com/lowdefy/lowdefy.git"
28
28
  },
29
29
  "type": "module",
30
+ "sideEffects": [
31
+ "**/*.css"
32
+ ],
30
33
  "exports": {
31
34
  "./connections": "./dist/connections.js",
32
35
  "./agents": "./dist/agents.js",
@@ -36,12 +39,12 @@
36
39
  "dist/*"
37
40
  ],
38
41
  "dependencies": {
39
- "@ai-sdk/gateway": "3.0.111",
40
- "@lowdefy/ai-utils": "6.1.0"
42
+ "@ai-sdk/gateway": "4.0.94",
43
+ "@lowdefy/ai-utils": "7.0.0"
41
44
  },
42
45
  "devDependencies": {
43
46
  "@jest/globals": "28.1.3",
44
- "@lowdefy/ajv": "6.1.0",
47
+ "@lowdefy/ajv": "7.0.0",
45
48
  "@swc/cli": "0.8.1",
46
49
  "@swc/core": "1.15.32",
47
50
  "@swc/jest": "0.2.39",