3.7 KiB
3.7 KiB
In [ ]:
!pip install embedchain[dataloaders,elasticsearch]In [ ]:
import os
from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"In [ ]:
config = """
vectordb:
provider: elasticsearch
config:
collection_name: 'es-index'
es_url: your-elasticsearch-url.com
allow_reset: true
api_key: xxx
"""
# Write the multi-line string to a YAML file
with open('elasticsearch.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(config_path="elasticsearch.yaml")In [ ]:
app.add("https://www.forbes.com/profile/elon-musk")In [ ]:
while(True):
question = input("Enter question: ")
if question in ['q', 'exit', 'quit']:
break
answer = app.query(question)
print(answer)