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

Commit

Permalink
feat: example for voyage query engine pack (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
thucpn authored Jan 24, 2024
1 parent 8f00092 commit 3058279
Showing 1 changed file with 21 additions and 0 deletions.
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)

0 comments on commit 3058279

Please sign in to comment.