embedchain/notebooks/clarifai.ipynb
!pip install embedchain[clarifai]
Sign-up to Clarifai platform and you can obtain CLARIFAI_PAT by following this link.
optionally you can also pass api_key in config of llm/embedder class.
import os
from embedchain import App
os.environ["CLARIFAI_PAT"]="xxx"
Browse through Clarifai community page to get the URL of different LLM and embedding models available.
# Use model_kwargs to pass all model specific parameters for inference.
app = App.from_config(config={
"llm": {
"provider": "clarifai",
"config": {
"model": "https://clarifai.com/mistralai/completion/models/mistral-7B-Instruct",
"model_kwargs": {
"temperature": 0.5,
"max_tokens": 1000
}
}
},
"embedder": {
"provider": "clarifai",
"config": {
"model": "https://clarifai.com/openai/embed/models/text-embedding-ada",
}
}
})
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)