diff --git a/js/ai/src/prompt.ts b/js/ai/src/prompt.ts index 373ce3bf0..d2f8a7603 100644 --- a/js/ai/src/prompt.ts +++ b/js/ai/src/prompt.ts @@ -17,9 +17,13 @@ import { Action, defineAction, JSONSchema7 } from '@genkit-ai/core'; import { lookupAction } from '@genkit-ai/core/registry'; import z from 'zod'; -import { DocumentData } from './document'; -import { GenerateOptions } from './generate'; -import { GenerateRequest, GenerateRequestSchema, ModelArgument } from './model'; +import { DocumentData } from './document.js'; +import { GenerateOptions } from './generate.js'; +import { + GenerateRequest, + GenerateRequestSchema, + ModelArgument, +} from './model.js'; export type PromptFn = ( input: z.infer diff --git a/js/ai/src/retriever.ts b/js/ai/src/retriever.ts index f88514454..1ea4d9a4e 100644 --- a/js/ai/src/retriever.ts +++ b/js/ai/src/retriever.ts @@ -20,7 +20,14 @@ import * as z from 'zod'; import { Document, DocumentData, DocumentDataSchema } from './document.js'; import { EmbedderInfo } from './embedder.js'; -export { Document, DocumentData, DocumentDataSchema } from './document.js'; +export { + Document, + DocumentData, + DocumentDataSchema, + MediaPart, + Part, + TextPart, +} from './document.js'; type RetrieverFn = ( query: Document, diff --git a/js/core/src/reflectionApi.ts b/js/core/src/reflectionApi.ts index 15bc547cf..aed10708c 100644 --- a/js/core/src/reflectionApi.ts +++ b/js/core/src/reflectionApi.ts @@ -21,8 +21,8 @@ import { config } from './config.js'; import { logger } from './logging.js'; import * as registry from './registry.js'; import { toJsonSchema } from './schema.js'; -import { cleanUpTracing } from './tracing'; import { + cleanUpTracing, flushTracing, newTrace, setCustomMetadataAttribute, diff --git a/js/core/src/tracing.ts b/js/core/src/tracing.ts index e4104c522..07dafd2a4 100644 --- a/js/core/src/tracing.ts +++ b/js/core/src/tracing.ts @@ -21,7 +21,7 @@ import { SpanProcessor, } from '@opentelemetry/sdk-trace-base'; import { getCurrentEnv } from './config.js'; -import { logger } from './logging'; +import { logger } from './logging.js'; import { TelemetryConfig } from './telemetryTypes.js'; import { TraceStore } from './tracing.js'; import { TraceStoreExporter } from './tracing/exporter.js'; diff --git a/js/plugins/dotprompt/src/metadata.ts b/js/plugins/dotprompt/src/metadata.ts index fba380795..9073e860c 100644 --- a/js/plugins/dotprompt/src/metadata.ts +++ b/js/plugins/dotprompt/src/metadata.ts @@ -26,7 +26,7 @@ import { import { ToolArgument } from '@genkit-ai/ai/tool'; import { JSONSchema, parseSchema, toJsonSchema } from '@genkit-ai/core/schema'; import z from 'zod'; -import { picoschema } from './picoschema'; +import { picoschema } from './picoschema.js'; /** * Metadata for a prompt. diff --git a/js/plugins/evaluators/src/index.ts b/js/plugins/evaluators/src/index.ts index 46a3d6eba..d26410428 100644 --- a/js/plugins/evaluators/src/index.ts +++ b/js/plugins/evaluators/src/index.ts @@ -30,7 +30,7 @@ import { faithfulnessScore, maliciousnessScore, } from './metrics'; -import { GenkitMetric } from './types'; +import { GenkitMetric } from './types.js'; export { GenkitMetric }; const PLUGIN_NAME = 'genkitEval'; diff --git a/js/plugins/evaluators/src/metrics/index.ts b/js/plugins/evaluators/src/metrics/index.ts index 2ef7d1bcc..869a6e10c 100644 --- a/js/plugins/evaluators/src/metrics/index.ts +++ b/js/plugins/evaluators/src/metrics/index.ts @@ -14,6 +14,6 @@ * limitations under the License. */ -export { answerRelevancyScore } from './answer_relevancy'; -export { faithfulnessScore } from './faithfulness'; -export { maliciousnessScore } from './maliciousness'; +export { answerRelevancyScore } from './answer_relevancy.js'; +export { faithfulnessScore } from './faithfulness.js'; +export { maliciousnessScore } from './maliciousness.js'; diff --git a/js/plugins/firebase/src/firestoreRetriever.ts b/js/plugins/firebase/src/firestoreRetriever.ts index fd97ab128..b1c6fbc8d 100644 --- a/js/plugins/firebase/src/firestoreRetriever.ts +++ b/js/plugins/firebase/src/firestoreRetriever.ts @@ -15,7 +15,7 @@ */ import { embed, EmbedderArgument } from '@genkit-ai/ai/embedder'; -import { defineRetriever, DocumentData } from '@genkit-ai/ai/retriever'; +import { defineRetriever, DocumentData, Part } from '@genkit-ai/ai/retriever'; import { VectorQuerySnapshot } from '@google-cloud/firestore'; import { Firestore, @@ -23,7 +23,6 @@ import { QueryDocumentSnapshot, } from 'firebase-admin/firestore'; import z from 'zod'; -import { Part } from '../../../ai/lib/document'; function toContent( d: QueryDocumentSnapshot, diff --git a/js/plugins/google-cloud/src/gcpOpenTelemetry.ts b/js/plugins/google-cloud/src/gcpOpenTelemetry.ts index ef74ebaac..756e4de81 100644 --- a/js/plugins/google-cloud/src/gcpOpenTelemetry.ts +++ b/js/plugins/google-cloud/src/gcpOpenTelemetry.ts @@ -40,7 +40,7 @@ import { ReadableSpan, SpanExporter, } from '@opentelemetry/sdk-trace-base'; -import { PluginOptions } from './index'; +import { PluginOptions } from './index.js'; /** * Provides a {TelemetryConfig} for exporting OpenTelemetry data (Traces, diff --git a/js/plugins/langchain/src/evaluators.ts b/js/plugins/langchain/src/evaluators.ts index e8bc998c1..cf149db44 100644 --- a/js/plugins/langchain/src/evaluators.ts +++ b/js/plugins/langchain/src/evaluators.ts @@ -17,8 +17,8 @@ import { BaseDataPointSchema, defineEvaluator } from '@genkit-ai/ai/evaluator'; import { ModelArgument } from '@genkit-ai/ai/model'; import { Criteria, loadEvaluator } from 'langchain/evaluation'; -import { genkitModel } from './model'; -import { GenkitTracer } from './tracing'; +import { genkitModel } from './model.js'; +import { GenkitTracer } from './tracing.js'; export function langchainEvaluator( type: 'labeled_criteria' | 'criteria', diff --git a/js/plugins/vertexai/src/embedder.ts b/js/plugins/vertexai/src/embedder.ts index 79435f367..5de795b06 100644 --- a/js/plugins/vertexai/src/embedder.ts +++ b/js/plugins/vertexai/src/embedder.ts @@ -21,7 +21,7 @@ import { } from '@genkit-ai/ai/embedder'; import { GoogleAuth } from 'google-auth-library'; import { z } from 'zod'; -import { PluginOptions } from '.'; +import { PluginOptions } from './index.js'; import { predictModel } from './predict.js'; export const TaskTypeSchema = z.enum([ diff --git a/js/plugins/vertexai/src/evaluation.ts b/js/plugins/vertexai/src/evaluation.ts index 39aeb6168..6a4de304c 100644 --- a/js/plugins/vertexai/src/evaluation.ts +++ b/js/plugins/vertexai/src/evaluation.ts @@ -17,7 +17,7 @@ import { Action } from '@genkit-ai/core'; import { GoogleAuth } from 'google-auth-library'; import z from 'zod'; -import { EvaluatorFactory } from './evaluator_factory'; +import { EvaluatorFactory } from './evaluator_factory.js'; /** * Vertex AI Evaluation metrics. See API documentation for more information. diff --git a/js/plugins/vertexai/src/evaluator_factory.ts b/js/plugins/vertexai/src/evaluator_factory.ts index ef8351c9e..2de3d3833 100644 --- a/js/plugins/vertexai/src/evaluator_factory.ts +++ b/js/plugins/vertexai/src/evaluator_factory.ts @@ -19,7 +19,7 @@ import { Action, GENKIT_CLIENT_HEADER } from '@genkit-ai/core'; import { runInNewSpan } from '@genkit-ai/core/tracing'; import { GoogleAuth } from 'google-auth-library'; import z from 'zod'; -import { VertexAIEvaluationMetricType } from './evaluation'; +import { VertexAIEvaluationMetricType } from './evaluation.js'; export class EvaluatorFactory { constructor( diff --git a/js/plugins/vertexai/src/imagen.ts b/js/plugins/vertexai/src/imagen.ts index 54aff6418..dd654f922 100644 --- a/js/plugins/vertexai/src/imagen.ts +++ b/js/plugins/vertexai/src/imagen.ts @@ -24,7 +24,7 @@ import { } from '@genkit-ai/ai/model'; import { GoogleAuth } from 'google-auth-library'; import z from 'zod'; -import { PluginOptions } from '.'; +import { PluginOptions } from './index.js'; import { predictModel } from './predict.js'; const ImagenConfigSchema = GenerationCommonConfigSchema.extend({ diff --git a/js/plugins/vertexai/src/index.ts b/js/plugins/vertexai/src/index.ts index a8757b092..a1de76e4e 100644 --- a/js/plugins/vertexai/src/index.ts +++ b/js/plugins/vertexai/src/index.ts @@ -24,25 +24,25 @@ import { claude3Opus, claude3Sonnet, SUPPORTED_ANTHROPIC_MODELS, -} from './anthropic'; +} from './anthropic.js'; import { SUPPORTED_EMBEDDER_MODELS, textEmbeddingGecko, textEmbeddingGeckoEmbedder, -} from './embedder'; +} from './embedder.js'; import { VertexAIEvaluationMetric, VertexAIEvaluationMetricType, vertexEvaluators, -} from './evaluation'; +} from './evaluation.js'; import { gemini15ProPreview, geminiModel, geminiPro, geminiProVision, SUPPORTED_GEMINI_MODELS, -} from './gemini'; -import { imagen2, imagen2Model } from './imagen'; +} from './gemini.js'; +import { imagen2, imagen2Model } from './imagen.js'; export { claude3Haiku,