fix(node): make openai and huggingface optional dependencies (#1809)

BREAKING CHANGE: openai and huggingface now have separate entrypoints.

Closes [#1624](https://github.com/lancedb/lancedb/issues/1624)
This commit is contained in:
Will Jones
2024-11-14 15:04:35 -08:00
committed by GitHub
parent 119d88b9db
commit b38a4269d0
4 changed files with 9 additions and 12 deletions

View File

@@ -6,12 +6,16 @@ import { withTempDirectory } from "./util.ts";
import * as lancedb from "@lancedb/lancedb";
import "@lancedb/lancedb/embedding/transformers";
import { LanceSchema, getRegistry } from "@lancedb/lancedb/embedding";
import { EmbeddingFunction } from "@lancedb/lancedb/embedding";
import { Utf8 } from "apache-arrow";
test("full text search", async () => {
await withTempDirectory(async (databaseDir) => {
const db = await lancedb.connect(databaseDir);
const func = await getRegistry().get("huggingface").create();
console.log(getRegistry());
const func = (await getRegistry()
.get("huggingface")
?.create()) as EmbeddingFunction;
const facts = [
"Albert Einstein was a theoretical physicist.",
@@ -56,4 +60,4 @@ test("full text search", async () => {
expect(actual[0]["text"]).toBe("The human body has 206 bones.");
});
});
}, 100_000);