自我发现
自我发现包
基类:EventBaseLlamaPack
自我发现包。
workflows/handler.py 中的源代码llama_index/packs/self_discover/base.py
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197 | class SelfDiscoverPack(BaseLlamaPack):
"""Self-Discover Pack."""
def __init__(
self,
llm: Optional[Any] = None,
verbose: bool = True,
) -> None:
"""Init params."""
self.llm = llm or OpenAI(model="gpt-3.5-turbo")
self.reasoning_modules = _REASONING_MODULES
self.verbose = verbose
self.workflow = SelfDiscoverWorkflow(verbose=verbose)
def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"llm": self.llm,
"reasoning_modules": self.reasoning_modules,
"workflow": self.workflow,
}
def run(self, task):
"""Runs the configured pipeline for a specified task and reasoning modules."""
return asyncio_run(self.workflow.run(task=task, llm=self.llm))
|
get_modules
get_modules() -> Dict[str, Any]
获取模块。
workflows/handler.py 中的源代码llama_index/packs/self_discover/base.py
187
188
189
190
191
192
193 | def get_modules(self) -> Dict[str, Any]:
"""Get modules."""
return {
"llm": self.llm,
"reasoning_modules": self.reasoning_modules,
"workflow": self.workflow,
}
|
run
为指定任务和推理模块运行已配置的流水线。
workflows/handler.py 中的源代码llama_index/packs/self_discover/base.py
| def run(self, task):
"""Runs the configured pipeline for a specified task and reasoning modules."""
return asyncio_run(self.workflow.run(task=task, llm=self.llm))
|
选项:
成员:- SelfDiscoverPack