Skip to content

Commit

Permalink
apply @time_function
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantisan committed Sep 23, 2023
1 parent c864aae commit bd9e9f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 3 additions & 0 deletions mind_palace/index.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from llama_index.llms import OpenAI
import llama_index as li

from measure import time_function


@time_function
def index_nodes(nodes, model="gpt-3.5-turbo"):
service_context = li.ServiceContext.from_defaults(
llm=OpenAI(model=model),
Expand Down
6 changes: 2 additions & 4 deletions tests/end_to_end/test_query.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from tests.context import extract, index, measure
from tests.context import extract, index
import llama_index as li


def bootstrap_index(xml_dir):
nodes = extract.seed_nodes(xml_dir)
vector_index, elapsed_time = measure.time_function(lambda: index.index_nodes(nodes))
print(f"Elapsed time {elapsed_time:.1f} seconds: Indexed {len(nodes)} nodes")
return vector_index
return index.index_nodes(nodes)


def persist_index(vector_index):
Expand Down

0 comments on commit bd9e9f1

Please sign in to comment.