Created
September 30, 2024 17:56
-
-
Save davidmezzetti/66d57c1c076526931a71caec37acb7b1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 txtai import Embeddings, RAG | |
# Load embeddings index | |
embeddings = Embeddings() | |
embeddings.load(provider="huggingface-hub", container="neuml/txtai-wikipedia") | |
template = """ | |
Answer the following question using the provided context. | |
Question: | |
{question} | |
Context: | |
{context} | |
Answer: | |
""" | |
# Create and run pipeline | |
rag = RAG( | |
embeddings, | |
"hugging-quants/Llama-3.2-1B-Instruct-Q4_K_M-GGUF/llama-3.2-1b-instruct-q4_k_m.gguf", | |
template=template | |
) | |
rag("Tell me about Mars in a short sentence")["answer"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment