@botonic/plugin-ai-agents 0.36.0-alpha.6 → 0.36.0-alpha.8

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.
Files changed (109) hide show
  1. package/lib/cjs/constants.d.ts +1 -0
  2. package/lib/cjs/constants.js +2 -1
  3. package/lib/cjs/constants.js.map +1 -1
  4. package/lib/cjs/hubtype-api-client.d.ts +2 -0
  5. package/lib/cjs/hubtype-api-client.js +41 -2
  6. package/lib/cjs/hubtype-api-client.js.map +1 -1
  7. package/lib/cjs/index.d.ts +2 -2
  8. package/lib/cjs/index.js +22 -25
  9. package/lib/cjs/index.js.map +1 -1
  10. package/lib/cjs/runner.d.ts +10 -0
  11. package/lib/cjs/runner.js +75 -0
  12. package/lib/cjs/runner.js.map +1 -0
  13. package/lib/cjs/structured-output/carousel.d.ts +100 -0
  14. package/lib/cjs/structured-output/carousel.js +21 -0
  15. package/lib/cjs/structured-output/carousel.js.map +1 -0
  16. package/lib/cjs/structured-output/exit.d.ts +12 -0
  17. package/lib/cjs/structured-output/exit.js +11 -0
  18. package/lib/cjs/structured-output/exit.js.map +1 -0
  19. package/lib/cjs/structured-output/index.d.ts +198 -0
  20. package/lib/cjs/structured-output/index.js +14 -0
  21. package/lib/cjs/structured-output/index.js.map +1 -0
  22. package/lib/cjs/structured-output/shared.d.ts +3 -0
  23. package/lib/cjs/structured-output/shared.js +3 -0
  24. package/lib/cjs/structured-output/shared.js.map +1 -0
  25. package/lib/cjs/structured-output/text-with-buttons.d.ts +34 -0
  26. package/lib/cjs/structured-output/text-with-buttons.js +15 -0
  27. package/lib/cjs/structured-output/text-with-buttons.js.map +1 -0
  28. package/lib/cjs/structured-output/text.d.ts +28 -0
  29. package/lib/cjs/structured-output/text.js +13 -0
  30. package/lib/cjs/structured-output/text.js.map +1 -0
  31. package/lib/cjs/types.d.ts +6 -25
  32. package/lib/esm/constants.d.ts +1 -0
  33. package/lib/esm/constants.js +1 -0
  34. package/lib/esm/constants.js.map +1 -1
  35. package/lib/esm/hubtype-api-client.d.ts +2 -0
  36. package/lib/esm/hubtype-api-client.js +41 -2
  37. package/lib/esm/hubtype-api-client.js.map +1 -1
  38. package/lib/esm/index.d.ts +2 -2
  39. package/lib/esm/index.js +20 -23
  40. package/lib/esm/index.js.map +1 -1
  41. package/lib/esm/runner.d.ts +10 -0
  42. package/lib/esm/runner.js +71 -0
  43. package/lib/esm/runner.js.map +1 -0
  44. package/lib/esm/structured-output/carousel.d.ts +100 -0
  45. package/lib/esm/structured-output/carousel.js +18 -0
  46. package/lib/esm/structured-output/carousel.js.map +1 -0
  47. package/lib/esm/structured-output/exit.d.ts +12 -0
  48. package/lib/esm/structured-output/exit.js +7 -0
  49. package/lib/esm/structured-output/exit.js.map +1 -0
  50. package/lib/esm/structured-output/index.d.ts +198 -0
  51. package/lib/esm/structured-output/index.js +11 -0
  52. package/lib/esm/structured-output/index.js.map +1 -0
  53. package/lib/esm/structured-output/shared.d.ts +3 -0
  54. package/lib/esm/structured-output/shared.js +2 -0
  55. package/lib/esm/structured-output/shared.js.map +1 -0
  56. package/lib/esm/structured-output/text-with-buttons.d.ts +34 -0
  57. package/lib/esm/structured-output/text-with-buttons.js +11 -0
  58. package/lib/esm/structured-output/text-with-buttons.js.map +1 -0
  59. package/lib/esm/structured-output/text.d.ts +28 -0
  60. package/lib/esm/structured-output/text.js +10 -0
  61. package/lib/esm/structured-output/text.js.map +1 -0
  62. package/lib/esm/types.d.ts +6 -25
  63. package/package.json +3 -4
  64. package/src/constants.ts +2 -0
  65. package/src/hubtype-api-client.ts +55 -9
  66. package/src/index.ts +25 -32
  67. package/src/runner.ts +97 -0
  68. package/src/structured-output/carousel.ts +36 -0
  69. package/src/structured-output/exit.ts +15 -0
  70. package/src/structured-output/index.ts +27 -0
  71. package/src/structured-output/shared.ts +3 -0
  72. package/src/structured-output/text-with-buttons.ts +23 -0
  73. package/src/structured-output/text.ts +19 -0
  74. package/src/types.ts +7 -34
  75. package/lib/cjs/ai-agent-client.d.ts +0 -9
  76. package/lib/cjs/ai-agent-client.js +0 -49
  77. package/lib/cjs/ai-agent-client.js.map +0 -1
  78. package/lib/cjs/errors.d.ts +0 -3
  79. package/lib/cjs/errors.js +0 -11
  80. package/lib/cjs/errors.js.map +0 -1
  81. package/lib/cjs/tools/custom.d.ts +0 -3
  82. package/lib/cjs/tools/custom.js +0 -14
  83. package/lib/cjs/tools/custom.js.map +0 -1
  84. package/lib/cjs/tools/default.d.ts +0 -6
  85. package/lib/cjs/tools/default.js +0 -41
  86. package/lib/cjs/tools/default.js.map +0 -1
  87. package/lib/cjs/utils.d.ts +0 -5
  88. package/lib/cjs/utils.js +0 -26
  89. package/lib/cjs/utils.js.map +0 -1
  90. package/lib/esm/ai-agent-client.d.ts +0 -9
  91. package/lib/esm/ai-agent-client.js +0 -45
  92. package/lib/esm/ai-agent-client.js.map +0 -1
  93. package/lib/esm/errors.d.ts +0 -3
  94. package/lib/esm/errors.js +0 -7
  95. package/lib/esm/errors.js.map +0 -1
  96. package/lib/esm/tools/custom.d.ts +0 -3
  97. package/lib/esm/tools/custom.js +0 -10
  98. package/lib/esm/tools/custom.js.map +0 -1
  99. package/lib/esm/tools/default.d.ts +0 -6
  100. package/lib/esm/tools/default.js +0 -38
  101. package/lib/esm/tools/default.js.map +0 -1
  102. package/lib/esm/utils.d.ts +0 -5
  103. package/lib/esm/utils.js +0 -22
  104. package/lib/esm/utils.js.map +0 -1
  105. package/src/ai-agent-client.ts +0 -69
  106. package/src/errors.ts +0 -6
  107. package/src/tools/custom.ts +0 -14
  108. package/src/tools/default.ts +0 -52
  109. package/src/utils.ts +0 -28
