From 02979566eee1ae00df7d0c72265ad4fdc1b97fb8 Mon Sep 17 00:00:00 2001 From: mudler Date: Sun, 7 May 2023 00:58:30 +0200 Subject: [PATCH] examples: better defaults --- examples/query_data/query.py | 2 +- examples/query_data/store.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/query_data/query.py b/examples/query_data/query.py index 4d94618..bf268c5 100644 --- a/examples/query_data/query.py +++ b/examples/query_data/query.py @@ -10,7 +10,7 @@ from llama_index import StorageContext, load_index_from_storage base_path = os.environ.get('OPENAI_API_BASE', 'http://localhost:8080/v1') # This example uses text-davinci-003 by default; feel free to change if desired -llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="gpt-3.5-turbo",openai_api_base=base_path)) +llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="gpt-3.5-turbo", openai_api_base=base_path)) # Configure prompt parameters and initialise helper max_input_size = 1024 diff --git a/examples/query_data/store.py b/examples/query_data/store.py index f4bc8d9..e029694 100644 --- a/examples/query_data/store.py +++ b/examples/query_data/store.py @@ -13,15 +13,15 @@ base_path = os.environ.get('OPENAI_API_BASE', 'http://localhost:8080/v1') llm_predictor = LLMPredictor(llm=OpenAI(temperature=0, model_name="gpt-3.5-turbo", openai_api_base=base_path)) # Configure prompt parameters and initialise helper -max_input_size = 256 -num_output = 256 -max_chunk_overlap = 10 +max_input_size = 512 +num_output = 512 +max_chunk_overlap = 30 prompt_helper = PromptHelper(max_input_size, num_output, max_chunk_overlap) # Load documents from the 'data' directory documents = SimpleDirectoryReader('data').load_data() -service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper, chunk_size_limit = 257) +service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper, chunk_size_limit = 512) index = GPTVectorStoreIndex.from_documents(documents, service_context=service_context) index.storage_context.persist(persist_dir="./storage")