Files
mem0/embedchain/notebooks/jina.ipynb
T

3.9 KiB

Cookbook for using JinaChat with Embedchain

Step-1: Install embedchain package

In [ ]:
!pip install embedchain

You can find OPENAI_API_KEY on your OpenAI dashboard and JINACHAT_API_KEY key on your Chat Jina dashboard.

In [ ]:
import os
from embedchain import App

os.environ["OPENAI_API_KEY"] = "sk-xxx"
os.environ["JINACHAT_API_KEY"] = "xxx"

Step-3 Create embedchain app and define your config

In [ ]:
app = App.from_config(config={
    "provider": "jina",
    "config": {
        "temperature": 0.5,
        "max_tokens": 1000,
        "top_p": 1,
        "stream": False
    }
})

Step-4: Add data sources to your app

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)