MCPcopy
hub / github.com/llmware-ai/llmware / __init__

Method __init__

llmware/agents.py:71–126  ·  view source on GitHub ↗
(self, api_key=None, verbose=True, analyze_mode=True)

Source from the content-addressed store, hash-verified

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
101 self.response_list = []
102
103 # research list provides a list of any research gathered (specifically from SQLTables currently)
104 self.research_list = []
105
106 # journal keeps a running journal output used in 'verbose' mode to the screen display
107 self.journal = []
108 self.step = 0
109
110 journal_update = f"creating object - ready to start processing."
111 self.write_to_journal(journal_update)
112
113 self.tools_deployed = []
114 self.inference_calls = 0
115
116 # set by default to localhost, 8080 and using 'demo-test' api_key
117 self.api_endpoint = "http://127.0.0.1/8080"
118 self.api_key = api_key
119 self.api_exec = False
120
121 self.sql_query = None
122
123 # check for llmware path & create if not already set up, e.g., "first time use"
124 if not os.path.exists(LLMWareConfig.get_llmware_path()):
125 LLMWareConfig.setup_llmware_workspace()
126 logger.info("Agent - Setting up LLMWare Workspace.")
127
128 def register_api_endpoint(self, api_endpoint = None, api_key=None, endpoint_on=True):

Callers

nothing calls this directly

Calls 8

write_to_journalMethod · 0.95
AgentWriterClass · 0.90
_ModelRegistryClass · 0.90
writeMethod · 0.80
get_llm_fx_tools_listMethod · 0.80
get_llmware_pathMethod · 0.80
get_llm_fx_mappingMethod · 0.45

Tested by

no test coverage detected