service_context
does NOT update unless I restart the entire application, has anyone run into this issue before?set_global_service_context(service_context) vector_store = PineconeVectorStore( pinecone_index=PINECONE_INDEX, namespace=namespace ) storage_context = StorageContext.from_defaults( docstore=DOCUMENT_STORE, index_store=INDEX_STORE, vector_store=vector_store, ) print(service_context) return VectorStoreIndex.from_vector_store( vector_store=vector_store, storage_context=storage_context, service_context=service_context, )
context_window
then it doesnt update it. I've tried it with and without setting it globally.from llama_index import set_global_service_context, ServiceContext from llama_index.llms import MockLLM # setup llm w/ 2 ctx = ServiceContext.from_defaults(llm=MockLLM(max_tokens=2)) print(ctx.llm) set_global_service_context(ctx) # validate 2 test_ctx = ServiceContext.from_defaults() print(test_ctx.llm) # setup new llm new_ctx = ServiceContext.from_defaults(llm=MockLLM(max_tokens=4)) print(new_ctx.llm) set_global_service_context(new_ctx) # validate llm w/ 4 test_ctx = ServiceContext.from_defaults() print(test_ctx.llm)
... max_tokens=2 ... max_tokens=2 ... max_tokens=4 ... max_tokens=4
print
service_context.llm
I get this:callback_manager=<llama_index.callbacks.base.CallbackManager object at 0x14ef35b10> model='gpt-3.5-turbo' temperature=0.0 max_tokens=None additional_kwargs={} max_retries=3 timeout=60.0 default_headers=None api_key='sk-XXX' api_base='https://api.openai.com/v1' api_version=''
service_context = ServiceContext.from_defaults( llm=OpenAI(temperature=0, model_name="gpt-4-1106-preview"), callback_manager=CALLBACK_MANAGER, embed_model=embed_model, context_window=context_window, )