llama_index [Bug]: AttributeError: 'AzureOpenAIMultiModal' 对象没有 'predict' 属性

unguejic  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(37)

错误描述

我正在使用子问题查询引擎,该引擎使用了gpt-40模型,我使用AzureOpenAIMultiModal类对其进行了初始化。当我使用子问题查询引擎进行查询时,会出现属性错误AttributeError: 'AzureOpenAIMultiModal' object has no attribute 'predict'。

版本

0.10.42

重现步骤

使用AzureOpenAIMultiModal定义gpt-4o LLM
定义查询引擎工具列表
将这些查询引擎工具传递给子问题查询引擎并开始查询。

相关日志/回溯

AttributeError                            Traceback (most recent call last)
Cell In[12], line 1
----> 1 response=query_engine.query("my question")
      2 print(response)

File C:\Users\name\AppData\Local\anaconda3\Lib\site-packages\llama_index\core\instrumentation\dispatcher.py:198, in Dispatcher.span.<locals>.wrapper(func, instance, args, kwargs)
    194 self.span_enter(
    195     id_=id_, bound_args=bound_args, instance=instance, parent_id=parent_id
    196 )
    197 try:
--> 198     result = func(*args, **kwargs)
    199 except BaseException as e:
    200     self.event(SpanDropEvent(span_id=id_, err_str=str(e)))

File C:\Users\name\AppData\Local\anaconda3\Lib\site-packages\llama_index\core\base\base_query_engine.py:51, in BaseQueryEngine.query(self, str_or_query_bundle)
     49     if isinstance(str_or_query_bundle, str):
     50         str_or_query_bundle = QueryBundle(str_or_query_bundle)
---> 51     query_result = self._query(str_or_query_bundle)
     52 dispatcher.event(
     53     QueryEndEvent(query=str_or_query_bundle, response=query_result)
     54 )
     55 return query_result

Cell In[10], line 116, in SubQuestionQueryEngine._query(self, query_bundle)
    112 def _query(self, query_bundle: QueryBundle) -> RESPONSE_TYPE:
    113     with self.callback_manager.event(
    114         CBEventType.QUERY, payload={EventPayload.QUERY_STR: query_bundle.query_str}
    115     ) as query_event:
--> 116         sub_questions = self._question_gen.generate(self._metadatas, query_bundle)
    118         colors = get_color_mapping([str(i) for i in range(len(sub_questions))])
    120         if self._verbose:

File C:\Users\name\AppData\Local\anaconda3\Lib\site-packages\llama_index\core\question_gen\llm_generators.py:74, in LLMQuestionGenerator.generate(self, tools, query)
     72 tools_str = build_tools_text(tools)
     73 query_str = query.query_str
---> 74 prediction = self._llm.predict(
     75     prompt=self._prompt,
     76     tools_str=tools_str,
     77     query_str=query_str,
     78 )
     80 assert self._prompt.output_parser is not None
     81 parse = self._prompt.output_parser.parse(prediction)

AttributeError: 'AzureOpenAIMultiModal' object has no attribute 'predict'
sbtkgmzw

sbtkgmzw1#

我认为AzureOpenAIMultiModal不能直接用于大多数查询引擎(除了多模态查询引擎)。
你可以使用AzureOpenAI,并将模型设置为gpt-4o。
通常情况下,我们需要将这些多模态类合并到主要的LLM类中,代码重复过多,难以维护。它在路线图上。

w8ntj3qf

w8ntj3qf2#

@logan-markewich ,好的,我明白了。所以你建议使用AzureOpenAI,并将模型设置为gpt-4o,我应该如何做?

o8x7eapl

o8x7eapl3#

@logan-markewich ,我使用了AzureOpenAI的gpt-4o模型,没有出现任何错误,但是子问题查询引擎无法运行子问题,并给出了空响应。

相关问题