embedchain/notebooks/vertex_ai.ipynb
!pip install embedchain[vertexai]
You can find OPENAI_API_KEY on your OpenAI dashboard.
import os
from embedchain import App
os.environ["OPENAI_API_KEY"] = "sk-xxx"
app = App.from_config(config={
"llm": {
"provider": "vertexai",
"config": {
"model": "chat-bison",
"temperature": 0.5,
"max_tokens": 1000,
"stream": False
}
},
"embedder": {
"provider": "vertexai",
"config": {
"model": "textembedding-gecko"
}
}
})
app.add("https://www.forbes.com/profile/elon-musk")
while(True):
question = input("Enter question: ")
if question in ['q', 'exit', 'quit']:
break
answer = app.query(question)
print(answer)