-
Notifications
You must be signed in to change notification settings - Fork 9.7k
feat: agentics IBM bundle #11490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Cristhianzl
merged 88 commits into
langflow-ai:main
from
gliozzo:feature/agentics_bundle_2
Feb 27, 2026
Merged
feat: agentics IBM bundle #11490
Changes from 2 commits
Commits
Show all changes
88 commits
Select commit
Hold shift + click to select a range
330d15e
Agentics Bundle V1
42412f1
Agentics Bundle V1
994906b
add icon and improve component code
Cristhianzl a51b11f
[autofix.ci] apply automated fixes
autofix-ci[bot] 0d1bde4
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 7e89d87
Merge branch 'main' into feature/agentics_bundle_2
Cristhianzl b60e9d0
[autofix.ci] apply automated fixes
autofix-ci[bot] ca3f2ed
adjust the agentics icons
Cristhianzl a3c4e6f
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
Cristhianzl 62f5561
Semantic Operators
a9a3dad
code improvements
Cristhianzl ea81e61
merge fix
Cristhianzl da6faf4
add icon
Cristhianzl 5387b34
ruff style
Cristhianzl 94f342c
[autofix.ci] apply automated fixes
autofix-ci[bot] 2573486
add tests to agentincs bundle
Cristhianzl 2175a85
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
Cristhianzl 3c5420d
Implemented Semantic Operators, added documentation, improved existin…
cbf1bc0
add tests and improve code quality
Cristhianzl eb14e83
a review of agentics bundle documentation
junkyul ef7ac21
docs-cleanup-pages
mendonk dbb83b7
guidance-comments
mendonk 37122bf
Improved bundle documentation for agentics
92673a9
Syntetic generator bug fix, order of agentics in the bundle
8410e01
Fixed freezing problem
66cdea5
List of user defined types allowed in semantic map and semantic aggre…
51b3d57
Aggregated list on semantic map
24344f7
modify name and description of the components in a user friendly way
junkyul 57f048e
Revert JSON to version in main
72ded05
Fix version of agentics-py
101703f
bring back agentics components in the asset index
junkyul a9dc5db
display names for input and output are unfied as DataFrame; previousl…
junkyul 28c78fb
update bundle documentation. The display names are updated
junkyul a3dbeb8
[autofix.ci] apply automated fixes
autofix-ci[bot] d29ba42
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 6bae089
Luca's QA feedback addressed
be27c6f
Removed semantic operator names and used aMap, aReduce and aGenerate
2f27efa
remove one line mentioning aFilter, which is removed
junkyul 6fa860e
removes blank component component
deon-sanchez 3e6e0d9
updates templates
deon-sanchez 6008a83
Merge origin/main into feature/agentics_bundle_2, resolve conflicts i…
HimavarshaVS ff4f5bc
Merge remote-tracking branch 'origin' into feature/agentics_bundle_2
HimavarshaVS e06af76
fix tests
HimavarshaVS da9cdac
fix tests
HimavarshaVS 8edff85
fix: remove tests for deleted agentics components, update tests for r…
HimavarshaVS 742623e
fix ruff errors
HimavarshaVS 70d271c
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS 6d20f59
[autofix.ci] apply automated fixes
autofix-ci[bot] 3549153
Merge remote-tracking branch 'origin' into feature/agentics_bundle_2
HimavarshaVS 1c9a82e
Merge branch 'feature/agentics_bundle_2' of https://github.com/langfl…
HimavarshaVS 964ae14
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
HimavarshaVS 446b53c
fix: add safe imports to Agentics components with clear error when ag…
HimavarshaVS 7ba9eee
[autofix.ci] apply automated fixes
autofix-ci[bot] 8b42de8
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 1af635f
fix: add try/except in agentics tests to skip when agentics-py/crewai…
HimavarshaVS 9e9232e
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
HimavarshaVS 80f7cca
fix: add agentics and crewai to optional deps skip list in test_all_m…
HimavarshaVS 140f29e
chore: update component_index.json
HimavarshaVS aa89f0a
Merge origin/main into feature/agentics_bundle_2, resolve component_i…
HimavarshaVS 7e99bc8
docs-cleanup
mendonk f048f03
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
mendonk e27f15b
Revert "Merge branch 'feature/agentics_bundle_2' of https://github.co…
mendonk 3251156
[autofix.ci] apply automated fixes
autofix-ci[bot] 75cbfdf
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] dd7e0b0
fix: add agentics-py to optional deps skip list in test_all_modules_i…
HimavarshaVS 4807902
Merge origin/main into feature/agentics_bundle_2, resolve component_i…
HimavarshaVS 4de42d5
Update component_index.json for agentics bundle
HimavarshaVS 02c958d
[autofix.ci] apply automated fixes
autofix-ci[bot] ad0dd5a
Merge origin/main into feature/agentics_bundle_2, resolve component_i…
HimavarshaVS 437cf84
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS 37f8d6c
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS 8c73d35
[autofix.ci] apply automated fixes
autofix-ci[bot] dfadec5
Merge remote-tracking branch 'origin' into feature/agentics_bundle_2
HimavarshaVS 808a1a0
Merge branch 'main' into feature/agentics_bundle_2
Cristhianzl 30caee3
merge fix
Cristhianzl 84ddd76
[autofix.ci] apply automated fixes
autofix-ci[bot] a30d4db
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS e204bff
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS 1f6603a
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS c9e086d
fix: enhance file upload tests with multiple text inputs and improved…
viktoravelino 1c7a215
Merge remote-tracking branch 'origin/main' into feature/agentics_bund…
HimavarshaVS 5c41883
update component index
HimavarshaVS a9a76db
Merge branch 'main' into feature/agentics_bundle_2
HimavarshaVS a6f59d1
[autofix.ci] apply automated fixes
autofix-ci[bot] 87f9014
Merge branch 'feature/agentics_bundle_2' of https://github.com/langfl…
HimavarshaVS 0a796fc
Merge branch 'feature/agentics_bundle_2' of https://github.com/gliozz…
HimavarshaVS 29cc0c5
update component index
HimavarshaVS 072c3c8
Merge remote-tracking branch 'origin/main' into feature/agentics_bund…
HimavarshaVS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| const SvgAgentQL = (props) => ( | ||
| <svg | ||
| width="512" | ||
| height="512" | ||
| viewBox="0 0 512 512" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| {...props} | ||
| > | ||
| <path | ||
| fillRule="evenodd" | ||
| clipRule="evenodd" | ||
| d="M302.444 370.307L345.993 413.721C349.037 416.757 353.974 416.757 357.018 413.721L509.717 261.495C512.762 258.46 512.762 253.539 509.717 250.503L357.018 98.2764C353.974 95.2413 349.037 95.2411 345.993 98.2764L302.444 141.691C299.4 144.726 299.4 149.647 302.444 152.683L400.568 250.503C403.612 253.539 403.612 258.46 400.568 261.495L302.444 359.316C299.4 362.351 299.4 367.272 302.444 370.307ZM209.557 152.684C212.602 149.649 212.602 144.728 209.557 141.692L166.008 98.2779C162.963 95.2426 158.028 95.2426 154.983 98.2779L2.28423 250.504C-0.760459 253.539 -0.760459 258.46 2.28423 261.497L154.983 413.723C158.028 416.759 162.963 416.759 166.008 413.723L209.557 370.309C212.602 367.274 212.602 362.352 209.557 359.318L111.434 261.497C108.389 258.46 108.389 253.539 111.434 250.504L209.557 152.684Z" | ||
| fill="url(#paint0_linear_78_78)" | ||
| /> | ||
| <path | ||
| fillRule="evenodd" | ||
| clipRule="evenodd" | ||
| d="M302.444 370.307L345.993 413.721C349.037 416.757 353.974 416.757 357.018 413.721L509.717 261.495C512.762 258.46 512.762 253.539 509.717 250.503L357.018 98.2764C353.974 95.2413 349.037 95.2411 345.993 98.2764L302.444 141.691C299.4 144.726 299.4 149.647 302.444 152.683L400.568 250.503C403.612 253.539 403.612 258.46 400.568 261.495L302.444 359.316C299.4 362.351 299.4 367.272 302.444 370.307ZM209.557 152.684C212.602 149.649 212.602 144.728 209.557 141.692L166.008 98.2779C162.963 95.2426 158.028 95.2426 154.983 98.2779L2.28423 250.504C-0.760459 253.539 -0.760459 258.46 2.28423 261.497L154.983 413.723C158.028 416.759 162.963 416.759 166.008 413.723L209.557 370.309C212.602 367.274 212.602 362.352 209.557 359.318L111.434 261.497C108.389 258.46 108.389 253.539 111.434 250.504L209.557 152.684Z" | ||
| fill="url(#paint1_radial_78_78)" | ||
| /> | ||
| <defs> | ||
| <linearGradient | ||
| id="paint0_linear_78_78" | ||
| x1="547.556" | ||
| y1="28.4446" | ||
| x2="139.854" | ||
| y2="436.149" | ||
| gradientUnits="userSpaceOnUse" | ||
| > | ||
| <stop offset="0.341457" stopColor="#4B52F6" /> | ||
| <stop offset="1" stopColor="#37B6B6" /> | ||
| </linearGradient> | ||
| <radialGradient | ||
| id="paint1_radial_78_78" | ||
| cx="0" | ||
| cy="0" | ||
| r="1" | ||
| gradientUnits="userSpaceOnUse" | ||
| gradientTransform="translate(239.5 131) rotate(89.3969) scale(285.016 300.945)" | ||
| > | ||
| <stop offset="0.642769" stopColor="#0B30B2" /> | ||
| <stop offset="0.705" stopColor="#0B30B2" stopOpacity="0" /> | ||
| </radialGradient> | ||
| </defs> | ||
| </svg> | ||
| ); | ||
| export default SvgAgentQL; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import type React from "react"; | ||
| import { forwardRef } from "react"; | ||
| import SvgAgentQL from "./AgentQL"; | ||
|
|
||
| export const AgentQLIcon = forwardRef< | ||
| SVGSVGElement, | ||
| React.PropsWithChildren<{}> | ||
| >((props, ref) => { | ||
| return <SvgAgentQL ref={ref} {...props} />; | ||
| }); | ||
|
Cristhianzl marked this conversation as resolved.
Outdated
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from .agentics import AgenticsComponent | ||
|
|
||
| __all__ = ["AgenticsComponent"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,261 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
| import toml # type: ignore[import-untyped] | ||
| from agentics import AG | ||
| from agentics.core.atype import create_pydantic_model | ||
| from agentics.core.transducible_functions import generate_prototypical_instances | ||
| from crewai import LLM | ||
|
Cristhianzl marked this conversation as resolved.
Outdated
|
||
|
|
||
| from lfx.base.models.unified_models import ( | ||
| get_language_model_options, | ||
| get_model_classes, | ||
| update_model_options_in_build_config, | ||
| ) | ||
| from lfx.custom.custom_component.component import Component | ||
| from lfx.io import ( | ||
| BoolInput, | ||
| DataFrameInput, | ||
| DropdownInput, | ||
| IntInput, | ||
| MessageTextInput, | ||
| ModelInput, | ||
| Output, | ||
| SecretStrInput, | ||
| TableInput, | ||
| ) | ||
| from lfx.schema.dataframe import DataFrame | ||
| from lfx.schema.table import EditMode | ||
|
|
||
|
|
||
| class AgenticsComponent(Component): | ||
| display_name = "Agentics" | ||
| description = "Enables Map Reduce Style Agentic data transformations amongs dataframes" | ||
|
Cristhianzl marked this conversation as resolved.
Outdated
|
||
| documentation: str = "github.com/IBM/agentics/" | ||
| icon = "Agentics" | ||
|
|
||
| inputs = [ | ||
| ModelInput( | ||
| name="model", | ||
| display_name="Language Model", | ||
| info="Select your model provider", | ||
| real_time_refresh=True, | ||
| required=True, | ||
| ), | ||
| SecretStrInput( | ||
| name="api_key", | ||
| display_name="API Key", | ||
| info="Model Provider API key", | ||
| real_time_refresh=True, | ||
| advanced=True, | ||
| ), | ||
| SecretStrInput( | ||
| name="project_id", | ||
| display_name="Project ID", | ||
| info="Required Only for WatsonX", | ||
| real_time_refresh=True, | ||
| advanced=True, | ||
| ), | ||
| DataFrameInput( | ||
| name="source", | ||
| display_name="Source DataFrame", | ||
| info="Accepts JSON (list of dicts) or DataFrame.", | ||
| ), | ||
| DropdownInput( | ||
| name="transduction_type", | ||
| display_name="transduction_type", | ||
| options=["amap", "areduce", "generate"], | ||
| value="amap", | ||
| required=True, | ||
| ), | ||
| MessageTextInput( | ||
| name="atype_name", | ||
| display_name="Generated Type", | ||
| info="Provide a name for the generated target type", | ||
| value="", | ||
| required=True, | ||
| # advanced=True, | ||
| ), | ||
| TableInput( | ||
| name="schema", | ||
| display_name="Generated Fields", | ||
| info="Define the structure and data types for the model's output.", | ||
| required=True, | ||
| # TODO: remove deault value | ||
| table_schema=[ | ||
| { | ||
| "name": "name", | ||
| "display_name": "Name", | ||
| "type": "str", | ||
| "description": "Specify the name of the output field.", | ||
| "default": "text", | ||
| "edit_mode": EditMode.INLINE, | ||
| }, | ||
| { | ||
| "name": "description", | ||
| "display_name": "Description", | ||
| "type": "str", | ||
| "description": "Describe the purpose of the output field.", | ||
| "default": "", | ||
| "edit_mode": EditMode.POPOVER, | ||
| }, | ||
| { | ||
| "name": "type", | ||
| "display_name": "Type", | ||
| "type": "str", | ||
| "edit_mode": EditMode.INLINE, | ||
| "description": ("Indicate the data type of the output field (e.g., str, int, float, bool, dict)."), | ||
| "options": ["str", "int", "float", "bool", "dict"], | ||
| "default": "str", | ||
| }, | ||
| { | ||
| "name": "multiple", | ||
| "display_name": "As List", | ||
| "type": "boolean", | ||
| "description": "Set to True if this output field should be a list of the specified type.", | ||
| "default": False, | ||
| "edit_mode": EditMode.INLINE, | ||
| }, | ||
| ], | ||
| value=[ | ||
| { | ||
| "name": "text", | ||
| "description": "", | ||
| "type": "str", | ||
| "multiple": False, | ||
| } | ||
| ], | ||
| ), | ||
| MessageTextInput( | ||
| name="instructions", | ||
| display_name="instructions", | ||
| value="", | ||
| ), | ||
| BoolInput(name="merge_source", display_name="merge_source_states", value=True, advanced=True), | ||
| IntInput(name="batch_size", display_name="Batch Size", value=10, advanced=True), | ||
| ] | ||
|
|
||
| outputs = [ | ||
| Output(name="states", display_name="Target DataFrame", method="transduce", tool_mode=True), | ||
| ] | ||
|
|
||
| def update_build_config(self, build_config: dict, field_value: str, field_name: str | None = None): | ||
| """Dynamically update build config with user-filtered model options.""" | ||
| return update_model_options_in_build_config( | ||
| component=self, | ||
| build_config=build_config, | ||
| cache_key_prefix="language_model_options", | ||
| get_options_func=get_language_model_options, | ||
| field_name=field_name, | ||
| field_value=field_value, | ||
| ) | ||
|
|
||
| def _format_row_as_toml(self, row: dict[str, Any]) -> str: | ||
| """Convert a dictionary (row) into a TOML-formatted string.""" | ||
| formatted_dict = {str(col): {"value": str(val)} for col, val in row.items()} | ||
| return toml.dumps(formatted_dict) | ||
|
|
||
| def _create_base_row( | ||
| self, original_row: dict[str, Any], model_response: str = "", batch_index: int = -1 | ||
| ) -> dict[str, Any]: | ||
| """Create a base row with original columns and additional metadata.""" | ||
| row = original_row.copy() | ||
| row[self.output_column_name] = model_response | ||
| row["batch_index"] = batch_index | ||
| return row | ||
|
|
||
| def _add_metadata( | ||
| self, row: dict[str, Any], *, success: bool = True, system_msg: str = "", error: str | None = None | ||
| ) -> None: | ||
| """Add metadata to a row if enabled.""" | ||
| if not self.enable_metadata: | ||
| return | ||
|
|
||
| if success: | ||
| row["metadata"] = { | ||
| "has_system_message": bool(system_msg), | ||
| "input_length": len(row.get("text_input", "")), | ||
| "response_length": len(row[self.output_column_name]), | ||
| "processing_status": "success", | ||
| } | ||
| else: | ||
| row["metadata"] = { | ||
| "error": error, | ||
| "processing_status": "failed", | ||
| } | ||
|
|
||
| async def transduce(self) -> DataFrame: | ||
| """Process each row in df[column_name] with the language model asynchronously.""" | ||
| # Check if model is already an instance (for testing) or needs to be instantiated | ||
| llm = None | ||
|
|
||
| # Extract model configuration | ||
| model_selection = self.model[0] | ||
|
Cristhianzl marked this conversation as resolved.
Outdated
|
||
| model_name = model_selection.get("name") | ||
| provider = model_selection.get("provider") | ||
| metadata = model_selection.get("metadata", {}) | ||
|
|
||
| # Get model class and parameters from metadata | ||
| model_class = get_model_classes().get(metadata.get("model_class")) | ||
| if model_class is None: | ||
| msg = f"No model class defined for {model_name}" | ||
| raise ValueError(msg) | ||
|
|
||
| # Get API key from global variables | ||
| from lfx.base.models.unified_models import get_api_key_for_provider | ||
|
|
||
| api_key = get_api_key_for_provider(self.user_id, provider, self.api_key) | ||
|
|
||
| if not api_key and provider != "Ollama": | ||
| msg = f"{provider} API key is required. Please configure it globally." | ||
| raise ValueError(msg) | ||
|
|
||
| if provider == "IBM WatsonX": | ||
| llm = LLM( | ||
| model="watsonx/" + model_name, | ||
| base_url="https://us-south.ml.cloud.ibm.com", | ||
| project_id=self.project_id, | ||
| api_key=api_key, | ||
| temperature=0, | ||
| max_tokens=4000, | ||
| max_input_tokens=100000, | ||
| ) | ||
|
|
||
| elif provider == "Google Generative AI": | ||
| llm = LLM(model="gemini/" + model_name, api_key=api_key) | ||
|
|
||
| elif provider == "OpenAI": | ||
| llm = LLM(model="openai/" + model_name, api_key=api_key) | ||
|
|
||
| else: | ||
| return "Please fix model paramters" | ||
|
Cristhianzl marked this conversation as resolved.
Outdated
|
||
|
|
||
| source = AG.from_dataframe(DataFrame(self.source)) | ||
| schema_fields = [ | ||
| ( | ||
| field["name"], | ||
| field["description"], | ||
| field["type"] if not field["multiple"] else f"list[{field['type']}]", | ||
| False, | ||
| ) | ||
| for field in self.schema | ||
| ] | ||
| atype = create_pydantic_model(schema_fields, name=self.atype_name) | ||
| if self.transduction_type == "generate": | ||
| output_states = await generate_prototypical_instances(atype, n_instances=self.batch_size, llm=llm) | ||
| output = AG(states=output_states) | ||
| else: | ||
| target = AG( | ||
| atype=atype, | ||
| instructions=self.instructions, | ||
| transduction_type=self.transduction_type, | ||
| amap_batch_size=self.batch_size, | ||
| llm=llm, | ||
| ) | ||
| output = await (target << source) | ||
| if self.merge_source and self.transduction_type == "amap": | ||
| output = source.merge_states(output) | ||
|
|
||
| df = output.to_dataframe() | ||
| return df.to_dict(orient="records") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.