package/src/errors.ts DELETED
@@ -1,6 +0,0 @@
1
- export class AiAgentError extends Error {
2
- constructor(message: string) {
3
- super(message)
4
- this.name = 'AiAgentError'
5
- }
6
- }
@@ -1,14 +0,0 @@
1
- import { DynamicStructuredTool, tool } from '@langchain/core/tools'
2
-
3
- import { CustomTool } from '../types'
4
-
5
- export function createCustomTool(
6
- customTool: CustomTool
7
- ): DynamicStructuredTool {
8
- return tool(customTool.func, {
9
- name: customTool.name,
10
- description: customTool.description,
11
- schema: customTool.schema,
12
- returnDirect: customTool.returnDirect || false,
13
- })
14
- }
@@ -1,52 +0,0 @@
1
- import { tool } from '@langchain/core/tools'
2
- import { z } from 'zod'
3
-
4
- export const handoffToHumanAgent = tool(
5
- async () => {
6
- return null
7
- },
8
- {
9
- name: 'handoffToHumanAgent',
10
- schema: z.object({}),
11
- description:
12
- 'Use this tool strictly when the user wants to talk with a human agent.',
13
- returnDirect: true,
14
- }
15
- )
16
-
17
- export const outOfContext = tool(
18
- async () => {
19
- return null
20
- },
21
- {
22
- name: 'outOfContext',
23
- schema: z.object({}),
24
- description:
25
- 'Use this when the user talks about something that is clearly out of your context. Example: "I want to buy a car" when you are a travel agent.',
26
- returnDirect: true,
27
- }
28
- )
29
-
30
- export const finishConversation = tool(
31
- async () => {
32
- return null
33
- },
34
- {
35
- name: 'finishConversation',
36
- schema: z.object({}),
37
- description: 'Use this when the user wants to end the conversation.',
38
- returnDirect: true,
39
- }
40
- )
41
-
42
- export const MANDATORY_TOOLS = [
43
- handoffToHumanAgent,
44
- outOfContext,
45
- finishConversation,
46
- ]
47
-
48
- export const EXIT_TOOLS = [
49
- handoffToHumanAgent.name,
50
- outOfContext.name,
51
- finishConversation.name,
52
- ]
package/src/utils.ts DELETED
@@ -1,28 +0,0 @@
1
- import { AzureChatOpenAI } from '@langchain/openai'
2
-
3
- import {
4
- AZURE_OPENAI_API_BASE,
5
- AZURE_OPENAI_API_DEPLOYMENT_NAME,
6
- AZURE_OPENAI_API_KEY,
7
- AZURE_OPENAI_API_VERSION,
8
- } from './constants'
9
-
10
- export enum AiProvider {
11
- AzureOpenAI = 'azureOpenAI',
12
- }
13
-
14
- export function loadChatModel(provider: AiProvider) {
15
- switch (provider) {
16
- case AiProvider.AzureOpenAI:
17
- return new AzureChatOpenAI({
18
- azureOpenAIApiVersion: AZURE_OPENAI_API_VERSION,
19
- azureOpenAIApiKey: AZURE_OPENAI_API_KEY,
20
- azureOpenAIApiDeploymentName: AZURE_OPENAI_API_DEPLOYMENT_NAME,
21
- azureOpenAIEndpoint: AZURE_OPENAI_API_BASE,
22
- temperature: 0,
23
- // other params...
24
- })
25
- default:
26
- throw new Error(`Provider ${provider} not supported`)
27
- }
28
- }