Updated LanceDB Doc (#1445)
This commit is contained in:
@@ -13,7 +13,9 @@ pip install "embedchain[lancedb]"
|
||||
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.
|
||||
In order to use LanceDB as vector database, not need to set any key for local use.
|
||||
|
||||
### With OPENAI
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
import os
|
||||
from embedchain import App
|
||||
@@ -21,7 +23,7 @@ from embedchain import App
|
||||
# set OPENAI_API_KEY as env variable
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
# Create Embedchain App and set config
|
||||
# create Embedchain App and set config
|
||||
app = App.from_config(config={
|
||||
"vectordb": {
|
||||
"provider": "lancedb",
|
||||
@@ -32,7 +34,7 @@ app = App.from_config(config={
|
||||
}
|
||||
)
|
||||
|
||||
# Add data source and start queryin
|
||||
# add data source and start query in
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# query continuously
|
||||
@@ -45,4 +47,54 @@ while(True):
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### With Local LLM
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# config for Embedchain App
|
||||
config = {
|
||||
'llm': {
|
||||
'provider': 'huggingface',
|
||||
'config': {
|
||||
'model': 'mistralai/Mistral-7B-v0.1',
|
||||
'temperature': 0.1,
|
||||
'max_tokens': 250,
|
||||
'top_p': 0.1,
|
||||
'stream': True
|
||||
}
|
||||
},
|
||||
'embedder': {
|
||||
'provider': 'huggingface',
|
||||
'config': {
|
||||
'model': 'sentence-transformers/all-mpnet-base-v2'
|
||||
}
|
||||
},
|
||||
'vectordb': {
|
||||
'provider': 'lancedb',
|
||||
'config': {
|
||||
'collection_name': 'lancedb-index'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app = App.from_config(config=config)
|
||||
|
||||
# add data source and start query in
|
||||
app.add("https://www.tesla.com/ns_videos/2022-tesla-impact-report.pdf")
|
||||
|
||||
# query continuously
|
||||
while(True):
|
||||
question = input("Enter question: ")
|
||||
if question in ['q', 'exit', 'quit']:
|
||||
break
|
||||
answer = app.query(question)
|
||||
print(answer)
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
<Snippet file="missing-vector-db-tip.mdx" />
|
||||
Reference in New Issue
Block a user