``LLMfx`` provides a high-level orchestration abstraction that implements multi-model, multi-step processes with the ability to load and orchestrate multiple SLIM models as tools with centralized journaling, structured work management and information aggregation. Currently, LLMfx only
| 41 | |
| 42 | |
| 43 | class LLMfx: |
| 44 | |
| 45 | """ |
| 46 | |
| 47 | ``LLMfx`` provides a high-level orchestration abstraction that implements multi-model, multi-step processes |
| 48 | with the ability to load and orchestrate multiple SLIM models as tools with centralized journaling, |
| 49 | structured work management and information aggregation. Currently, LLMfx only supports SLIM classifier |
| 50 | models, support for additional model classes will be added over time. |
| 51 | |
| 52 | Parameters |
| 53 | ---------- |
| 54 | api_key : str, optional, default=None |
| 55 | Sets the API key that used by the ``ModelCatalog`` to load models and logs. |
| 56 | |
| 57 | verbose : bool, optional, default=True |
| 58 | Sets whether ``agent_writer.write`` statements should be executed or not, e.g. if ```verbose=True```, then new |
| 59 | events that are written to the journal are written to stdout. |
| 60 | |
| 61 | analyze_mode : bool, optional, default=True |
| 62 | Sets whether logits should be retrieved when a tool is called with ``exec_function_call``. |
| 63 | |
| 64 | Returns |
| 65 | ------- |
| 66 | llmfx : LLMfx |
| 67 | A new ``LLMfx`` object. |
| 68 | |
| 69 | """ |
| 70 | |
| 71 | def __init__(self, api_key=None, verbose=True, analyze_mode=True): |
| 72 | |
| 73 | self.agent_writer = AgentWriter() |
| 74 | |
| 75 | if self.agent_writer.mode == "file": |
| 76 | logger.info(f"update: AgentWriter mode set to file - writing agent work process to: " |
| 77 | f"{os.path.join(self.agent_writer.fp_base, self.agent_writer.fn)}" |
| 78 | f"\nTo change file: `LLMWareConfig().set_agent_file('new_file_name.txt')`" |
| 79 | f"\nTo change to screen: `LLMWareConfig().set_agent_log('screen')") |
| 80 | |
| 81 | if verbose: |
| 82 | self.agent_writer.write("update: Launching LLMfx process") |
| 83 | |
| 84 | self._supported_tools = _ModelRegistry().get_llm_fx_tools_list() |
| 85 | self._default_tool_map = _ModelRegistry().get_llm_fx_mapping() |
| 86 | |
| 87 | for tools in self._supported_tools: |
| 88 | setattr(self, tools + "_model", None) |
| 89 | |
| 90 | self.work_queue = [] |
| 91 | self.work_iteration = 0 |
| 92 | |
| 93 | self.verbose = verbose |
| 94 | self.analyze_mode = analyze_mode |
| 95 | |
| 96 | # report is a list of dictionaries, with each dictionary linked to a work item number |
| 97 | # reports are automatically aggregated through the lifecycle of the object |
| 98 | self.report = [] |
| 99 | |
| 100 | # response list provides a list of the llm tool responses |
no outgoing calls