Skip to content

Commit

Permalink
add clientParams fields to ChromaLibArgs type
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Aug 2, 2024
1 parent b0921d9 commit c516cb0
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions libs/langchain-community/src/vectorstores/chroma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import type { EmbeddingsInterface } from "@langchain/core/embeddings";
import { VectorStore } from "@langchain/core/vectorstores";
import { Document } from "@langchain/core/documents";

type SharedChromaLibArgs = {
numDimensions?: number;
collectionName?: string;
filter?: object;
collectionMetadata?: CollectionMetadata;
clientParams?: Omit<ChromaClientParams, "path">;
};

/**
* Defines the arguments that can be passed to the `Chroma` class
* constructor. It can either contain a `url` for the Chroma database, the
Expand All @@ -20,20 +28,12 @@ import { Document } from "@langchain/core/documents";
* `filter`.
*/
export type ChromaLibArgs =
| {
| ({
url?: string;
numDimensions?: number;
collectionName?: string;
filter?: object;
collectionMetadata?: CollectionMetadata;
}
| {
} & SharedChromaLibArgs)
| ({
index?: ChromaClientT;
numDimensions?: number;
collectionName?: string;
filter?: object;
collectionMetadata?: CollectionMetadata;
};
} & SharedChromaLibArgs);

/**
* Defines the parameters for the `delete` method in the `Chroma` class.
Expand Down Expand Up @@ -73,10 +73,7 @@ export class Chroma extends VectorStore {
return "chroma";
}

constructor(
embeddings: EmbeddingsInterface,
args: ChromaLibArgs & { clientParams?: Omit<ChromaClientParams, "path"> }
) {
constructor(embeddings: EmbeddingsInterface, args: ChromaLibArgs) {
super(embeddings, args);
this.numDimensions = args.numDimensions;
this.embeddings = embeddings;
Expand Down

0 comments on commit c516cb0

Please sign in to comment.