lancedb.mdx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ---
  2. title: LanceDB
  3. ---
  4. ## Install Embedchain with LanceDB
  5. Install Embedchain, LanceDB and related dependencies using the following command:
  6. ```bash
  7. pip install "embedchain[lancedb]"
  8. ```
  9. LanceDB is a developer-friendly, open source database for AI. From hyper scalable vector search and advanced retrieval for RAG, to streaming training data and interactive exploration of large scale AI datasets.
  10. In order to use LanceDB as vector database, not need to set any key for local use.
  11. <CodeGroup>
  12. ```python main.py
  13. import os
  14. from embedchain import App
  15. # set OPENAI_API_KEY as env variable
  16. os.environ["OPENAI_API_KEY"] = "sk-xxx"
  17. # Create Embedchain App and set config
  18. app = App.from_config(config={
  19. "vectordb": {
  20. "provider": "lancedb",
  21. "config": {
  22. "collection_name": "lancedb-index"
  23. }
  24. }
  25. }
  26. )
  27. # Add data source and start queryin
  28. app.add("https://www.forbes.com/profile/elon-musk")
  29. # query continuously
  30. while(True):
  31. question = input("Enter question: ")
  32. if question in ['q', 'exit', 'quit']:
  33. break
  34. answer = app.query(question)
  35. print(answer)
  36. ```
  37. </CodeGroup>
  38. <Snippet file="missing-vector-db-tip.mdx" />