praisonaiagents 0.0.132__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/telemetry/telemetry.py +56 -2
- {praisonaiagents-0.0.132.dist-info → praisonaiagents-0.0.134.dist-info}/METADATA +1 -1
- {praisonaiagents-0.0.132.dist-info → praisonaiagents-0.0.134.dist-info}/RECORD +8 -8
- {praisonaiagents-0.0.132.dist-info → praisonaiagents-0.0.134.dist-info}/WHEEL +0 -0
- {praisonaiagents-0.0.132.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
|
|
@@ -116,8 +116,17 @@ class MinimalTelemetry:
|
|
116
116
|
|
117
117
|
self._metrics["agent_executions"] += 1
|
118
118
|
|
119
|
-
#
|
120
|
-
|
119
|
+
# Send event to PostHog
|
120
|
+
if self._posthog:
|
121
|
+
self._posthog.capture(
|
122
|
+
distinct_id=self.session_id,
|
123
|
+
event='agent_execution',
|
124
|
+
properties={
|
125
|
+
'success': success,
|
126
|
+
'session_id': self.session_id
|
127
|
+
}
|
128
|
+
)
|
129
|
+
|
121
130
|
self.logger.debug(f"Agent execution tracked: success={success}")
|
122
131
|
|
123
132
|
def track_task_completion(self, task_name: str = None, success: bool = True):
|
@@ -133,6 +142,17 @@ class MinimalTelemetry:
|
|
133
142
|
|
134
143
|
self._metrics["task_completions"] += 1
|
135
144
|
|
145
|
+
# Send event to PostHog
|
146
|
+
if self._posthog:
|
147
|
+
self._posthog.capture(
|
148
|
+
distinct_id=self.session_id,
|
149
|
+
event='task_completion',
|
150
|
+
properties={
|
151
|
+
'success': success,
|
152
|
+
'session_id': self.session_id
|
153
|
+
}
|
154
|
+
)
|
155
|
+
|
136
156
|
self.logger.debug(f"Task completion tracked: success={success}")
|
137
157
|
|
138
158
|
def track_tool_usage(self, tool_name: str, success: bool = True):
|
@@ -148,6 +168,18 @@ class MinimalTelemetry:
|
|
148
168
|
|
149
169
|
self._metrics["tool_calls"] += 1
|
150
170
|
|
171
|
+
# Send event to PostHog
|
172
|
+
if self._posthog:
|
173
|
+
self._posthog.capture(
|
174
|
+
distinct_id=self.session_id,
|
175
|
+
event='tool_usage',
|
176
|
+
properties={
|
177
|
+
'tool_name': tool_name,
|
178
|
+
'success': success,
|
179
|
+
'session_id': self.session_id
|
180
|
+
}
|
181
|
+
)
|
182
|
+
|
151
183
|
# Only track tool name, not arguments or results
|
152
184
|
self.logger.debug(f"Tool usage tracked: {tool_name}, success={success}")
|
153
185
|
|
@@ -163,6 +195,17 @@ class MinimalTelemetry:
|
|
163
195
|
|
164
196
|
self._metrics["errors"] += 1
|
165
197
|
|
198
|
+
# Send event to PostHog
|
199
|
+
if self._posthog:
|
200
|
+
self._posthog.capture(
|
201
|
+
distinct_id=self.session_id,
|
202
|
+
event='error',
|
203
|
+
properties={
|
204
|
+
'error_type': error_type or 'unknown',
|
205
|
+
'session_id': self.session_id
|
206
|
+
}
|
207
|
+
)
|
208
|
+
|
166
209
|
# Only track error type, not full error messages
|
167
210
|
self.logger.debug(f"Error tracked: type={error_type or 'unknown'}")
|
168
211
|
|
@@ -176,6 +219,17 @@ class MinimalTelemetry:
|
|
176
219
|
if not self.enabled:
|
177
220
|
return
|
178
221
|
|
222
|
+
# Send event to PostHog
|
223
|
+
if self._posthog:
|
224
|
+
self._posthog.capture(
|
225
|
+
distinct_id=self.session_id,
|
226
|
+
event='feature_usage',
|
227
|
+
properties={
|
228
|
+
'feature_name': feature_name,
|
229
|
+
'session_id': self.session_id
|
230
|
+
}
|
231
|
+
)
|
232
|
+
|
179
233
|
# Track which features are being used
|
180
234
|
self.logger.debug(f"Feature usage tracked: {feature_name}")
|
181
235
|
|
@@ -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
|
@@ -33,7 +33,7 @@ praisonaiagents/task/__init__.py,sha256=VL5hXVmyGjINb34AalxpBMl-YW9m5EDcRkMTKkSS
|
|
33
33
|
praisonaiagents/task/task.py,sha256=-EXxw3czWZdAK1WWI6Dvga5CujsItgk9RWYD_CdW47w,24075
|
34
34
|
praisonaiagents/telemetry/__init__.py,sha256=5iAOrj_N_cKMmh2ltWGYs3PfOYt_jcwUoElW8fTAIsc,3062
|
35
35
|
praisonaiagents/telemetry/integration.py,sha256=8h8TDlPFTbsBmU5rIYNOibJbwEEEWmzS1ENE9uPTvvg,8696
|
36
|
-
praisonaiagents/telemetry/telemetry.py,sha256=
|
36
|
+
praisonaiagents/telemetry/telemetry.py,sha256=w15OMQwL2rGQG7CIpwABmVFsAQKSAVmi9BYbmR3BdDQ,13459
|
37
37
|
praisonaiagents/tools/README.md,sha256=am9mlHp46sC1U9HfyXtX-E_cckxpazprl4tuVFYHP_0,4905
|
38
38
|
praisonaiagents/tools/__init__.py,sha256=9NYh9anzJZlaLtrRINdM1uD6JfNSuOzZAFMaarO6yAU,9321
|
39
39
|
praisonaiagents/tools/arxiv_tools.py,sha256=1stb31zTjLTon4jCnpZG5de9rKc9QWgC0leLegvPXWo,10528
|
@@ -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
|