Back to Mem0

Lancedb

embedchain/notebooks/lancedb.ipynb

2.0.1994 B
Original Source

Cookbook for using LanceDB with Embedchain

Step-1: Install embedchain package

python
! pip install embedchain lancedb

Step-2: Set environment variables needed for LanceDB

You can find this env variable on your OpenAI.

python
import os
from embedchain import App

os.environ["OPENAI_API_KEY"] = "sk-xxx"

Step-3 Create embedchain app and define your config

python
app = App.from_config(config={
    "vectordb": {
        "provider": "lancedb",
            "config": {
                "collection_name": "lancedb-index"
            }
        }
    }
)

Step-4: Add data sources to your app

python
app.add("https://www.forbes.com/profile/elon-musk")
python
while(True):
    question = input("Enter question: ")
    if question in ['q', 'exit', 'quit']:
        break
    answer = app.query(question)
    print(answer)