Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AlabasterAxe committed Jul 15, 2024
1 parent f3d0df1 commit 05cc9f3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
4 changes: 2 additions & 2 deletions clients/js/src/embeddings/DefaultEmbeddingFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class DefaultEmbeddingFunction implements IEmbeddingFunction {
// @ts-ignore
if (_a.code === "MODULE_NOT_FOUND") {
throw new Error(
"Please install the chromadb-default-embed package to use the DefaultEmbeddingFunction, `npm install -S chromadb-default-embed`",
"Please install the chromadb-default-embed package to use the DefaultEmbeddingFunction, `npm install chromadb-default-embed`",
);
}
throw _a; // Re-throw other errors
Expand Down Expand Up @@ -111,7 +111,7 @@ export class DefaultEmbeddingFunction implements IEmbeddingFunction {
return { pipeline };
} catch (e) {
throw new Error(
"Please install chromadb-default-embed as a dependency with, e.g. `yarn add chromadb-default-embed`",
"Please install chromadb-default-embed as a dependency with, e.g. `npm install chromadb-default-embed`",
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/embeddings/GoogleGeminiEmbeddingFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction {
// @ts-ignore
if (_a.code === "MODULE_NOT_FOUND") {
throw new Error(
"Please install the @google/generative-ai package to use the GoogleGenerativeAiEmbeddingFunction, `npm install -S @google/generative-ai`"
"Please install the @google/generative-ai package to use the GoogleGenerativeAiEmbeddingFunction, `npm install @google/generative-ai`",
);
}
throw _a; // Re-throw other errors
Expand Down Expand Up @@ -72,7 +72,7 @@ export class GoogleGenerativeAiEmbeddingFunction implements IEmbeddingFunction {
return { googleGenAi };
} catch (e) {
throw new Error(
"Please install @google/generative-ai as a dependency with, e.g. `yarn add @google/generative-ai`"
"Please install @google/generative-ai as a dependency with, e.g. `npm install @google/generative-ai`",
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/embeddings/OpenAIEmbeddingFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class OpenAIEmbeddingFunction implements IEmbeddingFunction {
// @ts-ignore
if (_a.code === "MODULE_NOT_FOUND") {
throw new Error(
"Please install the openai package to use the OpenAIEmbeddingFunction, `npm install -S openai`"
"Please install the openai package to use the OpenAIEmbeddingFunction, e.g. `npm install openai`",
);
}
throw _a; // Re-throw other errors
Expand Down Expand Up @@ -151,7 +151,7 @@ export class OpenAIEmbeddingFunction implements IEmbeddingFunction {
return { openai, version: VERSION };
} catch (e) {
throw new Error(
"Please install openai as a dependency with, e.g. `yarn add openai`"
"Please install the openai package to use the OpenAIEmbeddingFunction, e.g. `npm install openai`",
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/embeddings/TransformersEmbeddingFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TransformersEmbeddingFunction implements IEmbeddingFunction {
// @ts-ignore
if (_a.code === "MODULE_NOT_FOUND") {
throw new Error(
"Please install the @xenova/transformers package to use the TransformersEmbeddingFunction, `npm install -S @xenova/transformers`",
"Please install the @xenova/transformers package to use the TransformersEmbeddingFunction, `npm install @xenova/transformers`",
);
}
throw _a; // Re-throw other errors
Expand All @@ -94,7 +94,7 @@ export class TransformersEmbeddingFunction implements IEmbeddingFunction {
return { pipeline };
} catch (e) {
throw new Error(
"Please install @xenova/transformers as a dependency with, e.g. `yarn add @xenova/transformers`",
"Please install @xenova/transformers as a dependency with, e.g. `npm install @xenova/transformers`",
);
}
}
Expand Down
22 changes: 15 additions & 7 deletions docs/docs.trychroma.com/pages/integrations/google-gemini.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'Google Generative AI'
title: "Google Generative AI"
---

{% tabs group="code-lang" hideContent=true %}
Expand Down Expand Up @@ -38,18 +38,26 @@ For more info - please visit the [official Google python docs](https://ai.google
{% /tab %}
{% tab label="Javascript" %}

This embedding function relies on the `@google/generative-ai` npm package, which you can install with `yarn add @google/generative-ai`.
This embedding function relies on the `@google/generative-ai` npm package, which you can install with e.g. `npm install @google/generative-ai`.

```javascript
import { ChromaClient, GoogleGenerativeAiEmbeddingFunction } from 'chromadb'
const embedder = new GoogleGenerativeAiEmbeddingFunction({googleApiKey: "<YOUR API KEY>"})
import { ChromaClient, GoogleGenerativeAiEmbeddingFunction } from "chromadb";
const embedder = new GoogleGenerativeAiEmbeddingFunction({
googleApiKey: "<YOUR API KEY>",
});

// use directly
const embeddings = await embedder.generate(["document1","document2"])
const embeddings = await embedder.generate(["document1", "document2"]);

// pass documents to query for .add and .query
const collection = await client.createCollection({name: "name", embeddingFunction: embedder})
const collectionGet = await client.getCollection({name:"name", embeddingFunction: embedder})
const collection = await client.createCollection({
name: "name",
embeddingFunction: embedder,
});
const collectionGet = await client.getCollection({
name: "name",
embeddingFunction: embedder,
});
```

You can view a more [complete example using Node](https://github.com/chroma-core/chroma/blob/main/clients/js/examples/node/app.js).
Expand Down

0 comments on commit 05cc9f3

Please sign in to comment.