@copilotkit/shared 1.0.0-beta.0 → 1.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.
Files changed (79) hide show
  1. package/.turbo/turbo-build.log +62 -45
  2. package/CHANGELOG.md +12 -0
  3. package/dist/chunk-2WEXXBTK.mjs +119 -0
  4. package/dist/chunk-2WEXXBTK.mjs.map +1 -0
  5. package/dist/{chunk-2VLE6D3W.mjs → chunk-3AJ2GKWG.mjs} +2 -2
  6. package/dist/chunk-3AJ2GKWG.mjs.map +1 -0
  7. package/dist/chunk-6QGXWNS5.mjs +34 -0
  8. package/dist/chunk-6QGXWNS5.mjs.map +1 -0
  9. package/dist/chunk-DE5K76I2.mjs +1 -0
  10. package/dist/chunk-P7STFMPO.mjs +1 -0
  11. package/dist/chunk-YJLRG5U3.mjs +1 -0
  12. package/dist/constants/index.d.ts +1 -1
  13. package/dist/constants/index.js +1 -1
  14. package/dist/constants/index.js.map +1 -1
  15. package/dist/constants/index.mjs +1 -1
  16. package/dist/index.d.ts +3 -2
  17. package/dist/index.js +159 -169
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +12 -15
  20. package/dist/telemetry/events.d.ts +9 -0
  21. package/dist/{types/annotated-function.js → telemetry/events.js} +4 -4
  22. package/dist/telemetry/events.js.map +1 -0
  23. package/dist/telemetry/events.mjs +1 -0
  24. package/dist/telemetry/index.d.ts +3 -0
  25. package/dist/telemetry/index.js +181 -0
  26. package/dist/telemetry/index.js.map +1 -0
  27. package/dist/telemetry/index.mjs +9 -0
  28. package/dist/telemetry/security-check.d.ts +2 -0
  29. package/dist/telemetry/security-check.js +2 -0
  30. package/dist/telemetry/security-check.js.map +1 -0
  31. package/dist/telemetry/security-check.mjs +1 -0
  32. package/dist/telemetry/security-check.mjs.map +1 -0
  33. package/dist/telemetry/telemetry-client.d.ts +36 -0
  34. package/dist/telemetry/telemetry-client.js +179 -0
  35. package/dist/telemetry/telemetry-client.js.map +1 -0
  36. package/dist/telemetry/telemetry-client.mjs +8 -0
  37. package/dist/telemetry/telemetry-client.mjs.map +1 -0
  38. package/dist/telemetry/utils.d.ts +8 -0
  39. package/dist/telemetry/utils.js +69 -0
  40. package/dist/telemetry/utils.js.map +1 -0
  41. package/dist/telemetry/utils.mjs +9 -0
  42. package/dist/telemetry/utils.mjs.map +1 -0
  43. package/dist/types/index.d.ts +0 -1
  44. package/dist/types/index.js.map +1 -1
  45. package/dist/types/index.mjs +2 -3
  46. package/dist/utils/index.d.ts +0 -3
  47. package/dist/utils/index.js +5 -168
  48. package/dist/utils/index.js.map +1 -1
  49. package/dist/utils/index.mjs +2 -10
  50. package/package.json +5 -3
  51. package/src/constants/index.ts +1 -1
  52. package/src/index.ts +1 -0
  53. package/src/telemetry/events.ts +7 -0
  54. package/src/telemetry/index.ts +1 -0
  55. package/src/telemetry/security-check.ts +0 -0
  56. package/src/telemetry/telemetry-client.ts +159 -0
  57. package/src/telemetry/utils.ts +39 -0
  58. package/src/types/index.ts +0 -1
  59. package/src/utils/index.ts +0 -1
  60. package/dist/chunk-2VLE6D3W.mjs.map +0 -1
  61. package/dist/chunk-BANDZXMP.mjs +0 -1
  62. package/dist/chunk-CYDWEPFL.mjs +0 -1
  63. package/dist/chunk-S4HGLK2E.mjs +0 -163
  64. package/dist/chunk-S4HGLK2E.mjs.map +0 -1
  65. package/dist/chunk-YBHX4Y25.mjs +0 -1
  66. package/dist/types/annotated-function.d.ts +0 -24
  67. package/dist/types/annotated-function.js.map +0 -1
  68. package/dist/types/annotated-function.mjs +0 -2
  69. package/dist/utils/annotated-function.d.ts +0 -9
  70. package/dist/utils/annotated-function.js +0 -189
  71. package/dist/utils/annotated-function.js.map +0 -1
  72. package/dist/utils/annotated-function.mjs +0 -11
  73. package/src/types/annotated-function.ts +0 -27
  74. package/src/utils/annotated-function.ts +0 -179
  75. /package/dist/{chunk-BANDZXMP.mjs.map → chunk-DE5K76I2.mjs.map} +0 -0
  76. /package/dist/{chunk-CYDWEPFL.mjs.map → chunk-P7STFMPO.mjs.map} +0 -0
  77. /package/dist/{chunk-YBHX4Y25.mjs.map → chunk-YJLRG5U3.mjs.map} +0 -0
  78. /package/dist/{types/annotated-function.mjs.map → telemetry/events.mjs.map} +0 -0
  79. /package/dist/{utils/annotated-function.mjs.map → telemetry/index.mjs.map} +0 -0
