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

LanceDB - cannot override table_name when calling from_documents() #21251

Closed
5 tasks done
jaceksan opened this issue May 3, 2024 · 0 comments · Fixed by #21252
Closed
5 tasks done

LanceDB - cannot override table_name when calling from_documents() #21251

jaceksan opened this issue May 3, 2024 · 0 comments · Fixed by #21252
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🔌: openai Primarily related to OpenAI integrations

Comments

@jaceksan
Copy link
Contributor

jaceksan commented May 3, 2024

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

from langchain_community.vectorstores import LanceDB
from langchain_core.documents import Document
from dotenv import load_dotenv
import lancedb
from langchain_openai import OpenAIEmbeddings

TABLE_NAME = "test"


# For OpenAIEmbeddings
load_dotenv()
documents = [Document(page_content=f"Test document.", metadata={"id": "1", "title": "Test document"})]

db_conn = lancedb.connect('test.LANCENDB')
LanceDB.from_documents(documents, connection=db_conn, table_name=TABLE_NAME, vector_key="vector", embedding=OpenAIEmbeddings())
table = db_conn.open_table(TABLE_NAME)

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "/home/jacek/work/src/artifical-business-intelligence/gooddata/tests/test_lancedb_min.py", line 16, in <module>
    table = db_conn.open_table(TABLE_NAME)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacek/work/src/artifical-business-intelligence/.venv/lib/python3.11/site-packages/lancedb/db.py", line 446, in open_table
    return LanceTable.open(self, name, index_cache_size=index_cache_size)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jacek/work/src/artifical-business-intelligence/.venv/lib/python3.11/site-packages/lancedb/table.py", line 918, in open
    raise FileNotFoundError(
FileNotFoundError: Table test does not exist.Please first call db.create_table(test, data)

Description

Input argument table_name is not respected when calling from_documents().
Instead, table is created with the default name specified in the constructor: vectorstore

System Info

LanceDB latest 0.6.11
Python 3.10

jaceksan added a commit to jaceksan/langchain that referenced this issue May 3, 2024
@dosubot dosubot bot added 🔌: openai Primarily related to OpenAI integrations 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature labels May 3, 2024
hwchase17 pushed a commit that referenced this issue May 6, 2024
dglogo pushed a commit to dglogo/langchain that referenced this issue May 8, 2024
kyle-cassidy pushed a commit to kyle-cassidy/langchain that referenced this issue May 10, 2024
kyle-cassidy pushed a commit to kyle-cassidy/langchain that referenced this issue May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature 🔌: openai Primarily related to OpenAI integrations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant