Skip to content

Commit

Permalink
Adding missing .js suffixes to relative imports (required for mjs) (#108
Browse files Browse the repository at this point in the history
)
  • Loading branch information
pavelgj authored May 10, 2024
1 parent 9b3a7a7 commit df224ab
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 25 deletions.
10 changes: 7 additions & 3 deletions js/ai/src/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<I extends z.ZodTypeAny = z.ZodTypeAny> = (
input: z.infer<I>
Expand Down
9 changes: 8 additions & 1 deletion js/ai/src/retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<RetrieverOptions extends z.ZodTypeAny> = (
query: Document,
Expand Down
2 changes: 1 addition & 1 deletion js/core/src/reflectionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion js/core/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/dotprompt/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/evaluators/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
faithfulnessScore,
maliciousnessScore,
} from './metrics';
import { GenkitMetric } from './types';
import { GenkitMetric } from './types.js';
export { GenkitMetric };

const PLUGIN_NAME = 'genkitEval';
Expand Down
6 changes: 3 additions & 3 deletions js/plugins/evaluators/src/metrics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
3 changes: 1 addition & 2 deletions js/plugins/firebase/src/firestoreRetriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/

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,
Query,
QueryDocumentSnapshot,
} from 'firebase-admin/firestore';
import z from 'zod';
import { Part } from '../../../ai/lib/document';

function toContent(
d: QueryDocumentSnapshot,
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/google-cloud/src/gcpOpenTelemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions js/plugins/langchain/src/evaluators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/vertexai/src/embedder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/vertexai/src/evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/vertexai/src/evaluator_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/vertexai/src/imagen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
10 changes: 5 additions & 5 deletions js/plugins/vertexai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit df224ab

Please sign in to comment.