4.2 KiB
4.2 KiB
In [ ]:
!pip install embedchainIn [ ]:
!pip install embedchain[dataloaders]In [ ]:
import os
from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"In [ ]:
config = """
llm:
provider: openai
config:
model: gpt-35-turbo
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
embedder:
provider: openai
config:
model: text-embedding-ada-002
deployment_name: ec_embeddings_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(yaml_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)