Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

feat: example for voyage query engine pack #880

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions llama_hub/llama_packs/voyage_query_engine/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Required Environment Variables: OPENAI_API_KEY, VOYAGE_API_KEY

from pathlib import Path
from llama_index import download_loader
from llama_index.llama_pack import download_llama_pack

# download and install dependencies
VoyageQueryEnginePack = download_llama_pack("VoyageQueryEnginePack", "./voyage_pack")
PDFReader = download_loader("PDFReader")

# load documents
loader = PDFReader()
document_path = Path("./data/101.pdf") # replace with your own document
documents = loader.load_data(file=document_path)

# create the pack
voyage_pack = VoyageQueryEnginePack(documents)

# run the pack
response = voyage_pack.run("How to rewrite history?", similarity_top_k=2)
print(response)
Loading