UNPKG

@genkit-ai/core

Version:

Genkit AI framework core libraries.

1 lines 3.47 kB
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\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\nimport { version } from './__codegen/version.js';\n\n/**\n * Genkit library version.\n */\nexport const GENKIT_VERSION = version;\n\n/**\n * Genkit client header for API calls.\n */\nexport const GENKIT_CLIENT_HEADER = `genkit-node/${GENKIT_VERSION} gl-node/${process.versions.node}`;\nexport const GENKIT_REFLECTION_API_SPEC_VERSION = 1;\n\nexport { z } from 'zod';\nexport * from './action.js';\nexport { getAsyncContext } from './async-context.js';\nexport {\n OperationSchema,\n backgroundAction,\n defineBackgroundAction,\n isBackgroundAction,\n registerBackgroundAction,\n type BackgroundAction,\n type BackgroundActionFnArg,\n type BackgroundActionParams,\n type BackgroundActionRunOptions,\n type Operation,\n} from './background-action.js';\nexport {\n apiKey,\n getContext,\n runWithContext,\n type ActionContext,\n type ApiKeyContext,\n type ContextProvider,\n type RequestData,\n} from './context.js';\nexport {\n defineDynamicActionProvider,\n type DapConfig,\n type DapFn,\n type DynamicActionProviderAction,\n} from './dynamic-action-provider.js';\nexport {\n GenkitError,\n UnstableApiError,\n UserFacingError,\n assertUnstable,\n getCallableJSON,\n getHttpStatus,\n type StatusName,\n} from './error.js';\nexport {\n defineFlow,\n flow,\n run,\n type Flow,\n type FlowConfig,\n type FlowFn,\n type FlowSideChannel,\n} from './flow.js';\nexport * from './plugin.js';\nexport * from './reflection.js';\nexport { defineJsonSchema, defineSchema, type JSONSchema } from './schema.js';\nexport * from './telemetryTypes.js';\nexport * from './utils.js';\n\nconst clientHeaderGlobalKey = '__genkit_ClientHeader';\n\n/** Additional attribution information to include in the x-goog-api-client header. */\nexport function getClientHeader() {\n if (global[clientHeaderGlobalKey]) {\n return GENKIT_CLIENT_HEADER + ' ' + global[clientHeaderGlobalKey];\n }\n return GENKIT_CLIENT_HEADER;\n}\n\n/** Sets additional attribution information to include in the x-goog-api-client header. */\nexport function setClientHeader(header: string) {\n global[clientHeaderGlobalKey] = header;\n}\n"],"mappings":"AAgBA,SAAS,eAAe;AAKjB,MAAM,iBAAiB;AAKvB,MAAM,uBAAuB,eAAe,cAAc,YAAY,QAAQ,SAAS,IAAI;AAC3F,MAAM,qCAAqC;AAElD,SAAS,SAAS;AAClB,cAAc;AACd,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP;AAAA,EACE;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;AACP,cAAc;AACd,cAAc;AACd,SAAS,kBAAkB,oBAAqC;AAChE,cAAc;AACd,cAAc;AAEd,MAAM,wBAAwB;AAGvB,SAAS,kBAAkB;AAChC,MAAI,OAAO,qBAAqB,GAAG;AACjC,WAAO,uBAAuB,MAAM,OAAO,qBAAqB;AAAA,EAClE;AACA,SAAO;AACT;AAGO,SAAS,gBAAgB,QAAgB;AAC9C,SAAO,qBAAqB,IAAI;AAClC;","names":[]}