praisonaiagents 0.0.133__py3-none-any.whl → 0.0.134__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.
- praisonaiagents/llm/llm.py +7 -0
- praisonaiagents/llm/model_capabilities.py +24 -1
- praisonaiagents/llm/openai_client.py +7 -0
- {praisonaiagents-0.0.133.dist-info → praisonaiagents-0.0.134.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.133.dist-info → praisonaiagents-0.0.134.dist-info}/RECORD +7 -7
- {praisonaiagents-0.0.133.dist-info → praisonaiagents-0.0.134.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.133.dist-info → praisonaiagents-0.0.134.dist-info}/top_level.txt +0 -0
praisonaiagents/llm/llm.py
CHANGED
@@ -16,6 +16,7 @@ from ..main import (
|
|
16
16
|
ReflectionOutput,
|
17
17
|
execute_sync_callback,
|
18
18
|
)
|
19
|
+
from .model_capabilities import is_gemini_internal_tool
|
19
20
|
from rich.console import Console
|
20
21
|
from rich.live import Live
|
21
22
|
|
@@ -542,6 +543,7 @@ class LLM:
|
|
542
543
|
- Lists of pre-formatted tools
|
543
544
|
- Callable functions
|
544
545
|
- String function names
|
546
|
+
- Gemini internal tools ({"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}})
|
545
547
|
|
546
548
|
Args:
|
547
549
|
tools: List of tools in various formats
|
@@ -588,6 +590,11 @@ class LLM:
|
|
588
590
|
tool_def = self._generate_tool_definition(tool)
|
589
591
|
if tool_def:
|
590
592
|
formatted_tools.append(tool_def)
|
593
|
+
# Handle Gemini internal tools (e.g., {"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}})
|
594
|
+
elif is_gemini_internal_tool(tool):
|
595
|
+
tool_name = next(iter(tool.keys()))
|
596
|
+
logging.debug(f"Using Gemini internal tool: {tool_name}")
|
597
|
+
formatted_tools.append(tool)
|
591
598
|
else:
|
592
599
|
logging.debug(f"Skipping tool of unsupported type: {type(tool)}")
|
593
600
|
|
@@ -104,4 +104,27 @@ def supports_streaming_with_tools(model_name: str) -> bool:
|
|
104
104
|
"""
|
105
105
|
# For now, use the same logic as structured outputs
|
106
106
|
# In the future, this could be a separate list if needed
|
107
|
-
return supports_structured_outputs(model_name)
|
107
|
+
return supports_structured_outputs(model_name)
|
108
|
+
|
109
|
+
|
110
|
+
# Supported Gemini internal tools
|
111
|
+
GEMINI_INTERNAL_TOOLS = {'googleSearch', 'urlContext', 'codeExecution'}
|
112
|
+
|
113
|
+
|
114
|
+
def is_gemini_internal_tool(tool) -> bool:
|
115
|
+
"""
|
116
|
+
Check if a tool is a Gemini internal tool and should be included in formatted tools.
|
117
|
+
|
118
|
+
Gemini internal tools are single-key dictionaries with specific tool names.
|
119
|
+
Examples: {"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}}
|
120
|
+
|
121
|
+
Args:
|
122
|
+
tool: The tool to check
|
123
|
+
|
124
|
+
Returns:
|
125
|
+
bool: True if the tool is a recognized Gemini internal tool, False otherwise
|
126
|
+
"""
|
127
|
+
if isinstance(tool, dict) and len(tool) == 1:
|
128
|
+
tool_name = next(iter(tool.keys()))
|
129
|
+
return tool_name in GEMINI_INTERNAL_TOOLS
|
130
|
+
return False
|
@@ -18,6 +18,7 @@ from dataclasses import dataclass
|
|
18
18
|
from rich.console import Console
|
19
19
|
from rich.live import Live
|
20
20
|
import inspect
|
21
|
+
from .model_capabilities import is_gemini_internal_tool
|
21
22
|
|
22
23
|
# Constants
|
23
24
|
LOCAL_SERVER_API_KEY_PLACEHOLDER = "not-needed"
|
@@ -360,6 +361,7 @@ class OpenAIClient:
|
|
360
361
|
- Callable functions
|
361
362
|
- String function names
|
362
363
|
- MCP tools
|
364
|
+
- Gemini internal tools ({"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}})
|
363
365
|
|
364
366
|
Args:
|
365
367
|
tools: List of tools in various formats
|
@@ -404,6 +406,11 @@ class OpenAIClient:
|
|
404
406
|
tool_def = self._generate_tool_definition_from_name(tool)
|
405
407
|
if tool_def:
|
406
408
|
formatted_tools.append(tool_def)
|
409
|
+
# Handle Gemini internal tools (e.g., {"googleSearch": {}}, {"urlContext": {}}, {"codeExecution": {}})
|
410
|
+
elif is_gemini_internal_tool(tool):
|
411
|
+
tool_name = next(iter(tool.keys()))
|
412
|
+
logging.debug(f"Using Gemini internal tool: {tool_name}")
|
413
|
+
formatted_tools.append(tool)
|
407
414
|
else:
|
408
415
|
logging.debug(f"Skipping tool of unsupported type: {type(tool)}")
|
409
416
|
|
@@ -17,10 +17,10 @@ praisonaiagents/knowledge/__init__.py,sha256=xL1Eh-a3xsHyIcU4foOWF-JdWYIYBALJH9b
|
|
17
17
|
praisonaiagents/knowledge/chunking.py,sha256=G6wyHa7_8V0_7VpnrrUXbEmUmptlT16ISJYaxmkSgmU,7678
|
18
18
|
praisonaiagents/knowledge/knowledge.py,sha256=-di_h9HxXQfAhTMMerhK16tfw8DtUndp44TGkBOzkZs,15539
|
19
19
|
praisonaiagents/llm/__init__.py,sha256=tHvWq5mv4K4MhWr0s6rqox8UnJ5RK0kXhYuD40WkZQA,1747
|
20
|
-
praisonaiagents/llm/llm.py,sha256=
|
21
|
-
praisonaiagents/llm/model_capabilities.py,sha256=
|
20
|
+
praisonaiagents/llm/llm.py,sha256=4vA0tgLS8s1OIl6-vz7F4SjX6ktOXBEKSTL-iTrZsQg,122869
|
21
|
+
praisonaiagents/llm/model_capabilities.py,sha256=cxOvZcjZ_PIEpUYKn3S2FMyypfOSfbGpx4vmV7Y5vhI,3967
|
22
22
|
praisonaiagents/llm/model_router.py,sha256=Jy2pShlkLxqXF3quz-MRB3-6L9vaUSgUrf2YJs_Tsg0,13995
|
23
|
-
praisonaiagents/llm/openai_client.py,sha256=
|
23
|
+
praisonaiagents/llm/openai_client.py,sha256=Aor7LDME04KbcfexffAE41m5wiEyAVUk2B_f6y4J9qU,45844
|
24
24
|
praisonaiagents/mcp/__init__.py,sha256=ibbqe3_7XB7VrIcUcetkZiUZS1fTVvyMy_AqCSFG8qc,240
|
25
25
|
praisonaiagents/mcp/mcp.py,sha256=T0G0rQotHxk9qTnG1tjQLr4c0BUSLnEqz9sIMx4F954,21598
|
26
26
|
praisonaiagents/mcp/mcp_http_stream.py,sha256=Yh-69eIlLQS_M0bd__y7NzSjOqqX6R8Ed4eJQw6xXgg,18314
|
@@ -57,7 +57,7 @@ praisonaiagents/tools/xml_tools.py,sha256=iYTMBEk5l3L3ryQ1fkUnNVYK-Nnua2Kx2S0dxN
|
|
57
57
|
praisonaiagents/tools/yaml_tools.py,sha256=uogAZrhXV9O7xvspAtcTfpKSQYL2nlOTvCQXN94-G9A,14215
|
58
58
|
praisonaiagents/tools/yfinance_tools.py,sha256=s2PBj_1v7oQnOobo2fDbQBACEHl61ftG4beG6Z979ZE,8529
|
59
59
|
praisonaiagents/tools/train/data/generatecot.py,sha256=H6bNh-E2hqL5MW6kX3hqZ05g9ETKN2-kudSjiuU_SD8,19403
|
60
|
-
praisonaiagents-0.0.
|
61
|
-
praisonaiagents-0.0.
|
62
|
-
praisonaiagents-0.0.
|
63
|
-
praisonaiagents-0.0.
|
60
|
+
praisonaiagents-0.0.134.dist-info/METADATA,sha256=3w4a7glxxdf-3BQSfw19U1voxOh9MEhoReO5c7KEAIQ,1699
|
61
|
+
praisonaiagents-0.0.134.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
62
|
+
praisonaiagents-0.0.134.dist-info/top_level.txt,sha256=_HsRddrJ23iDx5TTqVUVvXG2HeHBL5voshncAMDGjtA,16
|
63
|
+
praisonaiagents-0.0.134.dist-info/RECORD,,
|
File without changes
|
File without changes
|