Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
jacoblee93 committed Jul 3, 2024
1 parent 6200a6f commit b9f6d49
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions libs/langchain-community/src/vectorstores/milvus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ export class Milvus extends VectorStore {
// Index creation parameters
const { indexCreateOptions } = args;
if (indexCreateOptions) {
const { metric_type, index_type, params, search_params = {} } = indexCreateOptions;
const {
metric_type,
index_type,
params,
search_params = {},
} = indexCreateOptions;
this.indexCreateParams = {
metric_type,
index_type,
Expand All @@ -168,18 +173,18 @@ export class Milvus extends VectorStore {
this.indexSearchParams = {
...DEFAULT_INDEX_SEARCH_PARAMS[index_type].params,
...search_params,
}
};
} else {
// Default index creation parameters.
this.indexCreateParams = {
index_type: "HNSW",
metric_type: "L2",
params: { M: 8, efConstruction: 64 },
}
};
// Default index search parameters.
this.indexSearchParams = {
...DEFAULT_INDEX_SEARCH_PARAMS.HNSW.params,
}
};
}

// combine args clientConfig and env variables
Expand Down Expand Up @@ -513,7 +518,7 @@ export class Milvus extends VectorStore {
const extraParams = {
...this.indexCreateParams,
params: JSON.stringify(this.indexCreateParams.params),
}
};
await this.client.createIndex({
collection_name: this.collectionName,
field_name: this.vectorField,
Expand Down

0 comments on commit b9f6d49

Please sign in to comment.