embedchain/notebooks/elasticsearch.ipynb
!pip install embedchain[elasticsearch]
You can find this env variable on your OpenAI dashboard.
import os
from embedchain import App
os.environ["OPENAI_API_KEY"] = "sk-xxx"
app = App.from_config(config={
"provider": "elasticsearch",
"config": {
"collection_name": "es-index",
"es_url": "your-elasticsearch-url.com",
"allow_reset": True,
"api_key": "xxx"
}
})
app.add("https://www.forbes.com/profile/elon-musk")
while(True):
question = input("Enter question: ")
if question in ['q', 'exit', 'quit']:
break
answer = app.query(question)
print(answer)