@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 @@
1
+ {"version":3,"sources":["../src/plugin.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 * Plugin authoring utilities — factory functions (`model`, `embedder`,\n * `retriever`, etc.), plugin lifecycle types, and the v1/v2 plugin\n * interfaces for building Genkit plugins.\n *\n * ```ts\n * import { model, embedder, genkitPlugin } from 'genkit/plugin';\n * ```\n *\n * @module plugin\n */\n\nimport type { GenerateMiddleware } from '@genkit-ai/ai';\nimport { type GenkitPluginV2 } from '@genkit-ai/ai';\nimport { type ModelAction } from '@genkit-ai/ai/model';\nimport {\n GenkitError,\n type ActionMetadata,\n type ResolvableAction,\n} from '@genkit-ai/core';\nimport type { Genkit } from './genkit.js';\nimport type { ActionType } from './registry.js';\n\nexport { embedder, embedderActionMetadata } from '@genkit-ai/ai/embedder';\nexport { evaluator } from '@genkit-ai/ai/evaluator';\nexport {\n backgroundModel,\n model,\n modelActionMetadata,\n} from '@genkit-ai/ai/model';\nexport { reranker } from '@genkit-ai/ai/reranker';\nexport { indexer, retriever } from '@genkit-ai/ai/retriever';\nexport { type GenerateMiddleware, type GenkitPluginV2, type ResolvableAction };\n\n/** A v1 plugin provider returned by a {@link GenkitPlugin} factory function. */\nexport interface PluginProvider {\n name: string;\n initializer: () => void | Promise<void>;\n resolver?: (action: ActionType, target: string) => Promise<void>;\n listActions?: () => Promise<ActionMetadata[]>;\n}\n\n/** A v1 Genkit plugin factory function. Returns a {@link PluginProvider} when called with a Genkit instance. */\nexport type GenkitPlugin = (genkit: Genkit) => PluginProvider;\n\n/** Initialization function called during plugin setup. */\nexport type PluginInit = (genkit: Genkit) => void | Promise<void>;\n\n/** Optional resolver function for lazily-resolved plugin actions. */\nexport type PluginActionResolver = (\n genkit: Genkit,\n action: ActionType,\n target: string\n) => Promise<void>;\n\n/**\n * Defines a Genkit plugin.\n */\nexport function genkitPlugin<T extends PluginInit>(\n pluginName: string,\n initFn: T,\n resolveFn?: PluginActionResolver,\n listActionsFn?: () => Promise<ActionMetadata[]>\n): GenkitPlugin {\n return (genkit: Genkit) => ({\n name: pluginName,\n initializer: async () => {\n await initFn(genkit);\n },\n resolver: async (action: ActionType, target: string): Promise<void> => {\n if (resolveFn) {\n return await resolveFn(genkit, action, target);\n }\n },\n listActions: async (): Promise<ActionMetadata[]> => {\n if (listActionsFn) {\n return await listActionsFn();\n }\n return [];\n },\n });\n}\n\n/**\n * Concrete implementation of a v2 plugin that wraps a {@link GenkitPluginV2} definition\n * and provides default implementations for all optional hooks.\n */\nexport class GenkitPluginV2Instance implements Required<GenkitPluginV2> {\n readonly version = 'v2';\n readonly name: string;\n\n private plugin: Omit<GenkitPluginV2, 'version' | 'model'>;\n\n constructor(plugin: Omit<GenkitPluginV2, 'version' | 'model'>) {\n this.name = plugin.name;\n this.plugin = plugin;\n }\n\n init(): ResolvableAction[] | Promise<ResolvableAction[]> {\n if (!this.plugin.init) {\n return [];\n }\n return this.plugin.init();\n }\n\n list(): ActionMetadata[] | Promise<ActionMetadata[]> {\n if (!this.plugin.list) {\n return [];\n }\n return this.plugin.list();\n }\n\n middleware(): GenerateMiddleware<any, any>[] {\n if (!this.plugin.middleware) {\n return [];\n }\n return this.plugin.middleware();\n }\n\n resolve(\n actionType: ActionType,\n name: string\n ): ResolvableAction | undefined | Promise<ResolvableAction | undefined> {\n if (!this.plugin.resolve) {\n return undefined;\n }\n return this.plugin.resolve(actionType, name);\n }\n\n async model(name: string): Promise<ModelAction> {\n const model = await this.resolve('model', name);\n if (!model) {\n throw new GenkitError({\n message: `Failed to resolve model ${name} for plugin ${this.name}`,\n status: 'NOT_FOUND',\n });\n }\n return model as ModelAction;\n }\n}\n\n/**\n * Creates a new v2 plugin instance from the provided options.\n */\nexport function genkitPluginV2(\n options: Omit<GenkitPluginV2, 'version' | 'model'>\n): GenkitPluginV2Instance {\n return new GenkitPluginV2Instance(options);\n}\n\n/** Checks whether the given plugin conforms to the v2 plugin interface. */\nexport function isPluginV2(plugin: unknown): plugin is GenkitPluginV2 {\n return (plugin as GenkitPluginV2).version === 'v2';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCA,kBAIO;AAIP,sBAAiD;AACjD,uBAA0B;AAC1B,IAAAA,gBAIO;AACP,sBAAyB;AACzB,uBAAmC;AAjDnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4EO,SAAS,aACd,YACA,QACA,WACA,eACc;AACd,SAAO,CAAC,YAAoB;AAAA,IAC1B,MAAM;AAAA,IACN,aAAa,YAAY;AACvB,YAAM,OAAO,MAAM;AAAA,IACrB;AAAA,IACA,UAAU,OAAO,QAAoB,WAAkC;AACrE,UAAI,WAAW;AACb,eAAO,MAAM,UAAU,QAAQ,QAAQ,MAAM;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,aAAa,YAAuC;AAClD,UAAI,eAAe;AACjB,eAAO,MAAM,cAAc;AAAA,MAC7B;AACA,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAMO,MAAM,uBAA2D;AAAA,EAC7D,UAAU;AAAA,EACV;AAAA,EAED;AAAA,EAER,YAAY,QAAmD;AAC7D,SAAK,OAAO,OAAO;AACnB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAyD;AACvD,QAAI,CAAC,KAAK,OAAO,MAAM;AACrB,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,OAAqD;AACnD,QAAI,CAAC,KAAK,OAAO,MAAM;AACrB,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,aAA6C;AAC3C,QAAI,CAAC,KAAK,OAAO,YAAY;AAC3B,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,WAAW;AAAA,EAChC;AAAA,EAEA,QACE,YACA,MACsE;AACtE,QAAI,CAAC,KAAK,OAAO,SAAS;AACxB,aAAO;AAAA,IACT;AACA,WAAO,KAAK,OAAO,QAAQ,YAAY,IAAI;AAAA,EAC7C;AAAA,EAEA,MAAM,MAAM,MAAoC;AAC9C,UAAMC,SAAQ,MAAM,KAAK,QAAQ,SAAS,IAAI;AAC9C,QAAI,CAACA,QAAO;AACV,YAAM,IAAI,wBAAY;AAAA,QACpB,SAAS,2BAA2B,IAAI,eAAe,KAAK,IAAI;AAAA,QAChE,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AACA,WAAOA;AAAA,EACT;AACF;AAKO,SAAS,eACd,SACwB;AACxB,SAAO,IAAI,uBAAuB,OAAO;AAC3C;AAGO,SAAS,WAAW,QAA2C;AACpE,SAAQ,OAA0B,YAAY;AAChD;","names":["import_model","model"]}
package/lib/plugin.mjs ADDED
@@ -0,0 +1,113 @@
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
+ GenkitError
20
+ } from "@genkit-ai/core";
21
+ import { embedder, embedderActionMetadata } from "@genkit-ai/ai/embedder";
22
+ import { evaluator } from "@genkit-ai/ai/evaluator";
23
+ import {
24
+ backgroundModel,
25
+ model,
26
+ modelActionMetadata
27
+ } from "@genkit-ai/ai/model";
28
+ import { reranker } from "@genkit-ai/ai/reranker";
29
+ import { indexer, retriever } from "@genkit-ai/ai/retriever";
30
+ function genkitPlugin(pluginName, initFn, resolveFn, listActionsFn) {
31
+ return (genkit) => ({
32
+ name: pluginName,
33
+ initializer: async () => {
34
+ await initFn(genkit);
35
+ },
36
+ resolver: async (action, target) => {
37
+ if (resolveFn) {
38
+ return await resolveFn(genkit, action, target);
39
+ }
40
+ },
41
+ listActions: async () => {
42
+ if (listActionsFn) {
43
+ return await listActionsFn();
44
+ }
45
+ return [];
46
+ }
47
+ });
48
+ }
49
+ class GenkitPluginV2Instance {
50
+ version = "v2";
51
+ name;
52
+ plugin;
53
+ constructor(plugin) {
54
+ this.name = plugin.name;
55
+ this.plugin = plugin;
56
+ }
57
+ init() {
58
+ if (!this.plugin.init) {
59
+ return [];
60
+ }
61
+ return this.plugin.init();
62
+ }
63
+ list() {
64
+ if (!this.plugin.list) {
65
+ return [];
66
+ }
67
+ return this.plugin.list();
68
+ }
69
+ middleware() {
70
+ if (!this.plugin.middleware) {
71
+ return [];
72
+ }
73
+ return this.plugin.middleware();
74
+ }
75
+ resolve(actionType, name) {
76
+ if (!this.plugin.resolve) {
77
+ return void 0;
78
+ }
79
+ return this.plugin.resolve(actionType, name);
80
+ }
81
+ async model(name) {
82
+ const model2 = await this.resolve("model", name);
83
+ if (!model2) {
84
+ throw new GenkitError({
85
+ message: `Failed to resolve model ${name} for plugin ${this.name}`,
86
+ status: "NOT_FOUND"
87
+ });
88
+ }
89
+ return model2;
90
+ }
91
+ }
92
+ function genkitPluginV2(options) {
93
+ return new GenkitPluginV2Instance(options);
94
+ }
95
+ function isPluginV2(plugin) {
96
+ return plugin.version === "v2";
97
+ }
98
+ export {
99
+ GenkitPluginV2Instance,
100
+ backgroundModel,
101
+ embedder,
102
+ embedderActionMetadata,
103
+ evaluator,
104
+ genkitPlugin,
105
+ genkitPluginV2,
106
+ indexer,
107
+ isPluginV2,
108
+ model,
109
+ modelActionMetadata,
110
+ reranker,
111
+ retriever
112
+ };
113
+ //# sourceMappingURL=plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin.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 * Plugin authoring utilities — factory functions (`model`, `embedder`,\n * `retriever`, etc.), plugin lifecycle types, and the v1/v2 plugin\n * interfaces for building Genkit plugins.\n *\n * ```ts\n * import { model, embedder, genkitPlugin } from 'genkit/plugin';\n * ```\n *\n * @module plugin\n */\n\nimport type { GenerateMiddleware } from '@genkit-ai/ai';\nimport { type GenkitPluginV2 } from '@genkit-ai/ai';\nimport { type ModelAction } from '@genkit-ai/ai/model';\nimport {\n GenkitError,\n type ActionMetadata,\n type ResolvableAction,\n} from '@genkit-ai/core';\nimport type { Genkit } from './genkit.mjs';\nimport type { ActionType } from './registry.mjs';\n\nexport { embedder, embedderActionMetadata } from '@genkit-ai/ai/embedder';\nexport { evaluator } from '@genkit-ai/ai/evaluator';\nexport {\n backgroundModel,\n model,\n modelActionMetadata,\n} from '@genkit-ai/ai/model';\nexport { reranker } from '@genkit-ai/ai/reranker';\nexport { indexer, retriever } from '@genkit-ai/ai/retriever';\nexport { type GenerateMiddleware, type GenkitPluginV2, type ResolvableAction };\n\n/** A v1 plugin provider returned by a {@link GenkitPlugin} factory function. */\nexport interface PluginProvider {\n name: string;\n initializer: () => void | Promise<void>;\n resolver?: (action: ActionType, target: string) => Promise<void>;\n listActions?: () => Promise<ActionMetadata[]>;\n}\n\n/** A v1 Genkit plugin factory function. Returns a {@link PluginProvider} when called with a Genkit instance. */\nexport type GenkitPlugin = (genkit: Genkit) => PluginProvider;\n\n/** Initialization function called during plugin setup. */\nexport type PluginInit = (genkit: Genkit) => void | Promise<void>;\n\n/** Optional resolver function for lazily-resolved plugin actions. */\nexport type PluginActionResolver = (\n genkit: Genkit,\n action: ActionType,\n target: string\n) => Promise<void>;\n\n/**\n * Defines a Genkit plugin.\n */\nexport function genkitPlugin<T extends PluginInit>(\n pluginName: string,\n initFn: T,\n resolveFn?: PluginActionResolver,\n listActionsFn?: () => Promise<ActionMetadata[]>\n): GenkitPlugin {\n return (genkit: Genkit) => ({\n name: pluginName,\n initializer: async () => {\n await initFn(genkit);\n },\n resolver: async (action: ActionType, target: string): Promise<void> => {\n if (resolveFn) {\n return await resolveFn(genkit, action, target);\n }\n },\n listActions: async (): Promise<ActionMetadata[]> => {\n if (listActionsFn) {\n return await listActionsFn();\n }\n return [];\n },\n });\n}\n\n/**\n * Concrete implementation of a v2 plugin that wraps a {@link GenkitPluginV2} definition\n * and provides default implementations for all optional hooks.\n */\nexport class GenkitPluginV2Instance implements Required<GenkitPluginV2> {\n readonly version = 'v2';\n readonly name: string;\n\n private plugin: Omit<GenkitPluginV2, 'version' | 'model'>;\n\n constructor(plugin: Omit<GenkitPluginV2, 'version' | 'model'>) {\n this.name = plugin.name;\n this.plugin = plugin;\n }\n\n init(): ResolvableAction[] | Promise<ResolvableAction[]> {\n if (!this.plugin.init) {\n return [];\n }\n return this.plugin.init();\n }\n\n list(): ActionMetadata[] | Promise<ActionMetadata[]> {\n if (!this.plugin.list) {\n return [];\n }\n return this.plugin.list();\n }\n\n middleware(): GenerateMiddleware<any, any>[] {\n if (!this.plugin.middleware) {\n return [];\n }\n return this.plugin.middleware();\n }\n\n resolve(\n actionType: ActionType,\n name: string\n ): ResolvableAction | undefined | Promise<ResolvableAction | undefined> {\n if (!this.plugin.resolve) {\n return undefined;\n }\n return this.plugin.resolve(actionType, name);\n }\n\n async model(name: string): Promise<ModelAction> {\n const model = await this.resolve('model', name);\n if (!model) {\n throw new GenkitError({\n message: `Failed to resolve model ${name} for plugin ${this.name}`,\n status: 'NOT_FOUND',\n });\n }\n return model as ModelAction;\n }\n}\n\n/**\n * Creates a new v2 plugin instance from the provided options.\n */\nexport function genkitPluginV2(\n options: Omit<GenkitPluginV2, 'version' | 'model'>\n): GenkitPluginV2Instance {\n return new GenkitPluginV2Instance(options);\n}\n\n/** Checks whether the given plugin conforms to the v2 plugin interface. */\nexport function isPluginV2(plugin: unknown): plugin is GenkitPluginV2 {\n return (plugin as GenkitPluginV2).version === 'v2';\n}\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCA;AAAA,EACE;AAAA,OAGK;AAIP,SAAS,UAAU,8BAA8B;AACjD,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,SAAS,iBAAiB;AA2B5B,SAAS,aACd,YACA,QACA,WACA,eACc;AACd,SAAO,CAAC,YAAoB;AAAA,IAC1B,MAAM;AAAA,IACN,aAAa,YAAY;AACvB,YAAM,OAAO,MAAM;AAAA,IACrB;AAAA,IACA,UAAU,OAAO,QAAoB,WAAkC;AACrE,UAAI,WAAW;AACb,eAAO,MAAM,UAAU,QAAQ,QAAQ,MAAM;AAAA,MAC/C;AAAA,IACF;AAAA,IACA,aAAa,YAAuC;AAClD,UAAI,eAAe;AACjB,eAAO,MAAM,cAAc;AAAA,MAC7B;AACA,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACF;AAMO,MAAM,uBAA2D;AAAA,EAC7D,UAAU;AAAA,EACV;AAAA,EAED;AAAA,EAER,YAAY,QAAmD;AAC7D,SAAK,OAAO,OAAO;AACnB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAyD;AACvD,QAAI,CAAC,KAAK,OAAO,MAAM;AACrB,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,OAAqD;AACnD,QAAI,CAAC,KAAK,OAAO,MAAM;AACrB,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,KAAK;AAAA,EAC1B;AAAA,EAEA,aAA6C;AAC3C,QAAI,CAAC,KAAK,OAAO,YAAY;AAC3B,aAAO,CAAC;AAAA,IACV;AACA,WAAO,KAAK,OAAO,WAAW;AAAA,EAChC;AAAA,EAEA,QACE,YACA,MACsE;AACtE,QAAI,CAAC,KAAK,OAAO,SAAS;AACxB,aAAO;AAAA,IACT;AACA,WAAO,KAAK,OAAO,QAAQ,YAAY,IAAI;AAAA,EAC7C;AAAA,EAEA,MAAM,MAAM,MAAoC;AAC9C,UAAMA,SAAQ,MAAM,KAAK,QAAQ,SAAS,IAAI;AAC9C,QAAI,CAACA,QAAO;AACV,YAAM,IAAI,YAAY;AAAA,QACpB,SAAS,2BAA2B,IAAI,eAAe,KAAK,IAAI;AAAA,QAChE,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AACA,WAAOA;AAAA,EACT;AACF;AAKO,SAAS,eACd,SACwB;AACxB,SAAO,IAAI,uBAAuB,OAAO;AAC3C;AAGO,SAAS,WAAW,QAA2C;AACpE,SAAQ,OAA0B,YAAY;AAChD;","names":["model"]}
@@ -0,0 +1 @@
1
+ export { ActionType, AsyncProvider, HasRegistry, Registry, Schema } from '@genkit-ai/core/registry';
@@ -0,0 +1 @@
1
+ export { ActionType, AsyncProvider, HasRegistry, Registry, Schema } from '@genkit-ai/core/registry';
@@ -0,0 +1,46 @@
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 registry_exports = {};
20
+ __export(registry_exports, {
21
+ Registry: () => import_registry.Registry
22
+ });
23
+ module.exports = __toCommonJS(registry_exports);
24
+ var import_registry = require("@genkit-ai/core/registry");
25
+ /**
26
+ * @license
27
+ *
28
+ * Copyright 2024 Google LLC
29
+ *
30
+ * Licensed under the Apache License, Version 2.0 (the "License");
31
+ * you may not use this file except in compliance with the License.
32
+ * You may obtain a copy of the License at
33
+ *
34
+ * http://www.apache.org/licenses/LICENSE-2.0
35
+ *
36
+ * Unless required by applicable law or agreed to in writing, software
37
+ * distributed under the License is distributed on an "AS IS" BASIS,
38
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39
+ * See the License for the specific language governing permissions and
40
+ * limitations under the License.
41
+ */
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ Registry
45
+ });
46
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry.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 * Action registry internals — `Registry`, `Schema`, and related types used by\n * plugin authors and advanced integrations.\n *\n * ```ts\n * import { Registry } from 'genkit/registry';\n * ```\n *\n * @module registry\n */\n\nexport {\n Registry,\n type ActionType,\n type AsyncProvider,\n type HasRegistry,\n type Schema,\n} from '@genkit-ai/core/registry';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,sBAMO;AAnCP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
@@ -0,0 +1,24 @@
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
+ Registry
20
+ } from "@genkit-ai/core/registry";
21
+ export {
22
+ Registry
23
+ };
24
+ //# sourceMappingURL=registry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry.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 * Action registry internals — `Registry`, `Schema`, and related types used by\n * plugin authors and advanced integrations.\n *\n * ```ts\n * import { Registry } from 'genkit/registry';\n * ```\n *\n * @module registry\n */\n\nexport {\n Registry,\n type ActionType,\n type AsyncProvider,\n type HasRegistry,\n type Schema,\n} from '@genkit-ai/core/registry';\n"],"mappings":"AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA;AAAA,EACE;AAAA,OAKK;","names":[]}
@@ -0,0 +1 @@
1
+ export { CommonRerankerOptionsSchema, RankedDocument, RankedDocumentData, RankedDocumentDataSchema, RerankerAction, RerankerArgument, RerankerInfo, RerankerInfoSchema, RerankerParams, RerankerReference, rerankerRef } from '@genkit-ai/ai/reranker';
@@ -0,0 +1 @@
1
+ export { CommonRerankerOptionsSchema, RankedDocument, RankedDocumentData, RankedDocumentDataSchema, RerankerAction, RerankerArgument, RerankerInfo, RerankerInfoSchema, RerankerParams, RerankerReference, rerankerRef } from '@genkit-ai/ai/reranker';
@@ -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 reranker_exports = {};
20
+ __export(reranker_exports, {
21
+ CommonRerankerOptionsSchema: () => import_reranker.CommonRerankerOptionsSchema,
22
+ RankedDocument: () => import_reranker.RankedDocument,
23
+ RankedDocumentDataSchema: () => import_reranker.RankedDocumentDataSchema,
24
+ RerankerInfoSchema: () => import_reranker.RerankerInfoSchema,
25
+ rerankerRef: () => import_reranker.rerankerRef
26
+ });
27
+ module.exports = __toCommonJS(reranker_exports);
28
+ var import_reranker = require("@genkit-ai/ai/reranker");
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
+ CommonRerankerOptionsSchema,
49
+ RankedDocument,
50
+ RankedDocumentDataSchema,
51
+ RerankerInfoSchema,
52
+ rerankerRef
53
+ });
54
+ //# sourceMappingURL=reranker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reranker.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 * Reranker types — `RankedDocument`, reference helpers, and schemas for\n * building reranker plugins.\n *\n * ```ts\n * import { RankedDocument, rerankerRef } from 'genkit/reranker';\n * ```\n *\n * @module reranker\n */\n\nexport {\n CommonRerankerOptionsSchema,\n RankedDocument,\n RankedDocumentDataSchema,\n RerankerInfoSchema,\n rerankerRef,\n type RankedDocumentData,\n type RerankerAction,\n type RerankerArgument,\n type RerankerInfo,\n type RerankerParams,\n type RerankerReference,\n} from '@genkit-ai/ai/reranker';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,sBAYO;AAzCP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
@@ -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
+ CommonRerankerOptionsSchema,
20
+ RankedDocument,
21
+ RankedDocumentDataSchema,
22
+ RerankerInfoSchema,
23
+ rerankerRef
24
+ } from "@genkit-ai/ai/reranker";
25
+ export {
26
+ CommonRerankerOptionsSchema,
27
+ RankedDocument,
28
+ RankedDocumentDataSchema,
29
+ RerankerInfoSchema,
30
+ rerankerRef
31
+ };
32
+ //# sourceMappingURL=reranker.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/reranker.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 * Reranker types — `RankedDocument`, reference helpers, and schemas for\n * building reranker plugins.\n *\n * ```ts\n * import { RankedDocument, rerankerRef } from 'genkit/reranker';\n * ```\n *\n * @module reranker\n */\n\nexport {\n CommonRerankerOptionsSchema,\n RankedDocument,\n RankedDocumentDataSchema,\n RerankerInfoSchema,\n rerankerRef,\n type RankedDocumentData,\n type RerankerAction,\n type RerankerArgument,\n type RerankerInfo,\n type RerankerParams,\n type RerankerReference,\n} from '@genkit-ai/ai/reranker';\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,OAOK;","names":[]}
@@ -0,0 +1 @@
1
+ export { CommonRetrieverOptionsSchema, Document, DocumentData, DocumentDataSchema, IndexerAction, IndexerArgument, IndexerFn, IndexerInfo, IndexerInfoSchema, IndexerParams, IndexerReference, MediaPart, Part, RetrieverAction, RetrieverArgument, RetrieverFn, RetrieverInfo, RetrieverInfoSchema, RetrieverParams, RetrieverReference, SimpleRetrieverOptions, TextPart, indexerRef, retrieverRef } from '@genkit-ai/ai/retriever';
@@ -0,0 +1 @@
1
+ export { CommonRetrieverOptionsSchema, Document, DocumentData, DocumentDataSchema, IndexerAction, IndexerArgument, IndexerFn, IndexerInfo, IndexerInfoSchema, IndexerParams, IndexerReference, MediaPart, Part, RetrieverAction, RetrieverArgument, RetrieverFn, RetrieverInfo, RetrieverInfoSchema, RetrieverParams, RetrieverReference, SimpleRetrieverOptions, TextPart, indexerRef, retrieverRef } from '@genkit-ai/ai/retriever';
@@ -0,0 +1,58 @@
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 retriever_exports = {};
20
+ __export(retriever_exports, {
21
+ CommonRetrieverOptionsSchema: () => import_retriever.CommonRetrieverOptionsSchema,
22
+ Document: () => import_retriever.Document,
23
+ DocumentDataSchema: () => import_retriever.DocumentDataSchema,
24
+ IndexerInfoSchema: () => import_retriever.IndexerInfoSchema,
25
+ RetrieverInfoSchema: () => import_retriever.RetrieverInfoSchema,
26
+ indexerRef: () => import_retriever.indexerRef,
27
+ retrieverRef: () => import_retriever.retrieverRef
28
+ });
29
+ module.exports = __toCommonJS(retriever_exports);
30
+ var import_retriever = require("@genkit-ai/ai/retriever");
31
+ /**
32
+ * @license
33
+ *
34
+ * Copyright 2024 Google LLC
35
+ *
36
+ * Licensed under the Apache License, Version 2.0 (the "License");
37
+ * you may not use this file except in compliance with the License.
38
+ * You may obtain a copy of the License at
39
+ *
40
+ * http://www.apache.org/licenses/LICENSE-2.0
41
+ *
42
+ * Unless required by applicable law or agreed to in writing, software
43
+ * distributed under the License is distributed on an "AS IS" BASIS,
44
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45
+ * See the License for the specific language governing permissions and
46
+ * limitations under the License.
47
+ */
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ CommonRetrieverOptionsSchema,
51
+ Document,
52
+ DocumentDataSchema,
53
+ IndexerInfoSchema,
54
+ RetrieverInfoSchema,
55
+ indexerRef,
56
+ retrieverRef
57
+ });
58
+ //# sourceMappingURL=retriever.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/retriever.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 * Retriever and indexer types — `Document`, reference helpers, and schemas for\n * building RAG (retrieval-augmented generation) plugins.\n *\n * ```ts\n * import { Document, retrieverRef, indexerRef } from 'genkit/retriever';\n * ```\n *\n * @module retriever\n */\n\nexport {\n CommonRetrieverOptionsSchema,\n Document,\n DocumentDataSchema,\n IndexerInfoSchema,\n RetrieverInfoSchema,\n indexerRef,\n retrieverRef,\n type DocumentData,\n type IndexerAction,\n type IndexerArgument,\n type IndexerFn,\n type IndexerInfo,\n type IndexerParams,\n type IndexerReference,\n type MediaPart,\n type Part,\n type RetrieverAction,\n type RetrieverArgument,\n type RetrieverFn,\n type RetrieverInfo,\n type RetrieverParams,\n type RetrieverReference,\n type SimpleRetrieverOptions,\n type TextPart,\n} from '@genkit-ai/ai/retriever';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,uBAyBO;AAtDP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
@@ -0,0 +1,36 @@
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
+ CommonRetrieverOptionsSchema,
20
+ Document,
21
+ DocumentDataSchema,
22
+ IndexerInfoSchema,
23
+ RetrieverInfoSchema,
24
+ indexerRef,
25
+ retrieverRef
26
+ } from "@genkit-ai/ai/retriever";
27
+ export {
28
+ CommonRetrieverOptionsSchema,
29
+ Document,
30
+ DocumentDataSchema,
31
+ IndexerInfoSchema,
32
+ RetrieverInfoSchema,
33
+ indexerRef,
34
+ retrieverRef
35
+ };
36
+ //# sourceMappingURL=retriever.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/retriever.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 * Retriever and indexer types — `Document`, reference helpers, and schemas for\n * building RAG (retrieval-augmented generation) plugins.\n *\n * ```ts\n * import { Document, retrieverRef, indexerRef } from 'genkit/retriever';\n * ```\n *\n * @module retriever\n */\n\nexport {\n CommonRetrieverOptionsSchema,\n Document,\n DocumentDataSchema,\n IndexerInfoSchema,\n RetrieverInfoSchema,\n indexerRef,\n retrieverRef,\n type DocumentData,\n type IndexerAction,\n type IndexerArgument,\n type IndexerFn,\n type IndexerInfo,\n type IndexerParams,\n type IndexerReference,\n type MediaPart,\n type Part,\n type RetrieverAction,\n type RetrieverArgument,\n type RetrieverFn,\n type RetrieverInfo,\n type RetrieverParams,\n type RetrieverReference,\n type SimpleRetrieverOptions,\n type TextPart,\n} from '@genkit-ai/ai/retriever';\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,OAkBK;","names":[]}
@@ -0,0 +1 @@
1
+ export { JSONSchema, ProvidedSchema, ValidationError, ValidationErrorDetail, ValidationResponse, annotateSchema, parseSchema, toJsonSchema, validateSchema } from '@genkit-ai/core/schema';
@@ -0,0 +1 @@
1
+ export { JSONSchema, ProvidedSchema, ValidationError, ValidationErrorDetail, ValidationResponse, annotateSchema, parseSchema, toJsonSchema, validateSchema } from '@genkit-ai/core/schema';
package/lib/schema.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 schema_exports = {};
20
+ __export(schema_exports, {
21
+ ValidationError: () => import_schema.ValidationError,
22
+ annotateSchema: () => import_schema.annotateSchema,
23
+ parseSchema: () => import_schema.parseSchema,
24
+ toJsonSchema: () => import_schema.toJsonSchema,
25
+ validateSchema: () => import_schema.validateSchema
26
+ });
27
+ module.exports = __toCommonJS(schema_exports);
28
+ var import_schema = require("@genkit-ai/core/schema");
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
+ ValidationError,
49
+ annotateSchema,
50
+ parseSchema,
51
+ toJsonSchema,
52
+ validateSchema
53
+ });
54
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.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 * Schema utilities — JSON Schema conversion, validation helpers, and related\n * types for working with Zod schemas in Genkit.\n *\n * ```ts\n * import { toJsonSchema, parseSchema, ValidationError } from 'genkit/schema';\n * ```\n *\n * @module schema\n */\n\nexport {\n ValidationError,\n annotateSchema,\n parseSchema,\n toJsonSchema,\n validateSchema,\n type JSONSchema,\n type ProvidedSchema,\n type ValidationErrorDetail,\n type ValidationResponse,\n} from '@genkit-ai/core/schema';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BA,oBAUO;AAvCP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
package/lib/schema.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
+ ValidationError,
20
+ annotateSchema,
21
+ parseSchema,
22
+ toJsonSchema,
23
+ validateSchema
24
+ } from "@genkit-ai/core/schema";
25
+ export {
26
+ ValidationError,
27
+ annotateSchema,
28
+ parseSchema,
29
+ toJsonSchema,
30
+ validateSchema
31
+ };
32
+ //# sourceMappingURL=schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/schema.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 * Schema utilities — JSON Schema conversion, validation helpers, and related\n * types for working with Zod schemas in Genkit.\n *\n * ```ts\n * import { toJsonSchema, parseSchema, ValidationError } from 'genkit/schema';\n * ```\n *\n * @module schema\n */\n\nexport {\n ValidationError,\n annotateSchema,\n parseSchema,\n toJsonSchema,\n validateSchema,\n type JSONSchema,\n type ProvidedSchema,\n type ValidationErrorDetail,\n type ValidationResponse,\n} from '@genkit-ai/core/schema';\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 { EchoModelOptions, MockChunk, MockContext, MockModel, MockModelOptions, MockRespond, MockRespondFn, MockResponse, echoModel, mockModel, testModels } from '@genkit-ai/ai/testing';
@@ -0,0 +1 @@
1
+ export { EchoModelOptions, MockChunk, MockContext, MockModel, MockModelOptions, MockRespond, MockRespondFn, MockResponse, echoModel, mockModel, testModels } from '@genkit-ai/ai/testing';
package/lib/testing.js ADDED
@@ -0,0 +1,50 @@
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 testing_exports = {};
20
+ __export(testing_exports, {
21
+ echoModel: () => import_testing.echoModel,
22
+ mockModel: () => import_testing.mockModel,
23
+ testModels: () => import_testing.testModels
24
+ });
25
+ module.exports = __toCommonJS(testing_exports);
26
+ var import_testing = require("@genkit-ai/ai/testing");
27
+ /**
28
+ * @license
29
+ *
30
+ * Copyright 2024 Google LLC
31
+ *
32
+ * Licensed under the Apache License, Version 2.0 (the "License");
33
+ * you may not use this file except in compliance with the License.
34
+ * You may obtain a copy of the License at
35
+ *
36
+ * http://www.apache.org/licenses/LICENSE-2.0
37
+ *
38
+ * Unless required by applicable law or agreed to in writing, software
39
+ * distributed under the License is distributed on an "AS IS" BASIS,
40
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41
+ * See the License for the specific language governing permissions and
42
+ * limitations under the License.
43
+ */
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ echoModel,
47
+ mockModel,
48
+ testModels
49
+ });
50
+ //# sourceMappingURL=testing.js.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;AAkCA,qBAYO;AA9CP;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}