From 48f8d1b3b71cdac3f492012d39567e58574ef5f8 Mon Sep 17 00:00:00 2001 From: Sidharth Rajaram Date: Sun, 30 Jun 2024 23:44:17 -0700 Subject: [PATCH] docs: addresses typos in HF embedding example docs (#1415) * `table.add` requires `data` parameter on the docs page regarding use of embedding models from HF * also changed the name of example class from `TextModel` to `Words` since that is what is used as parameter in the `db.create_table` call * Per https://lancedb.github.io/lancedb/python/python/#lancedb.table.Table.add --- docs/src/embeddings/default_embedding_functions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/embeddings/default_embedding_functions.md b/docs/src/embeddings/default_embedding_functions.md index 2bd699d8..e6a09c1f 100644 --- a/docs/src/embeddings/default_embedding_functions.md +++ b/docs/src/embeddings/default_embedding_functions.md @@ -193,13 +193,13 @@ from lancedb.pydantic import LanceModel, Vector model = get_registry().get("huggingface").create(name='facebook/bart-base') -class TextModel(LanceModel): +class Words(LanceModel): text: str = model.SourceField() vector: Vector(model.ndims()) = model.VectorField() df = pd.DataFrame({"text": ["hi hello sayonara", "goodbye world"]}) table = db.create_table("greets", schema=Words) -table.add() +table.add(df) query = "old greeting" actual = table.search(query).limit(1).to_pydantic(Words)[0] print(actual.text)