3.9 KiB
3.9 KiB
In [ ]:
!pip install embedchain[dataloaders,opensearch]In [ ]:
import os
from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"In [ ]:
config = """
vectordb:
provider: opensearch
config:
opensearch_url: 'your-opensearch-url.com'
http_auth:
- admin
- admin
vector_dimension: 1536
collection_name: 'my-app'
use_ssl: false
verify_certs: false
"""
# Write the multi-line string to a YAML file
with open('opensearch.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(config_path="opensearch.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)