-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from TheDataGuild/refactor/measure-time-decorator
Refactor/measure time decorator
- Loading branch information
Showing
3 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
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"): | ||
embed_model = "local" | ||
service_context = li.ServiceContext.from_defaults( | ||
llm=OpenAI(model=model), | ||
embed_model="local" | ||
embed_model=embed_model | ||
# Q: how much does a better embedding model help? | ||
) | ||
|
||
print(f"Creating an index with {len(nodes)} number of nodes using model {model}") | ||
print( | ||
f"Creating an index with {len(nodes)} number of nodes using embedding model {embed_model} and querying LLM {model}" | ||
) | ||
index = li.VectorStoreIndex(nodes, service_context=service_context) | ||
|
||
return index |
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
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