lybic-guiagents 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lybic-guiagents might be problematic. Click here for more details.

@@ -46,6 +46,16 @@ class KnowledgeBase:
46
46
  Tools_dict: Dict,
47
47
  save_knowledge: bool = True,
48
48
  ):
49
+ """
50
+ Initialize the KnowledgeBase, configuring storage paths, embedding metadata, tool agents, and in-memory trajectory state.
51
+
52
+ Parameters:
53
+ embedding_engine (Tools): Embedding provider instance used to compute or retrieve embeddings.
54
+ local_kb_path (str): Root filesystem path where memory and embedding files are persisted.
55
+ platform (str): Platform identifier used to namespace stored files (subdirectory under local_kb_path).
56
+ Tools_dict (Dict): Configuration mapping for available tools; entries may include provider, model, and other tool-specific kwargs used to register agents.
57
+ save_knowledge (bool): Whether new episodic and narrative memories should be persisted to disk.
58
+ """
49
59
  self.platform = platform
50
60
 
51
61
  self.local_kb_path = local_kb_path
@@ -75,17 +85,38 @@ class KnowledgeBase:
75
85
  self.current_subtask_trajectory = ""
76
86
  self.current_search_query = ""
77
87
 
88
+ def _register(tools_instance, tool_name):
89
+ """
90
+ Register a tool on the given tools instance using the tool's configuration from Tools_dict.
91
+
92
+ Reads the configuration for `tool_name` from the module-level Tools_dict, extracts optional `provider` and `model` values if present, and registers the tool on `tools_instance`, forwarding any remaining configuration items as keyword arguments.
93
+
94
+ Parameters:
95
+ tools_instance: The Tools manager or registry object that exposes a `register_tool(name, provider, model, **kwargs)` method.
96
+ tool_name (str): The key identifying the tool in Tools_dict whose configuration will be used for registration.
97
+ """
98
+ config = Tools_dict.get(tool_name, {}).copy()
99
+ provider = config.pop("provider", None)
100
+ model = config.pop("model", None)
101
+ auth_keys = ['api_key', 'base_url', 'endpoint_url', 'azure_endpoint', 'api_version']
102
+ auth_params = {}
103
+ for key in auth_keys:
104
+ if key in config:
105
+ auth_params[key] = config[key]
106
+ all_params = {**config, **auth_params}
107
+ tools_instance.register_tool(tool_name, provider, model, **all_params)
108
+
78
109
  self.query_formulator = Tools()
79
- self.query_formulator.register_tool("query_formulator", Tools_dict["query_formulator"]["provider"], Tools_dict["query_formulator"]["model"])
80
-
110
+ _register(self.query_formulator, "query_formulator")
111
+
81
112
  self.knowledge_fusion_agent = Tools()
82
- self.knowledge_fusion_agent.register_tool("context_fusion", Tools_dict["context_fusion"]["provider"], Tools_dict["context_fusion"]["model"])
113
+ _register(self.knowledge_fusion_agent, "context_fusion")
83
114
 
84
115
  self.narrative_summarization_agent = Tools()
85
- self.narrative_summarization_agent.register_tool("narrative_summarization", Tools_dict["narrative_summarization"]["provider"], Tools_dict["narrative_summarization"]["model"])
116
+ _register(self.narrative_summarization_agent, "narrative_summarization")
86
117
 
87
118
  self.episode_summarization_agent = Tools()
88
- self.episode_summarization_agent.register_tool("episode_summarization", Tools_dict["episode_summarization"]["provider"], Tools_dict["episode_summarization"]["model"])
119
+ _register(self.episode_summarization_agent, "episode_summarization")
89
120
 
90
121
  self.save_knowledge = save_knowledge
91
122