@@ -1,163 +0,0 @@
1
- // src/utils/annotated-function.ts
2
- function annotatedFunctionToChatCompletionFunction(annotatedFunction) {
3
- let parameters = {};
4
- for (let arg of annotatedFunction.argumentAnnotations) {
5
- let { name, required, ...forwardedArgs } = arg;
6
- parameters[arg.name] = forwardedArgs;
7
- }
8
- let requiredParameterNames = [];
9
- for (let arg of annotatedFunction.argumentAnnotations) {
10
- if (arg.required) {
11
- requiredParameterNames.push(arg.name);
12
- }
13
- }
14
- let chatCompletionFunction = {
15
- type: "function",
16
- function: {
17
- name: annotatedFunction.name,
18
- description: annotatedFunction.description,
19
- parameters: {
20
- type: "object",
21
- properties: parameters,
22
- required: requiredParameterNames
23
- }
24
- }
25
- };
26
- return chatCompletionFunction;
27
- }
28
- function convertAttribute(attribute) {
29
- var _a, _b, _c;
30
- switch (attribute.type) {
31
- case "string":
32
- return {
33
- type: "string",
34
- description: attribute.description,
35
- ...attribute.enum && { enum: attribute.enum }
36
- };
37
- case "number":
38
- case "boolean":
39
- return {
40
- type: attribute.type,
41
- description: attribute.description
42
- };
43
- case "object":
44
- case "object[]":
45
- const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
46
- (acc, attr) => {
47
- acc[attr.name] = convertAttribute(attr);
48
- return acc;
49
- },
50
- {}
51
- );
52
- const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
53
- if (attribute.type === "object[]") {
54
- return {
55
- type: "array",
56
- items: {
57
- type: "object",
58
- ...properties && { properties },
59
- ...required && required.length > 0 && { required }
60
- },
61
- description: attribute.description
62
- };
63
- }
64
- return {
65
- type: "object",
66
- description: attribute.description,
67
- ...properties && { properties },
68
- ...required && required.length > 0 && { required }
69
- };
70
- default:
71
- if ((_c = attribute.type) == null ? void 0 : _c.endsWith("[]")) {
72
- const itemType = attribute.type.slice(0, -2);
73
- return {
74
- type: "array",
75
- items: { type: itemType },
76
- description: attribute.description
77
- };
78
- }
79
- return {
80
- type: "string",
81
- description: attribute.description
82
- };
83
- }
84
- }
85
- function actionToChatCompletionFunction(action) {
86
- let parameters = {};
87
- for (let parameter of action.parameters || []) {
88
- parameters[parameter.name] = convertAttribute(parameter);
89
- }
90
- let requiredParameterNames = [];
91
- for (let arg of action.parameters || []) {
92
- if (arg.required !== false) {
93
- requiredParameterNames.push(arg.name);
94
- }
95
- }
96
- let chatCompletionFunction = {
97
- type: "function",
98
- function: {
99
- name: action.name,
100
- ...action.description && { description: action.description },
101
- parameters: {
102
- type: "object",
103
- properties: parameters,
104
- required: requiredParameterNames
105
- }
106
- }
107
- };
108
- return chatCompletionFunction;
109
- }
110
- function annotatedFunctionToAction(annotatedFunction) {
111
- const parameters = annotatedFunction.argumentAnnotations.map((annotation) => {
112
- switch (annotation.type) {
113
- case "string":
114
- case "number":
115
- case "boolean":
116
- case "object":
117
- return {
118
- name: annotation.name,
119
- description: annotation.description,
120
- type: annotation.type,
121
- required: annotation.required
122
- };
123
- case "array":
124
- let type;
125
- if (annotation.items.type === "string") {
126
- type = "string[]";
127
- } else if (annotation.items.type === "number") {
128
- type = "number[]";
129
- } else if (annotation.items.type === "boolean") {
130
- type = "boolean[]";
131
- } else if (annotation.items.type === "object") {
132
- type = "object[]";
133
- } else {
134
- type = "string[]";
135
- }
136
- return {
137
- name: annotation.name,
138
- description: annotation.description,
139
- type,
140
- required: annotation.required
141
- };
142
- }
143
- });
144
- return {
145
- name: annotatedFunction.name,
146
- description: annotatedFunction.description,
147
- parameters,
148
- handler: (args) => {
149
- const paramsInCorrectOrder = [];
150
- for (let arg of annotatedFunction.argumentAnnotations) {
151
- paramsInCorrectOrder.push(args[arg.name]);
152
- }
153
- return annotatedFunction.implementation(...paramsInCorrectOrder);
154
- }
155
- };
156
- }
157
-
158
- export {
159
- annotatedFunctionToChatCompletionFunction,
160
- actionToChatCompletionFunction,
161
- annotatedFunctionToAction
162
- };
163
- //# sourceMappingURL=chunk-S4HGLK2E.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/annotated-function.ts"],"sourcesContent":["import { Action, AnnotatedFunction, ToolDefinition, Parameter } from \"../types\";\n\nexport function annotatedFunctionToChatCompletionFunction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let arg of annotatedFunction.argumentAnnotations) {\n // isolate the args we should forward inline\n let { name, required, ...forwardedArgs } = arg;\n parameters[arg.name] = forwardedArgs;\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n if (arg.required) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nfunction convertAttribute(attribute: Parameter): any {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function actionToChatCompletionFunction(action: Action<any>): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of action.parameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of action.parameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: action.name,\n ...(action.description && { description: action.description }),\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nexport function annotatedFunctionToAction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): Action<any> {\n const parameters: Parameter[] = annotatedFunction.argumentAnnotations.map((annotation) => {\n switch (annotation.type) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"object\":\n return {\n name: annotation.name,\n description: annotation.description,\n type: annotation.type,\n required: annotation.required,\n };\n case \"array\":\n let type;\n if (annotation.items.type === \"string\") {\n type = \"string[]\";\n } else if (annotation.items.type === \"number\") {\n type = \"number[]\";\n } else if (annotation.items.type === \"boolean\") {\n type = \"boolean[]\";\n } else if (annotation.items.type === \"object\") {\n type = \"object[]\";\n } else {\n type = \"string[]\";\n }\n return {\n name: annotation.name,\n description: annotation.description,\n type: type as any,\n required: annotation.required,\n };\n }\n });\n\n return {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: parameters,\n handler: (args) => {\n const paramsInCorrectOrder: any[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n paramsInCorrectOrder.push(args[arg.name]);\n }\n return annotatedFunction.implementation(...paramsInCorrectOrder);\n },\n };\n}\n"],"mappings":";AAEO,SAAS,0CACd,mBACgB;AAEhB,MAAI,aAAqC,CAAC;AAC1C,WAAS,OAAO,kBAAkB,qBAAqB;AAErD,QAAI,EAAE,MAAM,UAAU,GAAG,cAAc,IAAI;AAC3C,eAAW,IAAI,IAAI,IAAI;AAAA,EACzB;AAEA,MAAI,yBAAmC,CAAC;AACxC,WAAS,OAAO,kBAAkB,qBAAqB;AACrD,QAAI,IAAI,UAAU;AAChB,6BAAuB,KAAK,IAAI,IAAI;AAAA,IACtC;AAAA,EACF;AAGA,MAAI,yBAAyC;AAAA,IAC3C,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM,kBAAkB;AAAA,MACxB,aAAa,kBAAkB;AAAA,MAC/B,YAAY;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,WAA2B;AArCrD;AAsCE,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,QACvB,GAAI,UAAU,QAAQ,EAAE,MAAM,UAAU,KAAK;AAAA,MAC/C;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,QACL,MAAM,UAAU;AAAA,QAChB,aAAa,UAAU;AAAA,MACzB;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,YAAM,cAAa,eAAU,eAAV,mBAAsB;AAAA,QACvC,CAAC,KAAK,SAAS;AACb,cAAI,KAAK,IAAI,IAAI,iBAAiB,IAAI;AACtC,iBAAO;AAAA,QACT;AAAA,QACA,CAAC;AAAA;AAEH,YAAM,YAAW,eAAU,eAAV,mBACb,OAAO,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,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,0BACd,mBACa;AACb,QAAM,aAA0B,kBAAkB,oBAAoB,IAAI,CAAC,eAAe;AACxF,YAAQ,WAAW,MAAM;AAAA,MACvB,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,UACL,MAAM,WAAW;AAAA,UACjB,aAAa,WAAW;AAAA,UACxB,MAAM,WAAW;AAAA,UACjB,UAAU,WAAW;AAAA,QACvB;AAAA,MACF,KAAK;AACH,YAAI;AACJ,YAAI,WAAW,MAAM,SAAS,UAAU;AACtC,iBAAO;AAAA,QACT,WAAW,WAAW,MAAM,SAAS,UAAU;AAC7C,iBAAO;AAAA,QACT,WAAW,WAAW,MAAM,SAAS,WAAW;AAC9C,iBAAO;AAAA,QACT,WAAW,WAAW,MAAM,SAAS,UAAU;AAC7C,iBAAO;AAAA,QACT,OAAO;AACL,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,UACL,MAAM,WAAW;AAAA,UACjB,aAAa,WAAW;AAAA,UACxB;AAAA,UACA,UAAU,WAAW;AAAA,QACvB;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,MAAM,kBAAkB;AAAA,IACxB,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA,SAAS,CAAC,SAAS;AACjB,YAAM,uBAA8B,CAAC;AACrC,eAAS,OAAO,kBAAkB,qBAAqB;AACrD,6BAAqB,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,MAC1C;AACA,aAAO,kBAAkB,eAAe,GAAG,oBAAoB;AAAA,IACjE;AAAA,EACF;AACF;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-YBHX4Y25.mjs.map
@@ -1,24 +0,0 @@
1
- interface AnnotatedFunctionSimpleArgument {
2
- name: string;
3
- type: "string" | "number" | "boolean" | "object";
4
- description: string;
5
- required: boolean;
6
- }
7
- interface AnnotatedFunctionArrayArgument {
8
- name: string;
9
- type: "array";
10
- items: {
11
- type: string;
12
- };
13
- description: string;
14
- required: boolean;
15
- }
16
- type AnnotatedFunctionArgument = AnnotatedFunctionSimpleArgument | AnnotatedFunctionArrayArgument;
17
- interface AnnotatedFunction<Inputs extends any[]> {
18
- name: string;
19
- description: string;
20
- argumentAnnotations: AnnotatedFunctionArgument[];
21
- implementation: (...args: Inputs) => Promise<any>;
22
- }
23
-
24
- export { AnnotatedFunction, AnnotatedFunctionArgument, AnnotatedFunctionArrayArgument, AnnotatedFunctionSimpleArgument };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types/annotated-function.ts"],"sourcesContent":["export interface AnnotatedFunctionSimpleArgument {\n name: string;\n type: \"string\" | \"number\" | \"boolean\" | \"object\"; // Add or change types according to your needs.\n description: string;\n required: boolean;\n}\n\nexport interface AnnotatedFunctionArrayArgument {\n name: string;\n type: \"array\";\n items: {\n type: string;\n };\n description: string;\n required: boolean;\n}\n\nexport type AnnotatedFunctionArgument =\n | AnnotatedFunctionSimpleArgument\n | AnnotatedFunctionArrayArgument;\n\nexport interface AnnotatedFunction<Inputs extends any[]> {\n name: string;\n description: string;\n argumentAnnotations: AnnotatedFunctionArgument[];\n implementation: (...args: Inputs) => Promise<any>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,2 +0,0 @@
1
- import "../chunk-YBHX4Y25.mjs";
2
- //# sourceMappingURL=annotated-function.mjs.map
@@ -1,9 +0,0 @@
1
- import { ToolDefinition } from '../types/openai-assistant.js';
2
- import { AnnotatedFunction } from '../types/annotated-function.js';
3
- import { Action } from '../types/action.js';
4
-
5
- declare function annotatedFunctionToChatCompletionFunction(annotatedFunction: AnnotatedFunction<any[]>): ToolDefinition;
6
- declare function actionToChatCompletionFunction(action: Action<any>): ToolDefinition;
7
- declare function annotatedFunctionToAction(annotatedFunction: AnnotatedFunction<any[]>): Action<any>;
8
-
9
- export { actionToChatCompletionFunction, annotatedFunctionToAction, annotatedFunctionToChatCompletionFunction };
@@ -1,189 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/utils/annotated-function.ts
21
- var annotated_function_exports = {};
22
- __export(annotated_function_exports, {
23
- actionToChatCompletionFunction: () => actionToChatCompletionFunction,
24
- annotatedFunctionToAction: () => annotatedFunctionToAction,
25
- annotatedFunctionToChatCompletionFunction: () => annotatedFunctionToChatCompletionFunction
26
- });
27
- module.exports = __toCommonJS(annotated_function_exports);
28
- function annotatedFunctionToChatCompletionFunction(annotatedFunction) {
29
- let parameters = {};
30
- for (let arg of annotatedFunction.argumentAnnotations) {
31
- let { name, required, ...forwardedArgs } = arg;
32
- parameters[arg.name] = forwardedArgs;
33
- }
34
- let requiredParameterNames = [];
35
- for (let arg of annotatedFunction.argumentAnnotations) {
36
- if (arg.required) {
37
- requiredParameterNames.push(arg.name);
38
- }
39
- }
40
- let chatCompletionFunction = {
41
- type: "function",
42
- function: {
43
- name: annotatedFunction.name,
44
- description: annotatedFunction.description,
45
- parameters: {
46
- type: "object",
47
- properties: parameters,
48
- required: requiredParameterNames
49
- }
50
- }
51
- };
52
- return chatCompletionFunction;
53
- }
54
- function convertAttribute(attribute) {
55
- var _a, _b, _c;
56
- switch (attribute.type) {
57
- case "string":
58
- return {
59
- type: "string",
60
- description: attribute.description,
61
- ...attribute.enum && { enum: attribute.enum }
62
- };
63
- case "number":
64
- case "boolean":
65
- return {
66
- type: attribute.type,
67
- description: attribute.description
68
- };
69
- case "object":
70
- case "object[]":
71
- const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
72
- (acc, attr) => {
73
- acc[attr.name] = convertAttribute(attr);
74
- return acc;
75
- },
76
- {}
77
- );
78
- const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
79
- if (attribute.type === "object[]") {
80
- return {
81
- type: "array",
82
- items: {
83
- type: "object",
84
- ...properties && { properties },
85
- ...required && required.length > 0 && { required }
86
- },
87
- description: attribute.description
88
- };
89
- }
90
- return {
91
- type: "object",
92
- description: attribute.description,
93
- ...properties && { properties },
94
- ...required && required.length > 0 && { required }
95
- };
96
- default:
97
- if ((_c = attribute.type) == null ? void 0 : _c.endsWith("[]")) {
98
- const itemType = attribute.type.slice(0, -2);
99
- return {
100
- type: "array",
101
- items: { type: itemType },
102
- description: attribute.description
103
- };
104
- }
105
- return {
106
- type: "string",
107
- description: attribute.description
108
- };
109
- }
110
- }
111
- function actionToChatCompletionFunction(action) {
112
- let parameters = {};
113
- for (let parameter of action.parameters || []) {
114
- parameters[parameter.name] = convertAttribute(parameter);
115
- }
116
- let requiredParameterNames = [];
117
- for (let arg of action.parameters || []) {
118
- if (arg.required !== false) {
119
- requiredParameterNames.push(arg.name);
120
- }
121
- }
122
- let chatCompletionFunction = {
123
- type: "function",
124
- function: {
125
- name: action.name,
126
- ...action.description && { description: action.description },
127
- parameters: {
128
- type: "object",
129
- properties: parameters,
130
- required: requiredParameterNames
131
- }
132
- }
133
- };
134
- return chatCompletionFunction;
135
- }
136
- function annotatedFunctionToAction(annotatedFunction) {
137
- const parameters = annotatedFunction.argumentAnnotations.map((annotation) => {
138
- switch (annotation.type) {
139
- case "string":
140
- case "number":
141
- case "boolean":
142
- case "object":
143
- return {
144
- name: annotation.name,
145
- description: annotation.description,
146
- type: annotation.type,
147
- required: annotation.required
148
- };
149
- case "array":
150
- let type;
151
- if (annotation.items.type === "string") {
152
- type = "string[]";
153
- } else if (annotation.items.type === "number") {
154
- type = "number[]";
155
- } else if (annotation.items.type === "boolean") {
156
- type = "boolean[]";
157
- } else if (annotation.items.type === "object") {
158
- type = "object[]";
159
- } else {
160
- type = "string[]";
161
- }
162
- return {
163
- name: annotation.name,
164
- description: annotation.description,
165
- type,
166
- required: annotation.required
167
- };
168
- }
169
- });
170
- return {
171
- name: annotatedFunction.name,
172
- description: annotatedFunction.description,
173
- parameters,
174
- handler: (args) => {
175
- const paramsInCorrectOrder = [];
176
- for (let arg of annotatedFunction.argumentAnnotations) {
177
- paramsInCorrectOrder.push(args[arg.name]);
178
- }
179
- return annotatedFunction.implementation(...paramsInCorrectOrder);
180
- }
181
- };
182
- }
183
- // Annotate the CommonJS export names for ESM import in node:
184
- 0 && (module.exports = {
185
- actionToChatCompletionFunction,
186
- annotatedFunctionToAction,
187
- annotatedFunctionToChatCompletionFunction
188
- });
189
- //# sourceMappingURL=annotated-function.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/utils/annotated-function.ts"],"sourcesContent":["import { Action, AnnotatedFunction, ToolDefinition, Parameter } from \"../types\";\n\nexport function annotatedFunctionToChatCompletionFunction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let arg of annotatedFunction.argumentAnnotations) {\n // isolate the args we should forward inline\n let { name, required, ...forwardedArgs } = arg;\n parameters[arg.name] = forwardedArgs;\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n if (arg.required) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nfunction convertAttribute(attribute: Parameter): any {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function actionToChatCompletionFunction(action: Action<any>): ToolDefinition {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of action.parameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of action.parameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n let chatCompletionFunction: ToolDefinition = {\n type: \"function\",\n function: {\n name: action.name,\n ...(action.description && { description: action.description }),\n parameters: {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n },\n },\n };\n\n return chatCompletionFunction;\n}\n\nexport function annotatedFunctionToAction(\n annotatedFunction: AnnotatedFunction<any[]>,\n): Action<any> {\n const parameters: Parameter[] = annotatedFunction.argumentAnnotations.map((annotation) => {\n switch (annotation.type) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"object\":\n return {\n name: annotation.name,\n description: annotation.description,\n type: annotation.type,\n required: annotation.required,\n };\n case \"array\":\n let type;\n if (annotation.items.type === \"string\") {\n type = \"string[]\";\n } else if (annotation.items.type === \"number\") {\n type = \"number[]\";\n } else if (annotation.items.type === \"boolean\") {\n type = \"boolean[]\";\n } else if (annotation.items.type === \"object\") {\n type = \"object[]\";\n } else {\n type = \"string[]\";\n }\n return {\n name: annotation.name,\n description: annotation.description,\n type: type as any,\n required: annotation.required,\n };\n }\n });\n\n return {\n name: annotatedFunction.name,\n description: annotatedFunction.description,\n parameters: parameters,\n handler: (args) => {\n const paramsInCorrectOrder: any[] = [];\n for (let arg of annotatedFunction.argumentAnnotations) {\n paramsInCorrectOrder.push(args[arg.name]);\n }\n return annotatedFunction.implementation(...paramsInCorrectOrder);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,0CACd,mBACgB;AAEhB,MAAI,aAAqC,CAAC;AAC1C,WAAS,OAAO,kBAAkB,qBAAqB;AAErD,QAAI,EAAE,MAAM,UAAU,GAAG,cAAc,IAAI;AAC3C,eAAW,IAAI,IAAI,IAAI;AAAA,EACzB;AAEA,MAAI,yBAAmC,CAAC;AACxC,WAAS,OAAO,kBAAkB,qBAAqB;AACrD,QAAI,IAAI,UAAU;AAChB,6BAAuB,KAAK,IAAI,IAAI;AAAA,IACtC;AAAA,EACF;AAGA,MAAI,yBAAyC;AAAA,IAC3C,MAAM;AAAA,IACN,UAAU;AAAA,MACR,MAAM,kBAAkB;AAAA,MACxB,aAAa,kBAAkB;AAAA,MAC/B,YAAY;AAAA,QACV,M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;AAAA,QACT,OAAO;AACL,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,UACL,MAAM,WAAW;AAAA,UACjB,aAAa,WAAW;AAAA,UACxB;AAAA,UACA,UAAU,WAAW;AAAA,QACvB;AAAA,IACJ;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,MAAM,kBAAkB;AAAA,IACxB,aAAa,kBAAkB;AAAA,IAC/B;AAAA,IACA,SAAS,CAAC,SAAS;AACjB,YAAM,uBAA8B,CAAC;AACrC,eAAS,OAAO,kBAAkB,qBAAqB;AACrD,6BAAqB,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,MAC1C;AACA,aAAO,kBAAkB,eAAe,GAAG,oBAAoB;AAAA,IACjE;AAAA,EACF;AACF;","names":[]}
@@ -1,11 +0,0 @@
1
- import {
2
- actionToChatCompletionFunction,
3
- annotatedFunctionToAction,
4
- annotatedFunctionToChatCompletionFunction
5
- } from "../chunk-S4HGLK2E.mjs";
6
- export {
7
- actionToChatCompletionFunction,
8
- annotatedFunctionToAction,
9
- annotatedFunctionToChatCompletionFunction
10
- };
11
- //# sourceMappingURL=annotated-function.mjs.map
@@ -1,27 +0,0 @@
1
- export interface AnnotatedFunctionSimpleArgument {
2
- name: string;
3
- type: "string" | "number" | "boolean" | "object"; // Add or change types according to your needs.
4
- description: string;
5
- required: boolean;
6
- }
7
-
8
- export interface AnnotatedFunctionArrayArgument {
9
- name: string;
10
- type: "array";
11
- items: {
12
- type: string;
13
- };
14
- description: string;
15
- required: boolean;
16
- }
17
-
18
- export type AnnotatedFunctionArgument =
19
- | AnnotatedFunctionSimpleArgument
20
- | AnnotatedFunctionArrayArgument;
21
-
22
- export interface AnnotatedFunction<Inputs extends any[]> {
23
- name: string;
24
- description: string;
25
- argumentAnnotations: AnnotatedFunctionArgument[];
26
- implementation: (...args: Inputs) => Promise<any>;
27
- }
@@ -1,179 +0,0 @@
1
- import { Action, AnnotatedFunction, ToolDefinition, Parameter } from "../types";
2
-
3
- export function annotatedFunctionToChatCompletionFunction(
4
- annotatedFunction: AnnotatedFunction<any[]>,
5
- ): ToolDefinition {
6
- // Create the parameters object based on the argumentAnnotations
7
- let parameters: { [key: string]: any } = {};
8
- for (let arg of annotatedFunction.argumentAnnotations) {
9
- // isolate the args we should forward inline
10
- let { name, required, ...forwardedArgs } = arg;
11
- parameters[arg.name] = forwardedArgs;
12
- }
13
-
14
- let requiredParameterNames: string[] = [];
15
- for (let arg of annotatedFunction.argumentAnnotations) {
16
- if (arg.required) {
17
- requiredParameterNames.push(arg.name);
18
- }
19
- }
20
-
21
- // Create the ChatCompletionFunctions object
22
- let chatCompletionFunction: ToolDefinition = {
23
- type: "function",
24
- function: {
25
- name: annotatedFunction.name,
26
- description: annotatedFunction.description,
27
- parameters: {
28
- type: "object",
29
- properties: parameters,
30
- required: requiredParameterNames,
31
- },
32
- },
33
- };
34
-
35
- return chatCompletionFunction;
36
- }
37
-
38
- function convertAttribute(attribute: Parameter): any {
39
- switch (attribute.type) {
40
- case "string":
41
- return {
42
- type: "string",
43
- description: attribute.description,
44
- ...(attribute.enum && { enum: attribute.enum }),
45
- };
46
- case "number":
47
- case "boolean":
48
- return {
49
- type: attribute.type,
50
- description: attribute.description,
51
- };
52
- case "object":
53
- case "object[]":
54
- const properties = attribute.attributes?.reduce(
55
- (acc, attr) => {
56
- acc[attr.name] = convertAttribute(attr);
57
- return acc;
58
- },
59
- {} as Record<string, any>,
60
- );
61
- const required = attribute.attributes
62
- ?.filter((attr) => attr.required !== false)
63
- .map((attr) => attr.name);
64
- if (attribute.type === "object[]") {
65
- return {
66
- type: "array",
67
- items: {
68
- type: "object",
69
- ...(properties && { properties }),
70
- ...(required && required.length > 0 && { required }),
71
- },
72
- description: attribute.description,
73
- };
74
- }
75
- return {
76
- type: "object",
77
- description: attribute.description,
78
- ...(properties && { properties }),
79
- ...(required && required.length > 0 && { required }),
80
- };
81
- default:
82
- // Handle arrays of primitive types and undefined attribute.type
83
- if (attribute.type?.endsWith("[]")) {
84
- const itemType = attribute.type.slice(0, -2);
85
- return {
86
- type: "array",
87
- items: { type: itemType },
88
- description: attribute.description,
89
- };
90
- }
91
- // Fallback for undefined type or any other unexpected type
92
- return {
93
- type: "string",
94
- description: attribute.description,
95
- };
96
- }
97
- }
98
-
99
- export function actionToChatCompletionFunction(action: Action<any>): ToolDefinition {
100
- // Create the parameters object based on the argumentAnnotations
101
- let parameters: { [key: string]: any } = {};
102
- for (let parameter of action.parameters || []) {
103
- parameters[parameter.name] = convertAttribute(parameter);
104
- }
105
-
106
- let requiredParameterNames: string[] = [];
107
- for (let arg of action.parameters || []) {
108
- if (arg.required !== false) {
109
- requiredParameterNames.push(arg.name);
110
- }
111
- }
112
-
113
- // Create the ChatCompletionFunctions object
114
- let chatCompletionFunction: ToolDefinition = {
115
- type: "function",
116
- function: {
117
- name: action.name,
118
- ...(action.description && { description: action.description }),
119
- parameters: {
120
- type: "object",
121
- properties: parameters,
122
- required: requiredParameterNames,
123
- },
124
- },
125
- };
126
-
127
- return chatCompletionFunction;
128
- }
129
-
130
- export function annotatedFunctionToAction(
131
- annotatedFunction: AnnotatedFunction<any[]>,
132
- ): Action<any> {
133
- const parameters: Parameter[] = annotatedFunction.argumentAnnotations.map((annotation) => {
134
- switch (annotation.type) {
135
- case "string":
136
- case "number":
137
- case "boolean":
138
- case "object":
139
- return {
140
- name: annotation.name,
141
- description: annotation.description,
142
- type: annotation.type,
143
- required: annotation.required,
144
- };
145
- case "array":
146
- let type;
147
- if (annotation.items.type === "string") {
148
- type = "string[]";
149
- } else if (annotation.items.type === "number") {
150
- type = "number[]";
151
- } else if (annotation.items.type === "boolean") {
152
- type = "boolean[]";
153
- } else if (annotation.items.type === "object") {
154
- type = "object[]";
155
- } else {
156
- type = "string[]";
157
- }
158
- return {
159
- name: annotation.name,
160
- description: annotation.description,
161
- type: type as any,
162
- required: annotation.required,
163
- };
164
- }
165
- });
166
-
167
- return {
168
- name: annotatedFunction.name,
169
- description: annotatedFunction.description,
170
- parameters: parameters,
171
- handler: (args) => {
172
- const paramsInCorrectOrder: any[] = [];
173
- for (let arg of annotatedFunction.argumentAnnotations) {
174
- paramsInCorrectOrder.push(args[arg.name]);
175
- }
176
- return annotatedFunction.implementation(...paramsInCorrectOrder);
177
- },
178
- };
179
- }