Settings.llm = OpenAI(model="gpt-4-0125-preview", temperature=0.1) Settings.embed_model = OpenAIEmbedding() index = VectorStoreIndex(nodes=nodes)
raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens, however you requested 11486 tokens (11486 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.", 'type': 'invalid_request_error', 'param': None, 'code': None}
gpt-4-025-preview
has a context length of 128.000 tokens and not 8192 (which vanilla gpt-4 has)initializing settings... callback_manager=<llama_index.core.callbacks.base.CallbackManager object at 0x1026cf9d0> system_prompt=None messages_to_prompt=<function messages_to_prompt at 0x105ae47c0> completion_to_prompt=<function default_completion_to_prompt at 0x105b5e660> output_parser=None pydantic_program_mode=<PydanticProgramMode.DEFAULT: 'default'> query_wrapper_prompt=None model='gpt-4-0125-preview' temperature=0.1 max_tokens=None
def run(self): Settings.llm = OpenAI( model="gpt-4-0125-preview", temperature=0.1, max_tokens=512 ) Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-large") print(Settings.llm) self._create_nodes() self._create_index()
callback_manager=<llama_index.core.callbacks.base.CallbackManager object at 0x1043dbb50> system_prompt=None messages_to_prompt=<function messages_to_prompt at 0x107698720> completion_to_prompt=<function default_completion_to_prompt at 0x11900a5c0> output_parser=None pydantic_program_mode=<PydanticProgramMode.DEFAULT: 'default'> query_wrapper_prompt=None model='gpt-4-0125-preview' temperature=0.1 max_tokens=512 additional_kwargs={} max_retries=3 timeout=60.0 default_headers=None reuse_client=True api_key=[HIDDEN] api_base='https://api.openai.com/v1' api_version=''
raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'error': {'message': "This model's maximum context length is 8192 tokens, however you requested 11486 tokens (11486 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.", 'type': 'invalid_request_error', 'param': None, 'code': None}}
...model='gpt-4-0125-preview
but is there something else I should do?Settings.embed_model = OpenAIEmbedding(model="text-embedding-3-large")
nodes = MarkdownNodeParser()(documents)
nodes = SentenceSplitter()(nodes)