๐ก Create an AI app on your own data in a minute
First install the Python package:
pip install embedchain
Once you have installed the package, depending upon your preference you can either use:
This includes Open source LLMs like Mistral, Llama, etc.
Free to use, and runs locally on your machine.
This includes paid LLMs like GPT 4, Claude, etc.
Cost money and are accessible via an API.
This section gives a quickstart example of using Mistral as the Open source LLM and Sentence transformers as the Open source embedding model. These models are free and run mostly on your local machine.
We are using Mistral hosted at Hugging Face, so will you need a Hugging Face token to run this example. Its free and you can create one here.
import os
# Replace this with your HF token
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_xxxx"
from embedchain import App
config = {
'llm': {
'provider': 'huggingface',
'config': {
'model': 'mistralai/Mistral-7B-Instruct-v0.2',
'top_p': 0.5
}
},
'embedder': {
'provider': 'huggingface',
'config': {
'model': 'sentence-transformers/all-mpnet-base-v2'
}
}
}
app = App.from_config(config=config)
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")
# Answer: The net worth of Elon Musk today is $258.7 billion.
In this section, we will use both LLM and embedding model from OpenAI.
import os
from embedchain import App
# Replace this with your OpenAI key
os.environ["OPENAI_API_KEY"] = "sk-xxxx"
app = App()
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")
# Answer: The net worth of Elon Musk today is $258.7 billion.
Now that you have created your first app, you can follow any of the links:
Was this page helpful?