3.8 KiB
3.8 KiB
In [ ]:
!pip install embedchain[dataloaders]In [ ]:
import os
from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"In [ ]:
config = """
vectordb:
provider: chroma
config:
collection_name: 'my-collection'
# CHANGE THE BELOW TWO LINES!
# pass remote database variables - host and port
host: your-chromadb-url.com
port: 5200
allow_reset: true
"""
# Write the multi-line string to a YAML file
with open('chromadb.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(config_path="chromadb.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)