foundationallm-agent-plugins-experimental 0.9.7rc485__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.
- foundationallm_agent_plugins_experimental/__init__.py +1 -0
- foundationallm_agent_plugins_experimental/_metadata/foundationallm_manifest.json +7 -0
- foundationallm_agent_plugins_experimental/tool_plugin_manager.py +32 -0
- foundationallm_agent_plugins_experimental/tools/__init__.py +1 -0
- foundationallm_agent_plugins_experimental/tools/foundationallm_nop_tool.py +77 -0
- foundationallm_agent_plugins_experimental/tools/foundationallm_nop_tool_input.py +7 -0
- foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/METADATA +26 -0
- foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/RECORD +10 -0
- foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/WHEEL +5 -0
- foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .tool_plugin_manager import FoundationaLLMAgentToolExperimentalPluginManager
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from foundationallm.config import Configuration, UserIdentity
|
|
2
|
+
from foundationallm.models.agents import AgentTool
|
|
3
|
+
from foundationallm.langchain.common import FoundationaLLMToolBase
|
|
4
|
+
from foundationallm.plugins import ToolPluginManagerBase
|
|
5
|
+
|
|
6
|
+
from foundationallm_agent_plugins_experimental.tools import (
|
|
7
|
+
FoundationaLLMNopTool
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
class FoundationaLLMAgentToolExperimentalPluginManager(ToolPluginManagerBase):
|
|
11
|
+
|
|
12
|
+
FOUNDATIONALLM_NOP_TOOL_CLASS = 'FoundationaLLMNopTool'
|
|
13
|
+
|
|
14
|
+
def __init__(self):
|
|
15
|
+
super().__init__()
|
|
16
|
+
|
|
17
|
+
def create_tool(self,
|
|
18
|
+
tool_config: AgentTool,
|
|
19
|
+
objects: dict,
|
|
20
|
+
user_identity: UserIdentity,
|
|
21
|
+
config: Configuration,
|
|
22
|
+
intercept_http_calls: bool = False
|
|
23
|
+
) -> FoundationaLLMToolBase:
|
|
24
|
+
|
|
25
|
+
match tool_config.class_name:
|
|
26
|
+
case FoundationaLLMAgentToolExperimentalPluginManager.FOUNDATIONALLM_NOP_TOOL_CLASS:
|
|
27
|
+
return FoundationaLLMNopTool(tool_config, objects, user_identity, config, intercept_http_calls=intercept_http_calls)
|
|
28
|
+
case _:
|
|
29
|
+
raise ValueError(f'Unknown tool class: {tool_config.class_name}')
|
|
30
|
+
|
|
31
|
+
def refresh_tools(self):
|
|
32
|
+
print('Refreshing tools...')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .foundationallm_nop_tool import FoundationaLLMNopTool
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Platform imports
|
|
2
|
+
from typing import Optional, Type, Tuple
|
|
3
|
+
|
|
4
|
+
# LangChain imports
|
|
5
|
+
from langchain_core.callbacks import AsyncCallbackManagerForToolRun, CallbackManagerForToolRun
|
|
6
|
+
from langchain_core.runnables import RunnableConfig
|
|
7
|
+
from langchain_core.tools import ToolException
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel
|
|
10
|
+
|
|
11
|
+
# FoundationaLLM imports
|
|
12
|
+
from foundationallm.config import Configuration, UserIdentity
|
|
13
|
+
from foundationallm.langchain.common import (
|
|
14
|
+
FoundationaLLMToolBase,
|
|
15
|
+
FoundationaLLMToolResult
|
|
16
|
+
)
|
|
17
|
+
from foundationallm.models.agents import AgentTool
|
|
18
|
+
from foundationallm.models.constants import (
|
|
19
|
+
ContentArtifactTypeNames
|
|
20
|
+
)
|
|
21
|
+
from foundationallm.models.orchestration import ContentArtifact
|
|
22
|
+
|
|
23
|
+
from .foundationallm_nop_tool_input import FoundationaLLMNopToolInput
|
|
24
|
+
|
|
25
|
+
class FoundationaLLMNopTool(FoundationaLLMToolBase):
|
|
26
|
+
|
|
27
|
+
args_schema: Type[BaseModel] = FoundationaLLMNopToolInput
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
tool_config: AgentTool,
|
|
32
|
+
objects: dict,
|
|
33
|
+
user_identity:UserIdentity,
|
|
34
|
+
config: Configuration,
|
|
35
|
+
intercept_http_calls: bool = False
|
|
36
|
+
):
|
|
37
|
+
""" Initializes the FoundationaLLMNopTool class with the tool configuration,
|
|
38
|
+
exploded objects collection, user_identity, and platform configuration. """
|
|
39
|
+
super().__init__(tool_config, objects, user_identity, config)
|
|
40
|
+
|
|
41
|
+
def _run(self,
|
|
42
|
+
prompt: str,
|
|
43
|
+
run_manager: Optional[CallbackManagerForToolRun] = None
|
|
44
|
+
) -> str:
|
|
45
|
+
raise ToolException("This tool does not support synchronous execution. Please use the async version of the tool.")
|
|
46
|
+
|
|
47
|
+
async def _arun(self,
|
|
48
|
+
prompt: str = None,
|
|
49
|
+
runnable_config: RunnableConfig = None,
|
|
50
|
+
run_manager: Optional[AsyncCallbackManagerForToolRun] = None
|
|
51
|
+
) -> Tuple[str, FoundationaLLMToolResult]:
|
|
52
|
+
|
|
53
|
+
original_prompt = runnable_config['configurable']['original_user_prompt']
|
|
54
|
+
self.logger.info(f'Running NOP tool with prompt: {original_prompt}')
|
|
55
|
+
|
|
56
|
+
response = "Sometimes there is a lot of value in doing nothing."
|
|
57
|
+
|
|
58
|
+
content_artifacts = []
|
|
59
|
+
metadata = {
|
|
60
|
+
'prompt_tokens': str(0),
|
|
61
|
+
'completion_tokens': str(0),
|
|
62
|
+
'input_prompt': prompt
|
|
63
|
+
}
|
|
64
|
+
content_artifacts.append(ContentArtifact(
|
|
65
|
+
id = self.name,
|
|
66
|
+
title = self.name,
|
|
67
|
+
content = original_prompt,
|
|
68
|
+
source = self.name,
|
|
69
|
+
type = ContentArtifactTypeNames.TOOL_EXECUTION,
|
|
70
|
+
metadata=metadata))
|
|
71
|
+
|
|
72
|
+
return response, FoundationaLLMToolResult(
|
|
73
|
+
content=response,
|
|
74
|
+
content_artifacts=content_artifacts,
|
|
75
|
+
input_tokens=0,
|
|
76
|
+
output_tokens=0
|
|
77
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: foundationallm-agent-plugins-experimental
|
|
3
|
+
Version: 0.9.7rc485
|
|
4
|
+
Summary: FoundationaLLM Agent plugins (experimental).
|
|
5
|
+
Author-email: FoundationaLLM <dev@foundationallm.ai>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://foundationallm.ai
|
|
8
|
+
Project-URL: Issues, https://github.com/foundationallm/foundationallm/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# FoundationaLLM Agent Plugins Experimental
|
|
15
|
+
|
|
16
|
+
This package provides the experimental FoundationaLLM agent plugins.
|
|
17
|
+
|
|
18
|
+
To package and publish the package run the following commands (in the folder where `pyproject.toml` is located):
|
|
19
|
+
|
|
20
|
+
```cmd
|
|
21
|
+
python -m pip install --upgrade build
|
|
22
|
+
python -m pip install --upgrade twine
|
|
23
|
+
|
|
24
|
+
python -m build
|
|
25
|
+
python -m twine upload dist/*
|
|
26
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
foundationallm_agent_plugins_experimental/__init__.py,sha256=qtp4T_Nlgz4heIejeTtPEkJpqAWw0p4aOHSxgnBGaFA,82
|
|
2
|
+
foundationallm_agent_plugins_experimental/tool_plugin_manager.py,sha256=gmeth5ekdfip1im7SWqNirCZ48CfJFdwBBrK2H8cyus,1185
|
|
3
|
+
foundationallm_agent_plugins_experimental/_metadata/foundationallm_manifest.json,sha256=GNitBNqajP7W8Q4scuT2iboA-vR6YUlpGqQfZ75AEsI,257
|
|
4
|
+
foundationallm_agent_plugins_experimental/tools/__init__.py,sha256=PtcRvWsP6B8pu0xn8XmIo80XELmJUJmaMjcU7HYNWb8,59
|
|
5
|
+
foundationallm_agent_plugins_experimental/tools/foundationallm_nop_tool.py,sha256=m6-TUACeLGS1UK4JQ-AzNe3LCiFoFghqrAjwc4JtUO8,2712
|
|
6
|
+
foundationallm_agent_plugins_experimental/tools/foundationallm_nop_tool_input.py,sha256=P-5Gx9rb10PxY3IrtGN7abyQTRqj9Y6YLKRzJ_vHQSM,253
|
|
7
|
+
foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/METADATA,sha256=UULv1J_aEDlXWwaHOGYMi4EeqoGm7KDLTCbCJEg68qs,870
|
|
8
|
+
foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/top_level.txt,sha256=kgAfPpQjIYFQe6Z_uHUH9T6FzvCvRSF4uPXgDOWr3NU,42
|
|
10
|
+
foundationallm_agent_plugins_experimental-0.9.7rc485.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
foundationallm_agent_plugins_experimental
|