Skip to content

Commit 9b86221

Browse files
committed
chore: Only destruct what we actually need
1 parent f916db9 commit 9b86221

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/common/search/embeddingsProvider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ type VoyageModels = z.infer<typeof zVoyageModels>;
4949
class VoyageEmbeddingsProvider implements EmbeddingsProvider<VoyageModels> {
5050
private readonly voyage: VoyageProvider;
5151

52-
constructor(userConfig: UserConfig, providedFetch?: typeof fetch) {
53-
assert(userConfig.voyageApiKey, "voyageApiKey does not exist. This is likely a bug.");
52+
constructor({ voyageApiKey }: UserConfig, providedFetch?: typeof fetch) {
53+
assert(voyageApiKey, "voyageApiKey does not exist. This is likely a bug.");
5454

5555
const customFetch: typeof fetch = (providedFetch ??
5656
createFetch({ useEnvironmentVariableProxies: true })) as unknown as typeof fetch;
5757

58-
this.voyage = createVoyage({ apiKey: userConfig.voyageApiKey, fetch: customFetch });
58+
this.voyage = createVoyage({ apiKey: voyageApiKey, fetch: customFetch });
5959
}
6060

61-
static isConfiguredIn(userConfig: UserConfig): boolean {
62-
return !!userConfig.voyageApiKey;
61+
static isConfiguredIn({ voyageApiKey }: UserConfig): boolean {
62+
return !!voyageApiKey;
6363
}
6464

6565
async embed<Model extends VoyageModels>(

0 commit comments

Comments
 (0)