Created
March 12, 2024 00:24
-
-
Save hemanth/7133e70f709e2b0f33f740065221c266 to your computer and use it in GitHub Desktop.
Summarize URL with llama_index and ollama
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from llama_index.core import VectorStoreIndex, download_loader | |
from llama_index.llms.ollama import Ollama | |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding | |
from llama_index.core import Settings | |
from llama_index.llms.ollama import Ollama | |
from IPython.display import display | |
Settings.llm = Ollama(model="mistral:latest", request_timeout=30.0) | |
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5") | |
SimpleWebPageReader = download_loader("SimpleWebPageReader") | |
loader = SimpleWebPageReader() | |
documents = loader.load_data(urls=['https://h3manth.com']) | |
index = VectorStoreIndex.from_documents(documents) | |
engine = index.as_query_engine() | |
response = engine.query("Summarize the website in 5 points") | |
display((f"{response}")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment