Skip to content

Commit b253aab

Browse files
committed
chore: improvements based on PR comments
1 parent 4588224 commit b253aab

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/common/search/embeddingsProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class VoyageEmbeddingsProvider implements EmbeddingsProvider<VoyageModels, Voyag
4242
private readonly voyage: VoyageProvider;
4343

4444
constructor({ voyageApiKey }: UserConfig, providedFetch?: typeof fetch) {
45-
assert(voyageApiKey, "voyageApiKey does not exist. This is likely a bug.");
45+
assert(voyageApiKey, "The VoyageAI API Key does not exist. This is likely a bug.");
4646

4747
// We should always use, by default, any enterprise proxy that the user has configured.
4848
// Direct requests to VoyageAI might get blocked by the network if they don't go through

src/common/search/vectorSearchEmbeddingsManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class VectorSearchEmbeddingsManager {
5555
database: string;
5656
collection: string;
5757
}): Promise<VectorFieldIndexDefinition[]> {
58-
const provider = await this.assertAtlasSearchIsAvailable();
58+
const provider = await this.atlasSearchEnabledProvider();
5959
if (!provider) {
6060
return [];
6161
}
@@ -94,7 +94,7 @@ export class VectorSearchEmbeddingsManager {
9494
},
9595
document: Document
9696
): Promise<VectorFieldValidationError[]> {
97-
const provider = await this.assertAtlasSearchIsAvailable();
97+
const provider = await this.atlasSearchEnabledProvider();
9898
if (!provider) {
9999
return [];
100100
}
@@ -112,7 +112,7 @@ export class VectorSearchEmbeddingsManager {
112112
.filter((e) => e !== undefined);
113113
}
114114

115-
private async assertAtlasSearchIsAvailable(): Promise<NodeDriverServiceProvider | null> {
115+
private async atlasSearchEnabledProvider(): Promise<NodeDriverServiceProvider | null> {
116116
const connectionState = this.connectionManager.currentConnectionState;
117117
if (connectionState.tag === "connected" && (await connectionState.isSearchSupported())) {
118118
return connectionState.serviceProvider;
@@ -235,7 +235,7 @@ export class VectorSearchEmbeddingsManager {
235235
embeddingParameters: SupportedEmbeddingParameters;
236236
inputType: EmbeddingParameters["inputType"];
237237
}): Promise<unknown[]> {
238-
const provider = await this.assertAtlasSearchIsAvailable();
238+
const provider = await this.atlasSearchEnabledProvider();
239239
if (!provider) {
240240
throw new MongoDBError(
241241
ErrorCodes.AtlasSearchNotSupported,

0 commit comments

Comments
 (0)