Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

asmith26
Copy link
Contributor

@asmith26 asmith26 commented May 1, 2024

Fix example (tried to make more similar to other examples too).

model = get_registry().get("huggingface").create(name='facebook/bart-base')

class TextModel(LanceModel):

class Words(LanceModel):
Copy link
Contributor

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'

Copy link
Contributor Author

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.:

from lancedb.embeddings import get_registry
from lancedb.pydantic import LanceModel, Vector

db = lancedb.connect("/tmp/db")
Copy link
Contributor

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

Copy link
Contributor Author

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"
Copy link
Contributor

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"

Copy link
Contributor Author

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.:

table.add(
[
{"text": "hello world"},
{"text": "goodbye world"}
]
)
query = "greetings"

table.add()
query = "old greeting"

table.add(
[
{"text": "hello world"},
{"text": "goodbye world"}
]
)
query = "greetings"

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)

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()

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants