@ohos-ports/genkit 1.42.0-beta.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.
Files changed (202) hide show
  1. package/LICENSE +203 -0
  2. package/README.md +434 -0
  3. package/lib/beta.d.mts +18 -0
  4. package/lib/beta.d.ts +18 -0
  5. package/lib/beta.js +88 -0
  6. package/lib/beta.js.map +1 -0
  7. package/lib/beta.mjs +64 -0
  8. package/lib/beta.mjs.map +1 -0
  9. package/lib/client/agent.d.mts +52 -0
  10. package/lib/client/agent.d.ts +52 -0
  11. package/lib/client/agent.js +90 -0
  12. package/lib/client/agent.js.map +1 -0
  13. package/lib/client/agent.mjs +68 -0
  14. package/lib/client/agent.mjs.map +1 -0
  15. package/lib/client/client.d.mts +80 -0
  16. package/lib/client/client.d.ts +80 -0
  17. package/lib/client/client.js +164 -0
  18. package/lib/client/client.js.map +1 -0
  19. package/lib/client/client.mjs +139 -0
  20. package/lib/client/client.mjs.map +1 -0
  21. package/lib/client/index.d.mts +6 -0
  22. package/lib/client/index.d.ts +6 -0
  23. package/lib/client/index.js +55 -0
  24. package/lib/client/index.js.map +1 -0
  25. package/lib/client/index.mjs +31 -0
  26. package/lib/client/index.mjs.map +1 -0
  27. package/lib/client/types.d.mts +17 -0
  28. package/lib/client/types.d.ts +17 -0
  29. package/lib/client/types.js +17 -0
  30. package/lib/client/types.js.map +1 -0
  31. package/lib/client/types.mjs +1 -0
  32. package/lib/client/types.mjs.map +1 -0
  33. package/lib/common.d.mts +3 -0
  34. package/lib/common.d.ts +3 -0
  35. package/lib/common.js +151 -0
  36. package/lib/common.js.map +1 -0
  37. package/lib/common.mjs +128 -0
  38. package/lib/common.mjs.map +1 -0
  39. package/lib/context.d.mts +1 -0
  40. package/lib/context.d.ts +1 -0
  41. package/lib/context.js +50 -0
  42. package/lib/context.js.map +1 -0
  43. package/lib/context.mjs +28 -0
  44. package/lib/context.mjs.map +1 -0
  45. package/lib/embedder.d.mts +1 -0
  46. package/lib/embedder.d.ts +1 -0
  47. package/lib/embedder.js +48 -0
  48. package/lib/embedder.js.map +1 -0
  49. package/lib/embedder.mjs +26 -0
  50. package/lib/embedder.mjs.map +1 -0
  51. package/lib/evaluator.d.mts +1 -0
  52. package/lib/evaluator.d.ts +1 -0
  53. package/lib/evaluator.js +60 -0
  54. package/lib/evaluator.js.map +1 -0
  55. package/lib/evaluator.mjs +38 -0
  56. package/lib/evaluator.mjs.map +1 -0
  57. package/lib/extract.d.mts +1 -0
  58. package/lib/extract.d.ts +1 -0
  59. package/lib/extract.js +48 -0
  60. package/lib/extract.js.map +1 -0
  61. package/lib/extract.mjs +23 -0
  62. package/lib/extract.mjs.map +1 -0
  63. package/lib/formats.d.mts +1 -0
  64. package/lib/formats.d.ts +1 -0
  65. package/lib/formats.js +34 -0
  66. package/lib/formats.js.map +1 -0
  67. package/lib/formats.mjs +18 -0
  68. package/lib/formats.mjs.map +1 -0
  69. package/lib/genkit-beta.d.mts +183 -0
  70. package/lib/genkit-beta.d.ts +183 -0
  71. package/lib/genkit-beta.js +178 -0
  72. package/lib/genkit-beta.js.map +1 -0
  73. package/lib/genkit-beta.mjs +159 -0
  74. package/lib/genkit-beta.mjs.map +1 -0
  75. package/lib/genkit.d.mts +10 -0
  76. package/lib/genkit.d.ts +10 -0
  77. package/lib/genkit.js +471 -0
  78. package/lib/genkit.js.map +1 -0
  79. package/lib/genkit.mjs +489 -0
  80. package/lib/genkit.mjs.map +1 -0
  81. package/lib/index-BSkuxdwl.d.mts +311 -0
  82. package/lib/index-BSkuxdwl.d.ts +311 -0
  83. package/lib/index.d.mts +10 -0
  84. package/lib/index.d.ts +10 -0
  85. package/lib/index.js +51 -0
  86. package/lib/index.js.map +1 -0
  87. package/lib/index.mjs +24 -0
  88. package/lib/index.mjs.map +1 -0
  89. package/lib/logging.d.mts +1 -0
  90. package/lib/logging.d.ts +1 -0
  91. package/lib/logging.js +46 -0
  92. package/lib/logging.js.map +1 -0
  93. package/lib/logging.mjs +22 -0
  94. package/lib/logging.mjs.map +1 -0
  95. package/lib/middleware.d.mts +1 -0
  96. package/lib/middleware.d.ts +1 -0
  97. package/lib/middleware.js +56 -0
  98. package/lib/middleware.js.map +1 -0
  99. package/lib/middleware.mjs +34 -0
  100. package/lib/middleware.mjs.map +1 -0
  101. package/lib/model.d.mts +1 -0
  102. package/lib/model.d.ts +1 -0
  103. package/lib/model.js +92 -0
  104. package/lib/model.js.map +1 -0
  105. package/lib/model.mjs +70 -0
  106. package/lib/model.mjs.map +1 -0
  107. package/lib/plugin.d.mts +10 -0
  108. package/lib/plugin.d.ts +10 -0
  109. package/lib/plugin.js +143 -0
  110. package/lib/plugin.js.map +1 -0
  111. package/lib/plugin.mjs +113 -0
  112. package/lib/plugin.mjs.map +1 -0
  113. package/lib/registry.d.mts +1 -0
  114. package/lib/registry.d.ts +1 -0
  115. package/lib/registry.js +46 -0
  116. package/lib/registry.js.map +1 -0
  117. package/lib/registry.mjs +24 -0
  118. package/lib/registry.mjs.map +1 -0
  119. package/lib/reranker.d.mts +1 -0
  120. package/lib/reranker.d.ts +1 -0
  121. package/lib/reranker.js +54 -0
  122. package/lib/reranker.js.map +1 -0
  123. package/lib/reranker.mjs +32 -0
  124. package/lib/reranker.mjs.map +1 -0
  125. package/lib/retriever.d.mts +1 -0
  126. package/lib/retriever.d.ts +1 -0
  127. package/lib/retriever.js +58 -0
  128. package/lib/retriever.js.map +1 -0
  129. package/lib/retriever.mjs +36 -0
  130. package/lib/retriever.mjs.map +1 -0
  131. package/lib/schema.d.mts +1 -0
  132. package/lib/schema.d.ts +1 -0
  133. package/lib/schema.js +54 -0
  134. package/lib/schema.js.map +1 -0
  135. package/lib/schema.mjs +32 -0
  136. package/lib/schema.mjs.map +1 -0
  137. package/lib/testing.d.mts +1 -0
  138. package/lib/testing.d.ts +1 -0
  139. package/lib/testing.js +50 -0
  140. package/lib/testing.js.map +1 -0
  141. package/lib/testing.mjs +28 -0
  142. package/lib/testing.mjs.map +1 -0
  143. package/lib/tool.d.mts +1 -0
  144. package/lib/tool.d.ts +1 -0
  145. package/lib/tool.js +54 -0
  146. package/lib/tool.js.map +1 -0
  147. package/lib/tool.mjs +32 -0
  148. package/lib/tool.mjs.map +1 -0
  149. package/lib/tracing.d.mts +1 -0
  150. package/lib/tracing.d.ts +1 -0
  151. package/lib/tracing.js +82 -0
  152. package/lib/tracing.js.map +1 -0
  153. package/lib/tracing.mjs +60 -0
  154. package/lib/tracing.mjs.map +1 -0
  155. package/package.json +233 -0
  156. package/src/beta.ts +85 -0
  157. package/src/client/agent.ts +160 -0
  158. package/src/client/client.ts +237 -0
  159. package/src/client/index.ts +72 -0
  160. package/src/client/types.ts +41 -0
  161. package/src/common.ts +175 -0
  162. package/src/context.ts +37 -0
  163. package/src/embedder.ts +41 -0
  164. package/src/evaluator.ts +50 -0
  165. package/src/extract.ts +30 -0
  166. package/src/formats.ts +30 -0
  167. package/src/genkit-beta.ts +275 -0
  168. package/src/genkit.ts +818 -0
  169. package/src/index.ts +29 -0
  170. package/src/logging.ts +30 -0
  171. package/src/middleware.ts +38 -0
  172. package/src/model.ts +87 -0
  173. package/src/plugin.ts +172 -0
  174. package/src/registry.ts +36 -0
  175. package/src/reranker.ts +42 -0
  176. package/src/retriever.ts +55 -0
  177. package/src/schema.ts +40 -0
  178. package/src/testing.ts +47 -0
  179. package/src/tool.ts +40 -0
  180. package/src/tracing.ts +55 -0
  181. package/tests/agent_client_test.ts +497 -0
  182. package/tests/embed_test.ts +142 -0
  183. package/tests/evaluate_test.ts +52 -0
  184. package/tests/flow_test.ts +94 -0
  185. package/tests/formats_test.ts +168 -0
  186. package/tests/generate_test.ts +1631 -0
  187. package/tests/genkit_test.ts +33 -0
  188. package/tests/helpers.ts +176 -0
  189. package/tests/mock-model_test.ts +490 -0
  190. package/tests/plugins_test.ts +259 -0
  191. package/tests/prompts/badSchemaRef.prompt +9 -0
  192. package/tests/prompts/chat_preamble.prompt +5 -0
  193. package/tests/prompts/kitchensink.prompt +25 -0
  194. package/tests/prompts/output.prompt +11 -0
  195. package/tests/prompts/schemaRef.prompt +9 -0
  196. package/tests/prompts/sub/test.prompt +5 -0
  197. package/tests/prompts/test.prompt +5 -0
  198. package/tests/prompts/test.variant.prompt +8 -0
  199. package/tests/prompts/toolPrompt.prompt +6 -0
  200. package/tests/prompts_test.ts +1442 -0
  201. package/tests/session_test.ts +17 -0
  202. package/typedoc.json +22 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2024 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import {
19
+ echoModel,
20
+ mockModel,
21
+ testModels
22
+ } from "@genkit-ai/ai/testing";
23
+ export {
24
+ echoModel,
25
+ mockModel,
26
+ testModels
27
+ };
28
+ //# sourceMappingURL=testing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Testing utilities for Genkit apps and model plugins.\n *\n * - {@link mockModel} — a programmable mock model with typed call inspection,\n * for testing flows, prompts, and tools deterministically.\n * - {@link echoModel} — a zero-config model that echoes the rendered request,\n * for asserting prompt/message assembly.\n * - `testModels` — a conformance harness for model *plugin* authors.\n *\n * ```ts\n * import { mockModel, echoModel, testModels } from 'genkit/testing';\n * ```\n *\n * @module testing\n */\n\nexport {\n echoModel,\n mockModel,\n testModels,\n type EchoModelOptions,\n type MockChunk,\n type MockContext,\n type MockModel,\n type MockModelOptions,\n type MockRespond,\n type MockRespondFn,\n type MockResponse,\n} from '@genkit-ai/ai/testing';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OASK;","names":[]}
package/lib/tool.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { MultipartToolAction, ToolAction, ToolArgument, ToolConfig, asTool, dynamicTool, interrupt, toToolDefinition, tool } from '@genkit-ai/ai/tool';
package/lib/tool.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { MultipartToolAction, ToolAction, ToolArgument, ToolConfig, asTool, dynamicTool, interrupt, toToolDefinition, tool } from '@genkit-ai/ai/tool';
package/lib/tool.js ADDED
@@ -0,0 +1,54 @@
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
+ var tool_exports = {};
20
+ __export(tool_exports, {
21
+ asTool: () => import_tool.asTool,
22
+ dynamicTool: () => import_tool.dynamicTool,
23
+ interrupt: () => import_tool.interrupt,
24
+ toToolDefinition: () => import_tool.toToolDefinition,
25
+ tool: () => import_tool.tool
26
+ });
27
+ module.exports = __toCommonJS(tool_exports);
28
+ var import_tool = require("@genkit-ai/ai/tool");
29
+ /**
30
+ * @license
31
+ *
32
+ * Copyright 2024 Google LLC
33
+ *
34
+ * Licensed under the Apache License, Version 2.0 (the "License");
35
+ * you may not use this file except in compliance with the License.
36
+ * You may obtain a copy of the License at
37
+ *
38
+ * http://www.apache.org/licenses/LICENSE-2.0
39
+ *
40
+ * Unless required by applicable law or agreed to in writing, software
41
+ * distributed under the License is distributed on an "AS IS" BASIS,
42
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43
+ * See the License for the specific language governing permissions and
44
+ * limitations under the License.
45
+ */
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ asTool,
49
+ dynamicTool,
50
+ interrupt,
51
+ toToolDefinition,
52
+ tool
53
+ });
54
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tool.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Tool types — action types, configuration, and helpers for defining tools\n * that models can call (function calling).\n *\n * ```ts\n * import { type ToolAction, type ToolConfig } from 'genkit/tool';\n * ```\n *\n * @module tool\n */\n\nexport {\n asTool,\n dynamicTool,\n interrupt,\n toToolDefinition,\n tool,\n type MultipartToolAction,\n type ToolAction,\n type ToolArgument,\n type ToolConfig,\n} from '@genkit-ai/ai/tool';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,kBAUO;AAvCP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
package/lib/tool.mjs ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2024 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import {
19
+ asTool,
20
+ dynamicTool,
21
+ interrupt,
22
+ toToolDefinition,
23
+ tool
24
+ } from "@genkit-ai/ai/tool";
25
+ export {
26
+ asTool,
27
+ dynamicTool,
28
+ interrupt,
29
+ toToolDefinition,
30
+ tool
31
+ };
32
+ //# sourceMappingURL=tool.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tool.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Tool types — action types, configuration, and helpers for defining tools\n * that models can call (function calling).\n *\n * ```ts\n * import { type ToolAction, type ToolConfig } from 'genkit/tool';\n * ```\n *\n * @module tool\n */\n\nexport {\n asTool,\n dynamicTool,\n interrupt,\n toToolDefinition,\n tool,\n type MultipartToolAction,\n type ToolAction,\n type ToolArgument,\n type ToolConfig,\n} from '@genkit-ai/ai/tool';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAKK;","names":[]}
@@ -0,0 +1 @@
1
+ export { PathMetadata, SPAN_TYPE_ATTR, SpanContextSchema, SpanData, SpanDataSchema, SpanMetadata, SpanMetadataSchema, SpanStatusSchema, TimeEventSchema, TraceData, TraceDataSchema, TraceMetadata, TraceMetadataSchema, TraceServerExporter, appendSpan, disableGenkitOTelInitialization, disableOTelRootSpanDetection, enableTelemetry, flushTracing, runInNewSpan, setCustomMetadataAttribute, setCustomMetadataAttributes, setTelemetryServerUrl, toDisplayPath } from '@genkit-ai/core/tracing';
@@ -0,0 +1 @@
1
+ export { PathMetadata, SPAN_TYPE_ATTR, SpanContextSchema, SpanData, SpanDataSchema, SpanMetadata, SpanMetadataSchema, SpanStatusSchema, TimeEventSchema, TraceData, TraceDataSchema, TraceMetadata, TraceMetadataSchema, TraceServerExporter, appendSpan, disableGenkitOTelInitialization, disableOTelRootSpanDetection, enableTelemetry, flushTracing, runInNewSpan, setCustomMetadataAttribute, setCustomMetadataAttributes, setTelemetryServerUrl, toDisplayPath } from '@genkit-ai/core/tracing';
package/lib/tracing.js ADDED
@@ -0,0 +1,82 @@
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
+ var tracing_exports = {};
20
+ __export(tracing_exports, {
21
+ SPAN_TYPE_ATTR: () => import_tracing.SPAN_TYPE_ATTR,
22
+ SpanContextSchema: () => import_tracing.SpanContextSchema,
23
+ SpanDataSchema: () => import_tracing.SpanDataSchema,
24
+ SpanMetadataSchema: () => import_tracing.SpanMetadataSchema,
25
+ SpanStatusSchema: () => import_tracing.SpanStatusSchema,
26
+ TimeEventSchema: () => import_tracing.TimeEventSchema,
27
+ TraceDataSchema: () => import_tracing.TraceDataSchema,
28
+ TraceMetadataSchema: () => import_tracing.TraceMetadataSchema,
29
+ TraceServerExporter: () => import_tracing.TraceServerExporter,
30
+ appendSpan: () => import_tracing.appendSpan,
31
+ disableGenkitOTelInitialization: () => import_tracing.disableGenkitOTelInitialization,
32
+ disableOTelRootSpanDetection: () => import_tracing.disableOTelRootSpanDetection,
33
+ enableTelemetry: () => import_tracing.enableTelemetry,
34
+ flushTracing: () => import_tracing.flushTracing,
35
+ runInNewSpan: () => import_tracing.runInNewSpan,
36
+ setCustomMetadataAttribute: () => import_tracing.setCustomMetadataAttribute,
37
+ setCustomMetadataAttributes: () => import_tracing.setCustomMetadataAttributes,
38
+ setTelemetryServerUrl: () => import_tracing.setTelemetryServerUrl,
39
+ toDisplayPath: () => import_tracing.toDisplayPath
40
+ });
41
+ module.exports = __toCommonJS(tracing_exports);
42
+ var import_tracing = require("@genkit-ai/core/tracing");
43
+ /**
44
+ * @license
45
+ *
46
+ * Copyright 2024 Google LLC
47
+ *
48
+ * Licensed under the Apache License, Version 2.0 (the "License");
49
+ * you may not use this file except in compliance with the License.
50
+ * You may obtain a copy of the License at
51
+ *
52
+ * http://www.apache.org/licenses/LICENSE-2.0
53
+ *
54
+ * Unless required by applicable law or agreed to in writing, software
55
+ * distributed under the License is distributed on an "AS IS" BASIS,
56
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
57
+ * See the License for the specific language governing permissions and
58
+ * limitations under the License.
59
+ */
60
+ // Annotate the CommonJS export names for ESM import in node:
61
+ 0 && (module.exports = {
62
+ SPAN_TYPE_ATTR,
63
+ SpanContextSchema,
64
+ SpanDataSchema,
65
+ SpanMetadataSchema,
66
+ SpanStatusSchema,
67
+ TimeEventSchema,
68
+ TraceDataSchema,
69
+ TraceMetadataSchema,
70
+ TraceServerExporter,
71
+ appendSpan,
72
+ disableGenkitOTelInitialization,
73
+ disableOTelRootSpanDetection,
74
+ enableTelemetry,
75
+ flushTracing,
76
+ runInNewSpan,
77
+ setCustomMetadataAttribute,
78
+ setCustomMetadataAttributes,
79
+ setTelemetryServerUrl,
80
+ toDisplayPath
81
+ });
82
+ //# sourceMappingURL=tracing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tracing.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Tracing and telemetry — span/trace schemas, custom metadata helpers, and\n * OpenTelemetry integration utilities.\n *\n * ```ts\n * import { runInNewSpan, setCustomMetadataAttributes } from 'genkit/tracing';\n * ```\n *\n * @module tracing\n */\n\nexport {\n SPAN_TYPE_ATTR,\n SpanContextSchema,\n SpanDataSchema,\n SpanMetadataSchema,\n SpanStatusSchema,\n TimeEventSchema,\n TraceDataSchema,\n TraceMetadataSchema,\n TraceServerExporter,\n appendSpan,\n disableGenkitOTelInitialization,\n disableOTelRootSpanDetection,\n enableTelemetry,\n flushTracing,\n runInNewSpan,\n setCustomMetadataAttribute,\n setCustomMetadataAttributes,\n setTelemetryServerUrl,\n toDisplayPath,\n type PathMetadata,\n type SpanData,\n type SpanMetadata,\n type TraceData,\n type TraceMetadata,\n} from '@genkit-ai/core/tracing';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,qBAyBO;AAtDP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2024 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import {
19
+ SPAN_TYPE_ATTR,
20
+ SpanContextSchema,
21
+ SpanDataSchema,
22
+ SpanMetadataSchema,
23
+ SpanStatusSchema,
24
+ TimeEventSchema,
25
+ TraceDataSchema,
26
+ TraceMetadataSchema,
27
+ TraceServerExporter,
28
+ appendSpan,
29
+ disableGenkitOTelInitialization,
30
+ disableOTelRootSpanDetection,
31
+ enableTelemetry,
32
+ flushTracing,
33
+ runInNewSpan,
34
+ setCustomMetadataAttribute,
35
+ setCustomMetadataAttributes,
36
+ setTelemetryServerUrl,
37
+ toDisplayPath
38
+ } from "@genkit-ai/core/tracing";
39
+ export {
40
+ SPAN_TYPE_ATTR,
41
+ SpanContextSchema,
42
+ SpanDataSchema,
43
+ SpanMetadataSchema,
44
+ SpanStatusSchema,
45
+ TimeEventSchema,
46
+ TraceDataSchema,
47
+ TraceMetadataSchema,
48
+ TraceServerExporter,
49
+ appendSpan,
50
+ disableGenkitOTelInitialization,
51
+ disableOTelRootSpanDetection,
52
+ enableTelemetry,
53
+ flushTracing,
54
+ runInNewSpan,
55
+ setCustomMetadataAttribute,
56
+ setCustomMetadataAttributes,
57
+ setTelemetryServerUrl,
58
+ toDisplayPath
59
+ };
60
+ //# sourceMappingURL=tracing.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tracing.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Tracing and telemetry — span/trace schemas, custom metadata helpers, and\n * OpenTelemetry integration utilities.\n *\n * ```ts\n * import { runInNewSpan, setCustomMetadataAttributes } from 'genkit/tracing';\n * ```\n *\n * @module tracing\n */\n\nexport {\n SPAN_TYPE_ATTR,\n SpanContextSchema,\n SpanDataSchema,\n SpanMetadataSchema,\n SpanStatusSchema,\n TimeEventSchema,\n TraceDataSchema,\n TraceMetadataSchema,\n TraceServerExporter,\n appendSpan,\n disableGenkitOTelInitialization,\n disableOTelRootSpanDetection,\n enableTelemetry,\n flushTracing,\n runInNewSpan,\n setCustomMetadataAttribute,\n setCustomMetadataAttributes,\n setTelemetryServerUrl,\n toDisplayPath,\n type PathMetadata,\n type SpanData,\n type SpanMetadata,\n type TraceData,\n type TraceMetadata,\n} from '@genkit-ai/core/tracing';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;","names":[]}
package/package.json ADDED
@@ -0,0 +1,233 @@
1
+ {
2
+ "name": "@ohos-ports/genkit",
3
+ "description": "Genkit AI framework",
4
+ "keywords": [
5
+ "genkit",
6
+ "ai",
7
+ "genai",
8
+ "generative-ai"
9
+ ],
10
+ "version": "1.42.0-beta.0",
11
+ "type": "commonjs",
12
+ "main": "./lib/cjs/index.js",
13
+ "homepage": "https://genkit.dev",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/ohos-ports/ohos-ports.git",
17
+ "directory": "ports/genkit/1.42.0"
18
+ },
19
+ "author": "genkit",
20
+ "license": "Apache-2.0",
21
+ "dependencies": {
22
+ "uuid": "^10.0.0",
23
+ "@genkit-ai/ai": "1.42.0",
24
+ "@genkit-ai/core": "1.42.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/body-parser": "^1.19.5",
28
+ "@types/express": "^4.17.21",
29
+ "@types/node": "^22.15.3",
30
+ "@types/uuid": "^9.0.6",
31
+ "npm-run-all": "^4.1.5",
32
+ "rimraf": "^6.0.1",
33
+ "tsup": "^8.3.5",
34
+ "@ohos-ports/tsx": "^4.22.4-beta.4",
35
+ "typescript": "^5.9.3"
36
+ },
37
+ "files": [
38
+ "genkit-ui",
39
+ "lib",
40
+ "src",
41
+ "*"
42
+ ],
43
+ "types": "lib/index.d.ts",
44
+ "exports": {
45
+ ".": {
46
+ "types": "./lib/index.d.ts",
47
+ "require": "./lib/index.js",
48
+ "import": "./lib/index.mjs",
49
+ "default": "./lib/index.js"
50
+ },
51
+ "./registry": {
52
+ "types": "./lib/registry.d.ts",
53
+ "require": "./lib/registry.js",
54
+ "import": "./lib/registry.mjs",
55
+ "default": "./lib/registry.js"
56
+ },
57
+ "./beta": {
58
+ "types": "./lib/beta.d.ts",
59
+ "require": "./lib/beta.js",
60
+ "import": "./lib/beta.mjs",
61
+ "default": "./lib/beta.js"
62
+ },
63
+ "./tracing": {
64
+ "types": "./lib/tracing.d.ts",
65
+ "require": "./lib/tracing.js",
66
+ "import": "./lib/tracing.mjs",
67
+ "default": "./lib/tracing.js"
68
+ },
69
+ "./logging": {
70
+ "types": "./lib/logging.d.ts",
71
+ "require": "./lib/logging.js",
72
+ "import": "./lib/logging.mjs",
73
+ "default": "./lib/logging.js"
74
+ },
75
+ "./schema": {
76
+ "types": "./lib/schema.d.ts",
77
+ "require": "./lib/schema.js",
78
+ "import": "./lib/schema.mjs",
79
+ "default": "./lib/schema.js"
80
+ },
81
+ "./formats": {
82
+ "types": "./lib/formats.d.ts",
83
+ "require": "./lib/formats.js",
84
+ "import": "./lib/formats.mjs",
85
+ "default": "./lib/formats.js"
86
+ },
87
+ "./retriever": {
88
+ "types": "./lib/retriever.d.ts",
89
+ "require": "./lib/retriever.js",
90
+ "import": "./lib/retriever.mjs",
91
+ "default": "./lib/retriever.js"
92
+ },
93
+ "./reranker": {
94
+ "types": "./lib/reranker.d.ts",
95
+ "require": "./lib/reranker.js",
96
+ "import": "./lib/reranker.mjs",
97
+ "default": "./lib/reranker.js"
98
+ },
99
+ "./embedder": {
100
+ "types": "./lib/embedder.d.ts",
101
+ "require": "./lib/embedder.js",
102
+ "import": "./lib/embedder.mjs",
103
+ "default": "./lib/embedder.js"
104
+ },
105
+ "./evaluator": {
106
+ "types": "./lib/evaluator.d.ts",
107
+ "require": "./lib/evaluator.js",
108
+ "import": "./lib/evaluator.mjs",
109
+ "default": "./lib/evaluator.js"
110
+ },
111
+ "./model": {
112
+ "types": "./lib/model.d.ts",
113
+ "require": "./lib/model.js",
114
+ "import": "./lib/model.mjs",
115
+ "default": "./lib/model.js"
116
+ },
117
+ "./model/middleware": {
118
+ "types": "./lib/middleware.d.ts",
119
+ "require": "./lib/middleware.js",
120
+ "import": "./lib/middleware.mjs",
121
+ "default": "./lib/middleware.js"
122
+ },
123
+ "./extract": {
124
+ "types": "./lib/extract.d.ts",
125
+ "require": "./lib/extract.js",
126
+ "import": "./lib/extract.mjs",
127
+ "default": "./lib/extract.js"
128
+ },
129
+ "./testing": {
130
+ "types": "./lib/testing.d.ts",
131
+ "require": "./lib/testing.js",
132
+ "import": "./lib/testing.mjs",
133
+ "default": "./lib/testing.js"
134
+ },
135
+ "./tool": {
136
+ "types": "./lib/tool.d.ts",
137
+ "require": "./lib/tool.js",
138
+ "import": "./lib/tool.mjs",
139
+ "default": "./lib/tool.js"
140
+ },
141
+ "./plugin": {
142
+ "types": "./lib/plugin.d.ts",
143
+ "require": "./lib/plugin.js",
144
+ "import": "./lib/plugin.mjs",
145
+ "default": "./lib/plugin.js"
146
+ },
147
+ "./beta/client": {
148
+ "types": "./lib/client/index.d.ts",
149
+ "require": "./lib/client/index.js",
150
+ "import": "./lib/client/index.mjs",
151
+ "default": "./lib/client/index.js"
152
+ },
153
+ "./context": {
154
+ "types": "./lib/context.d.ts",
155
+ "require": "./lib/context.js",
156
+ "import": "./lib/context.mjs",
157
+ "default": "./lib/context.js"
158
+ }
159
+ },
160
+ "typesVersions": {
161
+ "*": {
162
+ "metrics": [
163
+ "lib/metrics"
164
+ ],
165
+ "beta": [
166
+ "lib/beta"
167
+ ],
168
+ "registry": [
169
+ "lib/registry"
170
+ ],
171
+ "tracing": [
172
+ "lib/tracing"
173
+ ],
174
+ "logging": [
175
+ "lib/logging"
176
+ ],
177
+ "config": [
178
+ "lib/config"
179
+ ],
180
+ "runtime": [
181
+ "lib/runtime"
182
+ ],
183
+ "schema": [
184
+ "lib/schema"
185
+ ],
186
+ "formats": [
187
+ "lib/formats"
188
+ ],
189
+ "retriever": [
190
+ "lib/retriever"
191
+ ],
192
+ "embedder": [
193
+ "lib/embedder"
194
+ ],
195
+ "evaluator": [
196
+ "lib/evaluator"
197
+ ],
198
+ "model": [
199
+ "lib/model"
200
+ ],
201
+ "model/middleware": [
202
+ "lib/middleware"
203
+ ],
204
+ "extract": [
205
+ "lib/extract"
206
+ ],
207
+ "testing": [
208
+ "lib/testing"
209
+ ],
210
+ "tool": [
211
+ "lib/tool"
212
+ ],
213
+ "plugin": [
214
+ "lib/plugin"
215
+ ],
216
+ "beta/client": [
217
+ "lib/client/index"
218
+ ],
219
+ "context": [
220
+ "lib/context"
221
+ ]
222
+ }
223
+ },
224
+ "scripts": {
225
+ "check": "tsc",
226
+ "compile": "tsup-node",
227
+ "build:clean": "rimraf ./lib",
228
+ "build": "npm-run-all build:clean check compile",
229
+ "build:watch": "tsup-node --watch",
230
+ "test": "node --import tsx --test tests/*_test.ts",
231
+ "test:watch": "node --watch --import tsx --test tests/*_test.ts"
232
+ }
233
+ }
package/src/beta.ts ADDED
@@ -0,0 +1,85 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright 2025 Google LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * Beta features including interrupts, stream managers, and the experimental
21
+ * {@link GenkitBeta} class.
22
+ *
23
+ * ```ts
24
+ * import { genkit } from 'genkit/beta';
25
+ * ```
26
+ *
27
+ * @module beta
28
+ */
29
+
30
+ export {
31
+ AgentInitSchema,
32
+ AgentInputSchema,
33
+ AgentOutputSchema,
34
+ AgentStreamChunkSchema,
35
+ type AgentInit,
36
+ type AgentInput,
37
+ type AgentOutput,
38
+ } from '@genkit-ai/ai';
39
+ export { Session, type Artifact } from '@genkit-ai/ai/session';
40
+ export {
41
+ AgentError,
42
+ remoteAgent,
43
+ type AgentAPI,
44
+ type AgentChat,
45
+ type AgentChunk,
46
+ type AgentInterrupt,
47
+ type AgentResponse,
48
+ type AgentTurn,
49
+ type DetachedTask,
50
+ type RemoteAgentOptions,
51
+ } from './client/agent.js';
52
+
53
+ export type { AgentFinishReason } from './client/types.js';
54
+
55
+ export {
56
+ InMemoryStreamManager,
57
+ StreamNotFoundError,
58
+ type ActionStreamInput,
59
+ type ActionStreamSubscriber,
60
+ type StreamManager,
61
+ } from '@genkit-ai/core';
62
+ export { AsyncTaskQueue, lazy } from '@genkit-ai/core/async';
63
+ export * from './common.js';
64
+ export {
65
+ FileSessionStore,
66
+ GenkitBeta,
67
+ InMemorySessionStore,
68
+ SessionRunner,
69
+ applyPatch,
70
+ diff,
71
+ genkit,
72
+ type Agent,
73
+ type AgentFn,
74
+ type AgentStreamChunk,
75
+ type ClientTransform,
76
+ type GenkitBetaOptions,
77
+ type JsonPatch,
78
+ type JsonPatchOperation,
79
+ type SessionSnapshot,
80
+ type SessionSnapshotInput,
81
+ type SessionState,
82
+ type SessionStore,
83
+ type SessionStoreOptions,
84
+ type SnapshotMutator,
85
+ } from './genkit-beta.js';