lfx-nightly 0.1.12.dev40__py3-none-any.whl → 0.1.12.dev41__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 lfx-nightly might be problematic. Click here for more details.

@@ -0,0 +1,38 @@
1
+ from langchain_google_genai import ChatGoogleGenerativeAI
2
+
3
+
4
+ class ChatGoogleGenerativeAIFixed(ChatGoogleGenerativeAI):
5
+ """Custom ChatGoogleGenerativeAI that fixes function response name issues for Gemini."""
6
+
7
+ def __init__(self, *args, **kwargs):
8
+ """Initialize with fix for empty function response names in ToolMessage and FunctionMessage."""
9
+ if ChatGoogleGenerativeAI is None:
10
+ msg = "The 'langchain_google_genai' package is required to use the Google Generative AI model."
11
+ raise ImportError(msg)
12
+
13
+ # Initialize the parent class
14
+ super().__init__(*args, **kwargs)
15
+
16
+ def _prepare_request(self, messages, **kwargs):
17
+ """Override request preparation to fix empty function response names."""
18
+ from langchain_core.messages import FunctionMessage, ToolMessage
19
+
20
+ # Pre-process messages to ensure tool/function messages have names
21
+ fixed_messages = []
22
+ for message in messages:
23
+ fixed_message = message
24
+ if isinstance(message, ToolMessage) and not message.name:
25
+ # Create a new ToolMessage with a default name
26
+ fixed_message = ToolMessage(
27
+ content=message.content,
28
+ name="tool_response",
29
+ tool_call_id=getattr(message, "tool_call_id", None),
30
+ artifact=getattr(message, "artifact", None),
31
+ )
32
+ elif isinstance(message, FunctionMessage) and not message.name:
33
+ # Create a new FunctionMessage with a default name
34
+ fixed_message = FunctionMessage(content=message.content, name="function_response")
35
+ fixed_messages.append(fixed_message)
36
+
37
+ # Call the parent's method with fixed messages
38
+ return super()._prepare_request(fixed_messages, **kwargs)
@@ -6,14 +6,16 @@ from lfx.components._importing import import_mod
6
6
 
7
7
  if TYPE_CHECKING:
8
8
  from lfx.components.agents.agent import AgentComponent
9
+ from lfx.components.agents.cuga_agent import CugaComponent
9
10
  from lfx.components.agents.mcp_component import MCPToolsComponent
10
11
 
11
12
  _dynamic_imports = {
12
13
  "AgentComponent": "agent",
14
+ "CugaComponent": "cuga_agent",
13
15
  "MCPToolsComponent": "mcp_component",
14
16
  }
15
17
 
16
- __all__ = ["AgentComponent", "MCPToolsComponent"]
18
+ __all__ = ["AgentComponent", "CugaComponent", "MCPToolsComponent"]
17
19
 
18
20
 
19
21
  def __getattr__(attr_name: str) -> Any: