multiStepQueryEngine
without OpenAI?# set Logging to DEBUG for more detailed outputs from llama_index.query_engine.multistep_query_engine import ( MultiStepQueryEngine, ) # Since this query engine will be used. I think try changing the llm and model in this service_context !! query_engine = index.as_query_engine(service_context=service_context_gpt4) query_engine = MultiStepQueryEngine( query_engine=query_engine, query_transform=step_decompose_transform, index_summary=index_summary, )
response_synthesizer
if not passed it tries to build one. For this by default it tries to use OPENAIValueError: No API key found for OpenAI. Please set either the OPENAI_API_KEY environment variable or openai.api_key prior to initialization. API keys can be found or created at https://platform.openai.com/account/api-keys During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) Cell In[119], line 15 5 from llama_index.response_synthesizers import ( 6 ResponseMode, 7 get_response_synthesizer, 8 ) 10 response_synthesizer = get_response_synthesizer( 11 response_mode=ResponseMode.COMPACT, service_context=service_context 12 ) ---> 15 query_engine = MultiStepQueryEngine( 16 query_engine= index.as_query_engine(service_context=service_context), 17 query_transform=step_decompose_transform, 18 index_summary="Used to search for code snippets", 19 # response_synthesizer=response_synthesizer, 20 ) File c:\Users\souya\.conda\envs\streamdiffusion\lib\site-packages\llama_index\query_engine\multistep_query_engine.py:53, in MultiStepQueryEngine.__init__(self, query_engine, query_transform, response_synthesizer, num_steps, early_stopping, index_summary, stop_fn) 51 self._query_engine = query_engine 52 self._query_transform = query_transform ---> 53 self._response_synthesizer = response_synthesizer or get_response_synthesizer( 54 callback_manager=self._query_engine.callback_manager 55 ) 57 self._index_summary = index_summary 58 self._num_steps = num_steps
from llama_index.response_synthesizers import get_response_synthesizer # use the query_engine that you are going to pass in the mutlistep for callback manager response_synthesizer = get_response_synthesizer(service_context=non_openAI_service_context, callback_manager=query_engine.callback_manager) # once you have this, try passing the response_synthesizer in Multistep as well query_engine = MultiStepQueryEngine( query_engine=query_engine, response_synthesizer=response_synthesizer,query_transform=step_decompose_transform,index_summary=index_summary, )
Current query: What is the purpose of StudentResource class?
New query: Based on the given context, I do not have enough information to ask a meaningful follow-up question about the purpose of the StudentResource class. Since the knowledge source only provides information about searching for code snippets, and there is no previous reasoning, I cannot extract any additional details about the StudentResource class.
Therefore, my answer is: None
index_summary
was the culprit. I removed "Used for" in the begining. And it started generating queries.File c:\Users\souya\.conda\envs\streamdiffusion\lib\site-packages\llama_index\indices\query\query_transform\base.py:116, in HyDEQueryTransform.__init__(self, llm, hyde_prompt, include_original) 105 """Initialize HyDEQueryTransform. 106 107 Args: (...) 112 string as one of the embedding strings 113 """ 114 super().__init__() --> 116 self._llm = llm or resolve_llm("default") 117 self._hyde_prompt = hyde_prompt or DEFAULT_HYDE_PROMPT 118 self._include_original = include_original File c:\Users\souya\.conda\envs\streamdiffusion\lib\site-packages\llama_index\llms\utils.py:31, in resolve_llm(llm) 29 validate_openai_api_key(llm.api_key) 30 except ValueError as e: ---> 31 raise ValueError( 32 "\n******\n" 33 "Could not load OpenAI model. " 34 "If you intended to use OpenAI, please check your OPENAI_API_KEY.\n" 35 "Original error:\n" 36 f"{e!s}" 37 "\nTo disable the LLM entirely, set llm=None." 38 "\n******" 39 ) 41 if isinstance(llm, str): 42 splits = llm.split(":", 1)
StepDecomposeQueryTransform
.