lfx-nightly 0.1.13.dev0__py3-none-any.whl → 0.2.0.dev26__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.
- lfx/_assets/component_index.json +1 -1
- lfx/base/agents/agent.py +121 -29
- lfx/base/agents/altk_base_agent.py +380 -0
- lfx/base/agents/altk_tool_wrappers.py +565 -0
- lfx/base/agents/events.py +103 -35
- lfx/base/agents/utils.py +15 -2
- lfx/base/composio/composio_base.py +183 -233
- lfx/base/data/base_file.py +88 -21
- lfx/base/data/storage_utils.py +192 -0
- lfx/base/data/utils.py +178 -14
- lfx/base/datastax/__init__.py +5 -0
- lfx/{components/vectorstores/astradb.py → base/datastax/astradb_base.py} +84 -473
- lfx/base/embeddings/embeddings_class.py +113 -0
- lfx/base/io/chat.py +5 -4
- lfx/base/mcp/util.py +101 -15
- lfx/base/models/groq_constants.py +74 -58
- lfx/base/models/groq_model_discovery.py +265 -0
- lfx/base/models/model.py +1 -1
- lfx/base/models/model_input_constants.py +74 -7
- lfx/base/models/model_utils.py +100 -0
- lfx/base/models/ollama_constants.py +3 -0
- lfx/base/models/openai_constants.py +7 -0
- lfx/base/models/watsonx_constants.py +36 -0
- lfx/base/tools/run_flow.py +601 -129
- lfx/cli/commands.py +7 -4
- lfx/cli/common.py +2 -2
- lfx/cli/run.py +1 -1
- lfx/cli/script_loader.py +53 -11
- lfx/components/Notion/create_page.py +1 -1
- lfx/components/Notion/list_database_properties.py +1 -1
- lfx/components/Notion/list_pages.py +1 -1
- lfx/components/Notion/list_users.py +1 -1
- lfx/components/Notion/page_content_viewer.py +1 -1
- lfx/components/Notion/search.py +1 -1
- lfx/components/Notion/update_page_property.py +1 -1
- lfx/components/__init__.py +19 -5
- lfx/components/altk/__init__.py +34 -0
- lfx/components/altk/altk_agent.py +193 -0
- lfx/components/amazon/amazon_bedrock_converse.py +1 -1
- lfx/components/apify/apify_actor.py +4 -4
- lfx/components/composio/__init__.py +70 -18
- lfx/components/composio/apollo_composio.py +11 -0
- lfx/components/composio/bitbucket_composio.py +11 -0
- lfx/components/composio/canva_composio.py +11 -0
- lfx/components/composio/coda_composio.py +11 -0
- lfx/components/composio/composio_api.py +10 -0
- lfx/components/composio/discord_composio.py +1 -1
- lfx/components/composio/elevenlabs_composio.py +11 -0
- lfx/components/composio/exa_composio.py +11 -0
- lfx/components/composio/firecrawl_composio.py +11 -0
- lfx/components/composio/fireflies_composio.py +11 -0
- lfx/components/composio/gmail_composio.py +1 -1
- lfx/components/composio/googlebigquery_composio.py +11 -0
- lfx/components/composio/googlecalendar_composio.py +1 -1
- lfx/components/composio/googledocs_composio.py +1 -1
- lfx/components/composio/googlemeet_composio.py +1 -1
- lfx/components/composio/googlesheets_composio.py +1 -1
- lfx/components/composio/googletasks_composio.py +1 -1
- lfx/components/composio/heygen_composio.py +11 -0
- lfx/components/composio/mem0_composio.py +11 -0
- lfx/components/composio/peopledatalabs_composio.py +11 -0
- lfx/components/composio/perplexityai_composio.py +11 -0
- lfx/components/composio/serpapi_composio.py +11 -0
- lfx/components/composio/slack_composio.py +3 -574
- lfx/components/composio/slackbot_composio.py +1 -1
- lfx/components/composio/snowflake_composio.py +11 -0
- lfx/components/composio/tavily_composio.py +11 -0
- lfx/components/composio/youtube_composio.py +2 -2
- lfx/components/{agents → cuga}/__init__.py +5 -7
- lfx/components/cuga/cuga_agent.py +730 -0
- lfx/components/data/__init__.py +78 -28
- lfx/components/data_source/__init__.py +58 -0
- lfx/components/{data → data_source}/api_request.py +26 -3
- lfx/components/{data → data_source}/csv_to_data.py +15 -10
- lfx/components/{data → data_source}/json_to_data.py +15 -8
- lfx/components/{data → data_source}/news_search.py +1 -1
- lfx/components/{data → data_source}/rss.py +1 -1
- lfx/components/{data → data_source}/sql_executor.py +1 -1
- lfx/components/{data → data_source}/url.py +1 -1
- lfx/components/{data → data_source}/web_search.py +1 -1
- lfx/components/datastax/__init__.py +12 -6
- lfx/components/datastax/{astra_assistant_manager.py → astradb_assistant_manager.py} +1 -0
- lfx/components/datastax/astradb_chatmemory.py +40 -0
- lfx/components/datastax/astradb_cql.py +6 -32
- lfx/components/datastax/astradb_graph.py +10 -124
- lfx/components/datastax/astradb_tool.py +13 -53
- lfx/components/datastax/astradb_vectorstore.py +134 -977
- lfx/components/datastax/create_assistant.py +1 -0
- lfx/components/datastax/create_thread.py +1 -0
- lfx/components/datastax/dotenv.py +1 -0
- lfx/components/datastax/get_assistant.py +1 -0
- lfx/components/datastax/getenvvar.py +1 -0
- lfx/components/datastax/graph_rag.py +1 -1
- lfx/components/datastax/hcd.py +1 -1
- lfx/components/datastax/list_assistants.py +1 -0
- lfx/components/datastax/run.py +1 -0
- lfx/components/deactivated/json_document_builder.py +1 -1
- lfx/components/elastic/elasticsearch.py +1 -1
- lfx/components/elastic/opensearch_multimodal.py +1575 -0
- lfx/components/files_and_knowledge/__init__.py +47 -0
- lfx/components/{data → files_and_knowledge}/directory.py +1 -1
- lfx/components/{data → files_and_knowledge}/file.py +246 -18
- lfx/components/{knowledge_bases → files_and_knowledge}/ingestion.py +17 -9
- lfx/components/{knowledge_bases → files_and_knowledge}/retrieval.py +18 -10
- lfx/components/{data → files_and_knowledge}/save_file.py +142 -22
- lfx/components/flow_controls/__init__.py +58 -0
- lfx/components/{logic → flow_controls}/conditional_router.py +1 -1
- lfx/components/{logic → flow_controls}/loop.py +47 -9
- lfx/components/flow_controls/run_flow.py +108 -0
- lfx/components/glean/glean_search_api.py +1 -1
- lfx/components/groq/groq.py +35 -28
- lfx/components/helpers/__init__.py +102 -0
- lfx/components/ibm/watsonx.py +25 -21
- lfx/components/input_output/__init__.py +3 -1
- lfx/components/input_output/chat.py +12 -3
- lfx/components/input_output/chat_output.py +12 -4
- lfx/components/input_output/text.py +1 -1
- lfx/components/input_output/text_output.py +1 -1
- lfx/components/{data → input_output}/webhook.py +1 -1
- lfx/components/knowledge_bases/__init__.py +59 -4
- lfx/components/langchain_utilities/character.py +1 -1
- lfx/components/langchain_utilities/csv_agent.py +84 -16
- lfx/components/langchain_utilities/json_agent.py +67 -12
- lfx/components/langchain_utilities/language_recursive.py +1 -1
- lfx/components/llm_operations/__init__.py +46 -0
- lfx/components/{processing → llm_operations}/batch_run.py +1 -1
- lfx/components/{processing → llm_operations}/lambda_filter.py +1 -1
- lfx/components/{logic → llm_operations}/llm_conditional_router.py +1 -1
- lfx/components/{processing/llm_router.py → llm_operations/llm_selector.py} +3 -3
- lfx/components/{processing → llm_operations}/structured_output.py +56 -18
- lfx/components/logic/__init__.py +126 -0
- lfx/components/mem0/mem0_chat_memory.py +11 -0
- lfx/components/mistral/mistral_embeddings.py +1 -1
- lfx/components/models/__init__.py +64 -9
- lfx/components/models_and_agents/__init__.py +49 -0
- lfx/components/{agents → models_and_agents}/agent.py +49 -6
- lfx/components/models_and_agents/embedding_model.py +423 -0
- lfx/components/models_and_agents/language_model.py +398 -0
- lfx/components/{agents → models_and_agents}/mcp_component.py +84 -45
- lfx/components/{helpers → models_and_agents}/memory.py +1 -1
- lfx/components/nvidia/system_assist.py +1 -1
- lfx/components/olivya/olivya.py +1 -1
- lfx/components/ollama/ollama.py +235 -14
- lfx/components/openrouter/openrouter.py +49 -147
- lfx/components/processing/__init__.py +9 -57
- lfx/components/processing/converter.py +1 -1
- lfx/components/processing/dataframe_operations.py +1 -1
- lfx/components/processing/parse_json_data.py +2 -2
- lfx/components/processing/parser.py +7 -2
- lfx/components/processing/split_text.py +1 -1
- lfx/components/qdrant/qdrant.py +1 -1
- lfx/components/redis/redis.py +1 -1
- lfx/components/twelvelabs/split_video.py +10 -0
- lfx/components/twelvelabs/video_file.py +12 -0
- lfx/components/utilities/__init__.py +43 -0
- lfx/components/{helpers → utilities}/calculator_core.py +1 -1
- lfx/components/{helpers → utilities}/current_date.py +1 -1
- lfx/components/{processing → utilities}/python_repl_core.py +1 -1
- lfx/components/vectorstores/__init__.py +0 -6
- lfx/components/vectorstores/local_db.py +9 -0
- lfx/components/youtube/youtube_transcripts.py +118 -30
- lfx/custom/custom_component/component.py +60 -3
- lfx/custom/custom_component/custom_component.py +68 -6
- lfx/field_typing/constants.py +1 -0
- lfx/graph/edge/base.py +45 -22
- lfx/graph/graph/base.py +5 -2
- lfx/graph/graph/schema.py +3 -2
- lfx/graph/state/model.py +15 -2
- lfx/graph/utils.py +6 -0
- lfx/graph/vertex/base.py +4 -1
- lfx/graph/vertex/param_handler.py +10 -7
- lfx/graph/vertex/vertex_types.py +1 -1
- lfx/helpers/__init__.py +12 -0
- lfx/helpers/flow.py +117 -0
- lfx/inputs/input_mixin.py +24 -1
- lfx/inputs/inputs.py +13 -1
- lfx/interface/components.py +161 -83
- lfx/io/schema.py +6 -0
- lfx/log/logger.py +5 -3
- lfx/schema/schema.py +5 -0
- lfx/services/database/__init__.py +5 -0
- lfx/services/database/service.py +25 -0
- lfx/services/deps.py +87 -22
- lfx/services/manager.py +19 -6
- lfx/services/mcp_composer/service.py +998 -157
- lfx/services/session.py +5 -0
- lfx/services/settings/base.py +51 -7
- lfx/services/settings/constants.py +8 -0
- lfx/services/storage/local.py +76 -46
- lfx/services/storage/service.py +152 -29
- lfx/template/field/base.py +3 -0
- lfx/utils/ssrf_protection.py +384 -0
- lfx/utils/validate_cloud.py +26 -0
- {lfx_nightly-0.1.13.dev0.dist-info → lfx_nightly-0.2.0.dev26.dist-info}/METADATA +38 -22
- {lfx_nightly-0.1.13.dev0.dist-info → lfx_nightly-0.2.0.dev26.dist-info}/RECORD +210 -196
- {lfx_nightly-0.1.13.dev0.dist-info → lfx_nightly-0.2.0.dev26.dist-info}/WHEEL +1 -1
- lfx/components/agents/cuga_agent.py +0 -1013
- lfx/components/datastax/astra_db.py +0 -77
- lfx/components/datastax/cassandra.py +0 -92
- lfx/components/logic/run_flow.py +0 -71
- lfx/components/models/embedding_model.py +0 -114
- lfx/components/models/language_model.py +0 -144
- lfx/components/vectorstores/astradb_graph.py +0 -326
- lfx/components/vectorstores/cassandra.py +0 -264
- lfx/components/vectorstores/cassandra_graph.py +0 -238
- lfx/components/vectorstores/chroma.py +0 -167
- lfx/components/vectorstores/clickhouse.py +0 -135
- lfx/components/vectorstores/couchbase.py +0 -102
- lfx/components/vectorstores/elasticsearch.py +0 -267
- lfx/components/vectorstores/faiss.py +0 -111
- lfx/components/vectorstores/graph_rag.py +0 -141
- lfx/components/vectorstores/hcd.py +0 -314
- lfx/components/vectorstores/milvus.py +0 -115
- lfx/components/vectorstores/mongodb_atlas.py +0 -213
- lfx/components/vectorstores/opensearch.py +0 -243
- lfx/components/vectorstores/pgvector.py +0 -72
- lfx/components/vectorstores/pinecone.py +0 -134
- lfx/components/vectorstores/qdrant.py +0 -109
- lfx/components/vectorstores/supabase.py +0 -76
- lfx/components/vectorstores/upstash.py +0 -124
- lfx/components/vectorstores/vectara.py +0 -97
- lfx/components/vectorstores/vectara_rag.py +0 -164
- lfx/components/vectorstores/weaviate.py +0 -89
- /lfx/components/{data → data_source}/mock_data.py +0 -0
- /lfx/components/datastax/{astra_vectorize.py → astradb_vectorize.py} +0 -0
- /lfx/components/{logic → flow_controls}/data_conditional_router.py +0 -0
- /lfx/components/{logic → flow_controls}/flow_tool.py +0 -0
- /lfx/components/{logic → flow_controls}/listen.py +0 -0
- /lfx/components/{logic → flow_controls}/notify.py +0 -0
- /lfx/components/{logic → flow_controls}/pass_message.py +0 -0
- /lfx/components/{logic → flow_controls}/sub_flow.py +0 -0
- /lfx/components/{processing → models_and_agents}/prompt.py +0 -0
- /lfx/components/{helpers → processing}/create_list.py +0 -0
- /lfx/components/{helpers → processing}/output_parser.py +0 -0
- /lfx/components/{helpers → processing}/store_message.py +0 -0
- /lfx/components/{helpers → utilities}/id_generator.py +0 -0
- {lfx_nightly-0.1.13.dev0.dist-info → lfx_nightly-0.2.0.dev26.dist-info}/entry_points.txt +0 -0
|
@@ -1,28 +1,82 @@
|
|
|
1
|
+
"""Models module - backwards compatibility alias for models_and_agents.
|
|
2
|
+
|
|
3
|
+
This module provides backwards compatibility by forwarding model-related imports
|
|
4
|
+
to models_and_agents where the actual model components are located.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
from __future__ import annotations
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
import sys
|
|
10
|
+
from typing import Any
|
|
4
11
|
|
|
5
12
|
from lfx.components._importing import import_mod
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
from lfx.components.models.embedding_model import EmbeddingModelComponent
|
|
9
|
-
from lfx.components.models.language_model import LanguageModelComponent
|
|
10
|
-
|
|
14
|
+
# Forward model components from models_and_agents
|
|
11
15
|
_dynamic_imports = {
|
|
12
|
-
"EmbeddingModelComponent": "embedding_model",
|
|
13
16
|
"LanguageModelComponent": "language_model",
|
|
17
|
+
"EmbeddingModelComponent": "embedding_model",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"EmbeddingModelComponent",
|
|
22
|
+
"LanguageModelComponent",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Register redirected submodules in sys.modules for direct importlib.import_module() calls
|
|
26
|
+
# This allows imports like: import lfx.components.models.embedding_model
|
|
27
|
+
_redirected_submodules = {
|
|
28
|
+
"lfx.components.models.embedding_model": "lfx.components.models_and_agents.embedding_model",
|
|
29
|
+
"lfx.components.models.language_model": "lfx.components.models_and_agents.language_model",
|
|
14
30
|
}
|
|
15
31
|
|
|
16
|
-
|
|
32
|
+
for old_path, new_path in _redirected_submodules.items():
|
|
33
|
+
if old_path not in sys.modules:
|
|
34
|
+
# Use a lazy loader that imports the actual module when accessed
|
|
35
|
+
class _RedirectedModule:
|
|
36
|
+
def __init__(self, target_path: str, original_path: str):
|
|
37
|
+
self._target_path = target_path
|
|
38
|
+
self._original_path = original_path
|
|
39
|
+
self._module = None
|
|
40
|
+
|
|
41
|
+
def __getattr__(self, name: str) -> Any:
|
|
42
|
+
if self._module is None:
|
|
43
|
+
from importlib import import_module
|
|
44
|
+
|
|
45
|
+
self._module = import_module(self._target_path)
|
|
46
|
+
# Also register under the original path for future imports
|
|
47
|
+
sys.modules[self._original_path] = self._module
|
|
48
|
+
return getattr(self._module, name)
|
|
49
|
+
|
|
50
|
+
def __repr__(self) -> str:
|
|
51
|
+
return f"<redirected module '{self._original_path}' -> '{self._target_path}'>"
|
|
52
|
+
|
|
53
|
+
sys.modules[old_path] = _RedirectedModule(new_path, old_path)
|
|
17
54
|
|
|
18
55
|
|
|
19
56
|
def __getattr__(attr_name: str) -> Any:
|
|
20
|
-
"""
|
|
57
|
+
"""Forward attribute access to models_and_agents components."""
|
|
58
|
+
# Handle submodule access for backwards compatibility
|
|
59
|
+
if attr_name == "embedding_model":
|
|
60
|
+
from importlib import import_module
|
|
61
|
+
|
|
62
|
+
result = import_module("lfx.components.models_and_agents.embedding_model")
|
|
63
|
+
globals()[attr_name] = result
|
|
64
|
+
return result
|
|
65
|
+
if attr_name == "language_model":
|
|
66
|
+
from importlib import import_module
|
|
67
|
+
|
|
68
|
+
result = import_module("lfx.components.models_and_agents.language_model")
|
|
69
|
+
globals()[attr_name] = result
|
|
70
|
+
return result
|
|
71
|
+
|
|
21
72
|
if attr_name not in _dynamic_imports:
|
|
22
73
|
msg = f"module '{__name__}' has no attribute '{attr_name}'"
|
|
23
74
|
raise AttributeError(msg)
|
|
75
|
+
|
|
76
|
+
# Import from models_and_agents using the correct package path
|
|
77
|
+
package = "lfx.components.models_and_agents"
|
|
24
78
|
try:
|
|
25
|
-
result = import_mod(attr_name, _dynamic_imports[attr_name],
|
|
79
|
+
result = import_mod(attr_name, _dynamic_imports[attr_name], package)
|
|
26
80
|
except (ModuleNotFoundError, ImportError, AttributeError) as e:
|
|
27
81
|
msg = f"Could not import '{attr_name}' from '{__name__}': {e}"
|
|
28
82
|
raise AttributeError(msg) from e
|
|
@@ -31,4 +85,5 @@ def __getattr__(attr_name: str) -> Any:
|
|
|
31
85
|
|
|
32
86
|
|
|
33
87
|
def __dir__() -> list[str]:
|
|
88
|
+
"""Return directory of available components."""
|
|
34
89
|
return list(__all__)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Any
|
|
4
|
+
|
|
5
|
+
from lfx.components._importing import import_mod
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from lfx.components.models_and_agents.agent import AgentComponent
|
|
9
|
+
from lfx.components.models_and_agents.embedding_model import EmbeddingModelComponent
|
|
10
|
+
from lfx.components.models_and_agents.language_model import LanguageModelComponent
|
|
11
|
+
from lfx.components.models_and_agents.mcp_component import MCPToolsComponent
|
|
12
|
+
from lfx.components.models_and_agents.memory import MemoryComponent
|
|
13
|
+
from lfx.components.models_and_agents.prompt import PromptComponent
|
|
14
|
+
|
|
15
|
+
_dynamic_imports = {
|
|
16
|
+
"AgentComponent": "agent",
|
|
17
|
+
"EmbeddingModelComponent": "embedding_model",
|
|
18
|
+
"LanguageModelComponent": "language_model",
|
|
19
|
+
"MCPToolsComponent": "mcp_component",
|
|
20
|
+
"MemoryComponent": "memory",
|
|
21
|
+
"PromptComponent": "prompt",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"AgentComponent",
|
|
26
|
+
"EmbeddingModelComponent",
|
|
27
|
+
"LanguageModelComponent",
|
|
28
|
+
"MCPToolsComponent",
|
|
29
|
+
"MemoryComponent",
|
|
30
|
+
"PromptComponent",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def __getattr__(attr_name: str) -> Any:
|
|
35
|
+
"""Lazily import model and agent components on attribute access."""
|
|
36
|
+
if attr_name not in _dynamic_imports:
|
|
37
|
+
msg = f"module '{__name__}' has no attribute '{attr_name}'"
|
|
38
|
+
raise AttributeError(msg)
|
|
39
|
+
try:
|
|
40
|
+
result = import_mod(attr_name, _dynamic_imports[attr_name], __spec__.parent)
|
|
41
|
+
except (ModuleNotFoundError, ImportError, AttributeError) as e:
|
|
42
|
+
msg = f"Could not import '{attr_name}' from '{__name__}': {e}"
|
|
43
|
+
raise AttributeError(msg) from e
|
|
44
|
+
globals()[attr_name] = result
|
|
45
|
+
return result
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def __dir__() -> list[str]:
|
|
49
|
+
return list(__all__)
|
|
@@ -14,14 +14,14 @@ from lfx.base.models.model_input_constants import (
|
|
|
14
14
|
MODELS_METADATA,
|
|
15
15
|
)
|
|
16
16
|
from lfx.base.models.model_utils import get_model_name
|
|
17
|
-
from lfx.components.helpers
|
|
18
|
-
from lfx.components.helpers.memory import MemoryComponent
|
|
17
|
+
from lfx.components.helpers import CurrentDateComponent
|
|
19
18
|
from lfx.components.langchain_utilities.tool_calling import ToolCallingAgentComponent
|
|
19
|
+
from lfx.components.models_and_agents.memory import MemoryComponent
|
|
20
20
|
from lfx.custom.custom_component.component import get_component_toolkit
|
|
21
21
|
from lfx.custom.utils import update_component_build_config
|
|
22
22
|
from lfx.helpers.base_model import build_model_from_schema
|
|
23
|
-
from lfx.inputs.inputs import BoolInput
|
|
24
|
-
from lfx.io import DropdownInput, IntInput, MultilineInput, Output, TableInput
|
|
23
|
+
from lfx.inputs.inputs import BoolInput, SecretStrInput, StrInput
|
|
24
|
+
from lfx.io import DropdownInput, IntInput, MessageTextInput, MultilineInput, Output, TableInput
|
|
25
25
|
from lfx.log.logger import logger
|
|
26
26
|
from lfx.schema.data import Data
|
|
27
27
|
from lfx.schema.dotdict import dotdict
|
|
@@ -77,6 +77,32 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
),
|
|
80
|
+
SecretStrInput(
|
|
81
|
+
name="api_key",
|
|
82
|
+
display_name="API Key",
|
|
83
|
+
info="The API key to use for the model.",
|
|
84
|
+
required=True,
|
|
85
|
+
),
|
|
86
|
+
StrInput(
|
|
87
|
+
name="base_url",
|
|
88
|
+
display_name="Base URL",
|
|
89
|
+
info="The base URL of the API.",
|
|
90
|
+
required=True,
|
|
91
|
+
show=False,
|
|
92
|
+
),
|
|
93
|
+
StrInput(
|
|
94
|
+
name="project_id",
|
|
95
|
+
display_name="Project ID",
|
|
96
|
+
info="The project ID of the model.",
|
|
97
|
+
required=True,
|
|
98
|
+
show=False,
|
|
99
|
+
),
|
|
100
|
+
IntInput(
|
|
101
|
+
name="max_output_tokens",
|
|
102
|
+
display_name="Max Output Tokens",
|
|
103
|
+
info="The maximum number of tokens to generate.",
|
|
104
|
+
show=False,
|
|
105
|
+
),
|
|
80
106
|
*openai_inputs_filtered,
|
|
81
107
|
MultilineInput(
|
|
82
108
|
name="system_prompt",
|
|
@@ -85,6 +111,13 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
85
111
|
value="You are a helpful assistant that can use tools to answer questions and perform tasks.",
|
|
86
112
|
advanced=False,
|
|
87
113
|
),
|
|
114
|
+
MessageTextInput(
|
|
115
|
+
name="context_id",
|
|
116
|
+
display_name="Context ID",
|
|
117
|
+
info="The context ID of the chat. Adds an extra layer to the local memory.",
|
|
118
|
+
value="",
|
|
119
|
+
advanced=True,
|
|
120
|
+
),
|
|
88
121
|
IntInput(
|
|
89
122
|
name="n_messages",
|
|
90
123
|
display_name="Number of Chat History Messages",
|
|
@@ -154,7 +187,7 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
154
187
|
},
|
|
155
188
|
],
|
|
156
189
|
),
|
|
157
|
-
*LCToolsAgentComponent.
|
|
190
|
+
*LCToolsAgentComponent.get_base_inputs(),
|
|
158
191
|
# removed memory inputs from agent component
|
|
159
192
|
# *memory_inputs,
|
|
160
193
|
BoolInput(
|
|
@@ -188,10 +221,15 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
188
221
|
if not isinstance(self.tools, list): # type: ignore[has-type]
|
|
189
222
|
self.tools = []
|
|
190
223
|
current_date_tool = (await CurrentDateComponent(**self.get_base_args()).to_toolkit()).pop(0)
|
|
224
|
+
|
|
191
225
|
if not isinstance(current_date_tool, StructuredTool):
|
|
192
226
|
msg = "CurrentDateComponent must be converted to a StructuredTool"
|
|
193
227
|
raise TypeError(msg)
|
|
194
228
|
self.tools.append(current_date_tool)
|
|
229
|
+
|
|
230
|
+
# Set shared callbacks for tracing the tools used by the agent
|
|
231
|
+
self.set_tools_callbacks(self.tools, self._get_shared_callbacks())
|
|
232
|
+
|
|
195
233
|
return llm_model, self.chat_history, self.tools
|
|
196
234
|
|
|
197
235
|
async def message_response(self) -> Message:
|
|
@@ -408,6 +446,7 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
408
446
|
await MemoryComponent(**self.get_base_args())
|
|
409
447
|
.set(
|
|
410
448
|
session_id=self.graph.session_id,
|
|
449
|
+
context_id=self.context_id,
|
|
411
450
|
order="Ascending",
|
|
412
451
|
n_messages=self.n_messages,
|
|
413
452
|
)
|
|
@@ -463,7 +502,8 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
463
502
|
def delete_fields(self, build_config: dotdict, fields: dict | list[str]) -> None:
|
|
464
503
|
"""Delete specified fields from build_config."""
|
|
465
504
|
for field in fields:
|
|
466
|
-
build_config
|
|
505
|
+
if build_config is not None and field in build_config:
|
|
506
|
+
build_config.pop(field, None)
|
|
467
507
|
|
|
468
508
|
def update_input_types(self, build_config: dotdict) -> dotdict:
|
|
469
509
|
"""Update input types for all fields in build_config."""
|
|
@@ -591,11 +631,14 @@ class AgentComponent(ToolCallingAgentComponent):
|
|
|
591
631
|
agent_description = self.get_tool_description()
|
|
592
632
|
# TODO: Agent Description Depreciated Feature to be removed
|
|
593
633
|
description = f"{agent_description}{tools_names}"
|
|
634
|
+
|
|
594
635
|
tools = component_toolkit(component=self).get_tools(
|
|
595
636
|
tool_name="Call_Agent",
|
|
596
637
|
tool_description=description,
|
|
638
|
+
# here we do not use the shared callbacks as we are exposing the agent as a tool
|
|
597
639
|
callbacks=self.get_langchain_callbacks(),
|
|
598
640
|
)
|
|
599
641
|
if hasattr(self, "tools_metadata"):
|
|
600
642
|
tools = component_toolkit(component=self, metadata=self.tools_metadata).update_tools_metadata(tools=tools)
|
|
643
|
+
|
|
601
644
|
return tools
|