Closed ainteligencia closed 1 year ago
Changing
index = GPTSimpleVectorIndex(documents, llm_predictor=llm_predictor, prompt_helper=prompt_helper)
To
service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper)
index = GPTSimpleVectorIndex.from_documents(documents, service_context=service_context)
And importing
from llama_index import ServiceContext
Helped!
Thanks @barabum0 for the help! We made some breaking API changes in 0.5.0, will make sure docs are clear about this!
多谢,已解决
for the following error TypeError: init() got an unexpected keyword argument 'llm_predictor'
the code executed is functional
from llama_index import GPTSimpleVectorIndex, PromptHelper,LLMPredictor from langchain import OpenAI llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.1, model_name="text-davinci-002")) max_input_size = 4096 num_output = 256 max_chunk_overlap = 20 prompt_helper = PromptHelper(max_input_size, num_output, max_chunk_overlap)
custom_LLM_index = GPTSimpleVectorIndex( documents, llm_predictor=llm_predictor, prompt_helper=prompt_helper