-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update default_embedding_functions.md #1258
base: main
Are you sure you want to change the base?
Conversation
model = get_registry().get("huggingface").create(name='facebook/bart-base') | ||
|
||
class TextModel(LanceModel): | ||
|
||
class Words(LanceModel): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep TextModel ?
the name is more apt than 'Words'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment, happy to use this - would you like me to change all the other examples to match this, i.e.:
class Words(LanceModel): |
class Words(LanceModel): |
class Schema(LanceModel): |
from lancedb.embeddings import get_registry | ||
from lancedb.pydantic import LanceModel, Vector | ||
|
||
db = lancedb.connect("/tmp/db") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since its an example doc, perhaps keeping a non-temp path would be better, "/lancedb" works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the coment, did you mean ./lancedb
? Happy to use this - would you like me to change all the other examples to match this, i.e.:
db = lancedb.connect("/tmp/db") |
db = lancedb.connect("/tmp/db") |
db = lancedb.connect("~/.lancedb") |
db = lancedb.connect("~/.lancedb") |
db = lancedb.connect("tmp_path") |
db = lancedb.connect(tmp_path) |
db = lancedb.connect(tmp_path) |
{"text": "goodbye world"} | ||
] | ||
) | ||
query = "greetings" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both are greetings, we could show a more clear example. Either the older example or something simple yet distinct , for ex :
table.add(
[
{"text": "Golden Retriever energy"},
{"text": "Black cat"}
]
)
query = "playful dog"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment, happy to use this - would you like me to change all the other examples to match this, i.e.:
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 169 to 176 in fdb5d6f
table.add( | |
[ | |
{"text": "hello world"}, | |
{"text": "goodbye world"} | |
] | |
) | |
query = "greetings" |
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 202 to 203 in fdb5d6f
table.add() | |
query = "old greeting" |
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 231 to 238 in fdb5d6f
table.add( | |
[ | |
{"text": "hello world"}, | |
{"text": "goodbye world"} | |
] | |
) | |
query = "greetings" |
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 287 to 291 in fdb5d6f
texts = [{"text": "Capitalism has been dominant in the Western world since the end of feudalism, but most feel[who?] that..."}, | |
{"text": "The disparate impact theory is especially controversial under the Fair Housing Act because the Act..."}, | |
{"text": "Disparate impact in United States labor law refers to practices in employment, housing, and other areas that.."}] | |
tbl.add(texts) |
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 322 to 327 in fdb5d6f
df = pd.DataFrame({"text": ["hello world", "goodbye world"]}) | |
db = lancedb.connect("~/.lancedb") | |
tbl = db.create_table("test", schema=TextModel, mode="overwrite") | |
tbl.add(df) | |
rs = tbl.search("hello").limit(1).to_pandas() |
lancedb/docs/src/embeddings/default_embedding_functions.md
Lines 372 to 377 in fdb5d6f
df = pd.DataFrame({"text": ["hello world", "goodbye world"]}) | |
db = lancedb.connect("tmp_path") | |
tbl = db.create_table("test", schema=TextModel, mode="overwrite") | |
tbl.add(df) | |
rs = tbl.search("hello").limit(1).to_pandas() |
Fix example (tried to make more similar to other examples too).