Code Monkey home page Code Monkey logo

Comments (2)

raghavdixit99 avatar raghavdixit99 commented on May 28, 2024

This is an issue with how you are ingesting data, the issue mentions - TypeError: Query column emb must be a vector. Got list<item: double>.

I ran your code snippet and the schema is a simple list and not an pyarrow list.

You are trying to create a table using a custom schema w/o providing it ('vector' is the default vector field for implicit schema detection). Our API reference mentions this :

Data is converted to Arrow before being written to disk. For maximum control over how data is saved, either provide the PyArrow schema to convert to or else provide a PyArrow Table directly.

The below code runs fine, pls use this, additionally you can also ingest data via LanceModel , everything is mentioned in our API reference for development, we will be updating the docs once the team has bandwidth.

import lancedb
import pyarrow as pa

custom_schema = pa.schema(
    [
        pa.field("emb", pa.list_(pa.float32(), 2)),
        pa.field("price", pa.float32()),
        pa.field("item", pa.string()),
    ]
)

uri = "./sample-lancedb"
db = lancedb.connect(uri)

table = db.create_table(
    "my_table",
    data=[
        {"emb": [3.1, 4.1], "item": "foo", "price": 10.0},
        {"emb": [5.9, 26.5], "item": "bar", "price": 20.0},
    ],
    schema=custom_schema,
)

result = table.search([100, 100]).limit(2).to_pandas()
print(result)

from lancedb.

raghavdixit99 avatar raghavdixit99 commented on May 28, 2024

closing this for now, its not a bug @changhiskhan / @wjones127

from lancedb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.