Comments (5)
The issue seems related to llamaindex's HuggingFaceEmbedding when it's used in the new integration? It will help if we see a fuller error trace.
You can pass max_errors=1 to the teleprompter and see if this prints out the full stack trace.
from dspy.
Thanks. I passed max_errors=1 and it printed the trace below. Should I raise this ticket on LlamaIndex? Also, I was able to make it work using LlamaIndex's OllamaEmbeddings workaround. I think this issue only exists for the HuggingFaceEmbedding class.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[23], [line 20](vscode-notebook-cell:?execution_count=23&line=20)
[13](vscode-notebook-cell:?execution_count=23&line=13) teleprompter = BootstrapFewShot(
[14](vscode-notebook-cell:?execution_count=23&line=14) max_labeled_demos=0,
[15](vscode-notebook-cell:?execution_count=23&line=15) metric=validate_context_and_answer,
[16](vscode-notebook-cell:?execution_count=23&line=16) max_errors=1
[17](vscode-notebook-cell:?execution_count=23&line=17) )
[19](vscode-notebook-cell:?execution_count=23&line=19) #compile
---> [20](vscode-notebook-cell:?execution_count=23&line=20) compiled_dspy_qp = teleprompter.compile(dspy_qp, trainset=train_examples)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:84, in BootstrapFewShot.compile(self, student, teacher, trainset)
[82](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:82) self._prepare_student_and_teacher(student, teacher)
[83](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:83) self._prepare_predictor_mappings()
---> [84](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:84) self._bootstrap()
[86](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:86) self.student = self._train()
[87](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:87) self.student._compiled = True
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:154, in BootstrapFewShot._bootstrap(self, max_bootstraps)
[151](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:151) break
[153](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:153) if example_idx not in bootstrapped:
--> [154](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:154) success = self._bootstrap_one_example(example, round_idx)
[156](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:156) if success:
[157](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:157) bootstrapped[example_idx] = True
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:210, in BootstrapFewShot._bootstrap_one_example(self, example, round_idx)
[208](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:208) current_error_count = self.error_count
[209](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:209) if current_error_count >= self.max_errors:
--> [210](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:210) raise e
[211](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:211) dspy.logger.error(f"Failed to run or to evaluate example {example} with {self.metric} due to {e}.")
[213](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:213) if success:
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:190, in BootstrapFewShot._bootstrap_one_example(self, example, round_idx)
[187](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:187) predictor_cache[name] = predictor.demos
[188](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:188) predictor.demos = [x for x in predictor.demos if x != example]
--> [190](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:190) prediction = teacher(**example.inputs())
[191](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:191) trace = dsp.settings.trace
[193](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:193) for name, predictor in teacher.named_predictors():
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:26, in Module.__call__(self, *args, **kwargs)
[25](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:25) def __call__(self, *args, **kwargs):
---> [26](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:26) return self.forward(*args, **kwargs)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:261, in LlamaIndexModule.forward(self, **kwargs)
[259](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:259) def forward(self, **kwargs: Any) -> Dict[str, Any]:
[260](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:260) """Forward."""
--> [261](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:261) output_dict = self.query_pipeline.run(**kwargs, return_values_direct=False)
[262](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:262) return dspy.Prediction(**output_dict)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:342, in QueryPipeline.run(self, return_values_direct, callback_manager, batch, *args, **kwargs)
[338](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:338) query_payload = json.dumps(str(kwargs))
[339](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:339) with self.callback_manager.event(
[340](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:340) CBEventType.QUERY, payload={EventPayload.QUERY_STR: query_payload}
[341](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:341) ) as query_event:
--> [342](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:342) outputs, _ = self._run(
[343](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:343) *args,
[344](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:344) return_values_direct=return_values_direct,
[345](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:345) show_intermediates=False,
[346](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:346) batch=batch,
[347](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:347) **kwargs,
[348](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:348) )
[350](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:350) return outputs
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:706, in QueryPipeline._run(self, return_values_direct, show_intermediates, batch, *args, **kwargs)
[704](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:704) return result_outputs, intermediates
[705](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:705) else:
--> [706](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:706) result_outputs, intermediates = self._run_multi(
[707](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:707) {root_key: kwargs}, show_intermediates=show_intermediates
[708](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:708) )
[710](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:710) return (
[711](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:711) self._get_single_result_output(result_outputs, return_values_direct),
[712](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:712) intermediates,
[713](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:713) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:857, in QueryPipeline._run_multi(self, module_input_dict, show_intermediates)
[855](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:855) if self.verbose:
[856](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:856) print_debug_input(module_key, module_input)
--> [857](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:857) output_dict = module.run_component(**module_input)
[859](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:859) if (
[860](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:860) show_intermediates
[861](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:861) and module_key not in run_state.intermediate_outputs
[862](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:862) ):
[863](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:863) run_state.intermediate_outputs[module_key] = ComponentIntermediates(
[864](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:864) inputs=module_input, outputs=output_dict
[865](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:865) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:201, in QueryComponent.run_component(self, **kwargs)
[199](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:199) kwargs.update(self.partial_dict)
[200](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:200) kwargs = self.validate_component_inputs(kwargs)
--> [201](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:201) component_outputs = self._run_component(**kwargs)
[202](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:202) return self.validate_component_outputs(component_outputs)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:345, in RetrieverComponent._run_component(self, **kwargs)
[343](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:343) def _run_component(self, **kwargs: Any) -> Any:
[344](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:344) """Run component."""
--> [345](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:345) output = self.retriever.retrieve(kwargs["input"])
[346](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:346) return {"output": output}
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:243, in BaseRetriever.retrieve(self, str_or_query_bundle)
[238](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:238) with self.callback_manager.as_trace("query"):
[239](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:239) with self.callback_manager.event(
[240](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:240) CBEventType.RETRIEVE,
[241](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:241) payload={EventPayload.QUERY_STR: query_bundle.query_str},
[242](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:242) ) as retrieve_event:
--> [243](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:243) nodes = self._retrieve(query_bundle)
[244](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:244) nodes = self._handle_recursive_retrieval(query_bundle, nodes)
[245](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:245) retrieve_event.on_end(
[246](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:246) payload={EventPayload.NODES: nodes},
[247](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:247) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:97, in VectorIndexRetriever._retrieve(self, query_bundle)
[94](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:94) if self._vector_store.is_embedding_query:
[95](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:95) if query_bundle.embedding is None and len(query_bundle.embedding_strs) > 0:
[96](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:96) query_bundle.embedding = (
---> [97](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:97) self._embed_model.get_agg_embedding_from_queries(
[98](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:98) query_bundle.embedding_strs
[99](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:99) )
[100](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:100) )
[101](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:101) return self._get_nodes_with_embeddings(query_bundle)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:184, in BaseEmbedding.get_agg_embedding_from_queries(self, queries, agg_fn)
[178](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:178) def get_agg_embedding_from_queries(
[179](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:179) self,
[180](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:180) queries: List[str],
[181](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:181) agg_fn: Optional[Callable[..., Embedding]] = None,
[182](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:182) ) -> Embedding:
[183](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:183) """Get aggregated embedding from multiple queries."""
--> [184](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:184) query_embeddings = [self.get_query_embedding(query) for query in queries]
[185](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:185) agg_fn = agg_fn or mean_agg
[186](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:186) return agg_fn(query_embeddings)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:133, in BaseEmbedding.get_query_embedding(self, query)
[125](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:125) dispatcher.event(
[126](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:126) EmbeddingStartEvent(
[127](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:127) model_dict=model_dict,
[128](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:128) )
[129](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:129) )
[130](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:130) with self.callback_manager.event(
[131](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:131) CBEventType.EMBEDDING, payload={EventPayload.SERIALIZED: self.to_dict()}
[132](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:132) ) as event:
--> [133](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:133) query_embedding = self._get_query_embedding(query)
[135](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:135) event.on_end(
[136](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:136) payload={
[137](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:137) EventPayload.CHUNKS: [query],
[138](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:138) EventPayload.EMBEDDINGS: [query_embedding],
[139](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:139) },
[140](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:140) )
[141](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:141) dispatcher.event(
[142](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:142) EmbeddingEndEvent(
[143](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:143) chunks=[query],
[144](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:144) embeddings=[query_embedding],
[145](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:145) )
[146](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:146) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:133, in HuggingFaceEmbedding._get_query_embedding(self, query)
[131](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:131) def _get_query_embedding(self, query: str) -> List[float]:
[132](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:132) """Get query embedding."""
--> [133](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:133) return self._embed(query, prompt_name="query")
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:124, in HuggingFaceEmbedding._embed(self, sentences, prompt_name)
[118](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:118) def _embed(
[119](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:119) self,
[120](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:120) sentences: List[str],
[121](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:121) prompt_name: Optional[str] = None,
[122](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:122) ) -> List[List[float]]:
[123](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:123) """Embed sentences."""
--> [124](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:124) return self._model.encode(
[125](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:125) sentences,
[126](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:126) batch_size=self.embed_batch_size,
[127](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:127) prompt_name=prompt_name,
[128](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:128) normalize_embeddings=self.normalize,
[129](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:129) ).tolist()
AttributeError: 'HuggingFaceEmbedding' object has no attribute '_model'
```---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[23], [line 20](vscode-notebook-cell:?execution_count=23&line=20)
[13](vscode-notebook-cell:?execution_count=23&line=13) teleprompter = BootstrapFewShot(
[14](vscode-notebook-cell:?execution_count=23&line=14) max_labeled_demos=0,
[15](vscode-notebook-cell:?execution_count=23&line=15) metric=validate_context_and_answer,
[16](vscode-notebook-cell:?execution_count=23&line=16) max_errors=1
[17](vscode-notebook-cell:?execution_count=23&line=17) )
[19](vscode-notebook-cell:?execution_count=23&line=19) #compile
---> [20](vscode-notebook-cell:?execution_count=23&line=20) compiled_dspy_qp = teleprompter.compile(dspy_qp, trainset=train_examples)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:84, in BootstrapFewShot.compile(self, student, teacher, trainset)
[82](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:82) self._prepare_student_and_teacher(student, teacher)
[83](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:83) self._prepare_predictor_mappings()
---> [84](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:84) self._bootstrap()
[86](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:86) self.student = self._train()
[87](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:87) self.student._compiled = True
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:154, in BootstrapFewShot._bootstrap(self, max_bootstraps)
[151](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:151) break
[153](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:153) if example_idx not in bootstrapped:
--> [154](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:154) success = self._bootstrap_one_example(example, round_idx)
[156](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:156) if success:
[157](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:157) bootstrapped[example_idx] = True
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:210, in BootstrapFewShot._bootstrap_one_example(self, example, round_idx)
[208](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:208) current_error_count = self.error_count
[209](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:209) if current_error_count >= self.max_errors:
--> [210](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:210) raise e
[211](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:211) dspy.logger.error(f"Failed to run or to evaluate example {example} with {self.metric} due to {e}.")
[213](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:213) if success:
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:190, in BootstrapFewShot._bootstrap_one_example(self, example, round_idx)
[187](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:187) predictor_cache[name] = predictor.demos
[188](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:188) predictor.demos = [x for x in predictor.demos if x != example]
--> [190](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:190) prediction = teacher(**example.inputs())
[191](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:191) trace = dsp.settings.trace
[193](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/teleprompt/bootstrap.py:193) for name, predictor in teacher.named_predictors():
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:26, in Module.__call__(self, *args, **kwargs)
[25](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:25) def __call__(self, *args, **kwargs):
---> [26](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/primitives/program.py:26) return self.forward(*args, **kwargs)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:261, in LlamaIndexModule.forward(self, **kwargs)
[259](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:259) def forward(self, **kwargs: Any) -> Dict[str, Any]:
[260](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:260) """Forward."""
--> [261](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:261) output_dict = self.query_pipeline.run(**kwargs, return_values_direct=False)
[262](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/dspy/predict/llamaindex.py:262) return dspy.Prediction(**output_dict)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:342, in QueryPipeline.run(self, return_values_direct, callback_manager, batch, *args, **kwargs)
[338](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:338) query_payload = json.dumps(str(kwargs))
[339](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:339) with self.callback_manager.event(
[340](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:340) CBEventType.QUERY, payload={EventPayload.QUERY_STR: query_payload}
[341](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:341) ) as query_event:
--> [342](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:342) outputs, _ = self._run(
[343](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:343) *args,
[344](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:344) return_values_direct=return_values_direct,
[345](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:345) show_intermediates=False,
[346](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:346) batch=batch,
[347](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:347) **kwargs,
[348](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:348) )
[350](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:350) return outputs
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:706, in QueryPipeline._run(self, return_values_direct, show_intermediates, batch, *args, **kwargs)
[704](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:704) return result_outputs, intermediates
[705](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:705) else:
--> [706](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:706) result_outputs, intermediates = self._run_multi(
[707](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:707) {root_key: kwargs}, show_intermediates=show_intermediates
[708](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:708) )
[710](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:710) return (
[711](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:711) self._get_single_result_output(result_outputs, return_values_direct),
[712](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:712) intermediates,
[713](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:713) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:857, in QueryPipeline._run_multi(self, module_input_dict, show_intermediates)
[855](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:855) if self.verbose:
[856](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:856) print_debug_input(module_key, module_input)
--> [857](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:857) output_dict = module.run_component(**module_input)
[859](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:859) if (
[860](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:860) show_intermediates
[861](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:861) and module_key not in run_state.intermediate_outputs
[862](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:862) ):
[863](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:863) run_state.intermediate_outputs[module_key] = ComponentIntermediates(
[864](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:864) inputs=module_input, outputs=output_dict
[865](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/query_pipeline/query.py:865) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:201, in QueryComponent.run_component(self, **kwargs)
[199](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:199) kwargs.update(self.partial_dict)
[200](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:200) kwargs = self.validate_component_inputs(kwargs)
--> [201](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:201) component_outputs = self._run_component(**kwargs)
[202](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/query_pipeline/query.py:202) return self.validate_component_outputs(component_outputs)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:345, in RetrieverComponent._run_component(self, **kwargs)
[343](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:343) def _run_component(self, **kwargs: Any) -> Any:
[344](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:344) """Run component."""
--> [345](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:345) output = self.retriever.retrieve(kwargs["input"])
[346](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:346) return {"output": output}
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:243, in BaseRetriever.retrieve(self, str_or_query_bundle)
[238](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:238) with self.callback_manager.as_trace("query"):
[239](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:239) with self.callback_manager.event(
[240](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:240) CBEventType.RETRIEVE,
[241](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:241) payload={EventPayload.QUERY_STR: query_bundle.query_str},
[242](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:242) ) as retrieve_event:
--> [243](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:243) nodes = self._retrieve(query_bundle)
[244](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:244) nodes = self._handle_recursive_retrieval(query_bundle, nodes)
[245](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:245) retrieve_event.on_end(
[246](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:246) payload={EventPayload.NODES: nodes},
[247](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/base_retriever.py:247) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:97, in VectorIndexRetriever._retrieve(self, query_bundle)
[94](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:94) if self._vector_store.is_embedding_query:
[95](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:95) if query_bundle.embedding is None and len(query_bundle.embedding_strs) > 0:
[96](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:96) query_bundle.embedding = (
---> [97](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:97) self._embed_model.get_agg_embedding_from_queries(
[98](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:98) query_bundle.embedding_strs
[99](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:99) )
[100](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:100) )
[101](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/indices/vector_store/retrievers/retriever.py:101) return self._get_nodes_with_embeddings(query_bundle)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:184, in BaseEmbedding.get_agg_embedding_from_queries(self, queries, agg_fn)
[178](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:178) def get_agg_embedding_from_queries(
[179](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:179) self,
[180](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:180) queries: List[str],
[181](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:181) agg_fn: Optional[Callable[..., Embedding]] = None,
[182](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:182) ) -> Embedding:
[183](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:183) """Get aggregated embedding from multiple queries."""
--> [184](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:184) query_embeddings = [self.get_query_embedding(query) for query in queries]
[185](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:185) agg_fn = agg_fn or mean_agg
[186](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:186) return agg_fn(query_embeddings)
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:133, in BaseEmbedding.get_query_embedding(self, query)
[125](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:125) dispatcher.event(
[126](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:126) EmbeddingStartEvent(
[127](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:127) model_dict=model_dict,
[128](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:128) )
[129](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:129) )
[130](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:130) with self.callback_manager.event(
[131](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:131) CBEventType.EMBEDDING, payload={EventPayload.SERIALIZED: self.to_dict()}
[132](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:132) ) as event:
--> [133](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:133) query_embedding = self._get_query_embedding(query)
[135](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:135) event.on_end(
[136](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:136) payload={
[137](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:137) EventPayload.CHUNKS: [query],
[138](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:138) EventPayload.EMBEDDINGS: [query_embedding],
[139](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:139) },
[140](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:140) )
[141](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:141) dispatcher.event(
[142](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:142) EmbeddingEndEvent(
[143](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:143) chunks=[query],
[144](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:144) embeddings=[query_embedding],
[145](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:145) )
[146](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/base/embeddings/base.py:146) )
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
[226](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:226) self.span_enter(
[227](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:227) id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
[228](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:228) )
[229](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:229) try:
--> [230](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:230) result = func(*args, **kwargs)
[231](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:231) except BaseException as e:
[232](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/core/instrumentation/dispatcher.py:232) self.event(SpanDropEvent(span_id=id_, err_str=str(e)))
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:133, in HuggingFaceEmbedding._get_query_embedding(self, query)
[131](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:131) def _get_query_embedding(self, query: str) -> List[float]:
[132](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:132) """Get query embedding."""
--> [133](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:133) return self._embed(query, prompt_name="query")
File /App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:124, in HuggingFaceEmbedding._embed(self, sentences, prompt_name)
[118](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:118) def _embed(
[119](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:119) self,
[120](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:120) sentences: List[str],
[121](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:121) prompt_name: Optional[str] = None,
[122](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:122) ) -> List[List[float]]:
[123](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:123) """Embed sentences."""
--> [124](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:124) return self._model.encode(
[125](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:125) sentences,
[126](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:126) batch_size=self.embed_batch_size,
[127](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:127) prompt_name=prompt_name,
[128](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:128) normalize_embeddings=self.normalize,
[129](https://vscode-remote+ssh-002dremote-002bsgsv-002dprd-002dcmva01.vscode-resource.vscode-cdn.net/App/tlim2/Anaconda3/envs/llamaindex/lib/python3.12/site-packages/llama_index/embeddings/huggingface/base.py:129) ).tolist()
AttributeError: 'HuggingFaceEmbedding' object has no attribute '_model'
from dspy.
I was able to make it work using LlamaIndex's OllamaEmbeddings workaround. I think this issue only exists for the HuggingFaceEmbedding class
That's a really good observation. I think you should include this fact and open it on the llamaindex repo, then. It seems outside DSPy.
That said, if you could show them the snippet below, which is from dspy/predict/llamaindex.py Lines 259-262:
def forward(self, **kwargs: Any) -> Dict[str, Any]:
"""Forward."""
output_dict = self.query_pipeline.run(**kwargs, return_values_direct=False)
return dspy.Prediction(**output_dict)
from dspy.
FWIW, it is an issue with copy.deepcopy()
on a LlamaIndex vector stores using HuggingFaceEmbedding. Through copy.deepcopy()
HuggingFaceEmbedding loses the attribute _model
. This becomes an issue in the teleprompters, as here:
dspy/dspy/teleprompt/bootstrap.py
Line 96 in d8b8909
where
student.reset_copy()
uses copy.deepcopy(). Outside the teleprompter everything is kosher.
I submitted a bug fix request at LlamaIndex (run-llama/llama_index#14837)
from dspy.
This bandaid seem to work for
dspy/dspy/primitives/module.py
Line 106 in d8b8909
def reset_copy(self):
import llama_index
obj = copy.deepcopy(self)
######################################################
for attribute_name in dir(obj):
if not attribute_name.startswith('_'):
attribute_value = getattr(obj, attribute_name)
if isinstance(attribute_value, llama_index.core.indices.vector_store.retrievers.retriever.VectorIndexRetriever):
setattr(obj, attribute_name, getattr(self, attribute_name))
######################################################
for param in obj.parameters():
param.reset()
OR better yet in llama_index/core/schema.py
comment out line 84
84 # state["__private_attribute_values__"] = {}
from dspy.
Related Issues (20)
- Support for AWS Credentials Input in dspy.Bedrock
- MIPRO does not return demonstrations
- Request for OpenAI Structured Output Support HOT 2
- InvalidDimensionException: Embedding dimension X does not match collection dimensionality Y
- Add support for default_headers in OpenAI client
- Need more info or documentation on dspy.settings.experimental HOT 1
- Use of a Retriever with the attribute with_metadata leads to an unexpected behaviour.
- Mising inport for Mongo retriever HOT 1
- optimization: add dedent for __doc__ HOT 1
- Guidance on use case
- How to save the traces as a file locally? HOT 3
- Developing a Dockerfile for dspy
- Pydantic package upgrade HOT 2
- Grammar-Based Prompt Format Optimization
- Error in trying to save compiled dspy program using optimized_program.save(YOUR_SAVE_PATH) HOT 4
- `LangchainPredict` class not compatible with `COPRO` optimizer
- [ERROR] MIPROv2 + multi hop module results in IndexError HOT 1
- Issues Combining BootstrapFewShot and dspy.context HOT 2
- dspy.Mistral Fails to Recognize Installed mistralai Package
- Disabling Sentry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dspy.