4.4 KiB
4.4 KiB
In [ ]:
!pip install embedchain[dataloaders,cohere]In [ ]:
import os
from embedchain import Pipeline as App
os.environ["OPENAI_API_KEY"] = "sk-xxx"
os.environ["COHERE_API_KEY"] = "xxx"In [ ]:
config = """
llm:
provider: cohere
config:
model: gptd-instruct-tft
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
"""
# Write the multi-line string to a YAML file
with open('cohere.yaml', 'w') as file:
file.write(config)In [ ]:
app = App.from_config(config_path="cohere.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)