4.0 KiB
4.0 KiB
In [ ]:
!pip install embedchain[dataloaders]In [ ]:
import os
from embedchain import App
os.environ["OPENAI_API_KEY"] = "sk-xxx"In [ ]:
config = """
llm:
provider: openai
config:
model: gpt-3.5-turbo
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
embedder:
provider: openai
config:
model: text-embedding-ada-002
"""
# Write the multi-line string to a YAML file
with open('openai.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(config_path="openai.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)