gemini-agent-framework 0.1.13__py3-none-any.whl → 0.1.15__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.
- gemini_agent/__init__.py +1 -1
- gemini_agent/agent.py +33 -33
- {gemini_agent_framework-0.1.13.dist-info → gemini_agent_framework-0.1.15.dist-info}/METADATA +2 -2
- gemini_agent_framework-0.1.15.dist-info/RECORD +6 -0
- gemini_agent_framework-0.1.13.dist-info/RECORD +0 -6
- {gemini_agent_framework-0.1.13.dist-info → gemini_agent_framework-0.1.15.dist-info}/WHEEL +0 -0
- {gemini_agent_framework-0.1.13.dist-info → gemini_agent_framework-0.1.15.dist-info}/licenses/LICENSE +0 -0
gemini_agent/__init__.py
CHANGED
gemini_agent/agent.py
CHANGED
@@ -4,9 +4,12 @@ from datetime import datetime
|
|
4
4
|
from functools import wraps
|
5
5
|
from typing import Any, Callable, Dict, List, Optional, Type, Union, Collection
|
6
6
|
|
7
|
+
|
7
8
|
import requests
|
8
9
|
from dotenv import load_dotenv
|
9
10
|
|
11
|
+
|
12
|
+
|
10
13
|
load_dotenv()
|
11
14
|
|
12
15
|
|
@@ -237,18 +240,8 @@ class Agent:
|
|
237
240
|
]
|
238
241
|
)
|
239
242
|
|
240
|
-
return """
|
241
|
-
|
242
|
-
1. Analyze the request to identify which tools can be used
|
243
|
-
2. Break down the request into sequential steps
|
244
|
-
3. For each step:
|
245
|
-
- Use the most appropriate tool
|
246
|
-
- Store the result for use in subsequent steps
|
247
|
-
4. Combine the results to provide a final answer
|
248
|
-
|
249
|
-
Available tools:
|
250
|
-
{tools_list}
|
251
|
-
|
243
|
+
return """
|
244
|
+
|
252
245
|
Available variables:
|
253
246
|
{variables_list}
|
254
247
|
|
@@ -281,11 +274,26 @@ class Agent:
|
|
281
274
|
"""Substitutes variable references in arguments with their actual values."""
|
282
275
|
result = {}
|
283
276
|
for key, value in args.items():
|
277
|
+
print("substituting variables", key, value)
|
284
278
|
if isinstance(value, str) and value.startswith("$"):
|
279
|
+
print("is string and starts with $")
|
280
|
+
# Handle $ prefixed variables
|
285
281
|
var_name = value[1:]
|
286
282
|
if var_name in self._stored_variables:
|
283
|
+
print("substituted")
|
284
|
+
|
285
|
+
result[key] = self._stored_variables[var_name]["value"]
|
286
|
+
else:
|
287
|
+
result[key] = value
|
288
|
+
elif isinstance(value, dict) and "variable" in value:
|
289
|
+
print("is dict and has variable")
|
290
|
+
# Handle dictionary-style variable references
|
291
|
+
var_name = value["variable"]
|
292
|
+
if var_name in self._stored_variables:
|
293
|
+
print("substituted")
|
287
294
|
result[key] = self._stored_variables[var_name]["value"]
|
288
295
|
else:
|
296
|
+
print("substituted")
|
289
297
|
result[key] = value
|
290
298
|
else:
|
291
299
|
result[key] = value
|
@@ -322,27 +330,20 @@ class Agent:
|
|
322
330
|
"""
|
323
331
|
self._intermediate_results = {}
|
324
332
|
|
325
|
-
|
326
|
-
system_prompt = self._get_system_prompt()
|
327
|
-
else:
|
328
|
-
system_prompt = self._get_system_prompt() + system_prompt
|
333
|
+
|
329
334
|
|
330
335
|
current_contents = conversation_history if conversation_history else []
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
}
|
340
|
-
],
|
341
|
-
}
|
342
|
-
)
|
336
|
+
|
337
|
+
# Add system instruction to payload
|
338
|
+
payload: Dict[str, Any] = {
|
339
|
+
"system_instruction": {
|
340
|
+
"parts": [{"text": system_prompt if system_prompt else ""},{"text": self._get_system_prompt()}]
|
341
|
+
},
|
342
|
+
"contents": current_contents
|
343
|
+
}
|
343
344
|
|
344
|
-
|
345
|
-
payload:
|
345
|
+
# Add user prompt to contents
|
346
|
+
payload["contents"].append({"role": "user", "parts": [{"text": user_prompt}]})
|
346
347
|
|
347
348
|
if self._registered_tools_json:
|
348
349
|
payload["tools"] = [{"functionDeclarations": self._registered_tools_json}]
|
@@ -366,9 +367,9 @@ class Agent:
|
|
366
367
|
}
|
367
368
|
final_mime_type = "application/json"
|
368
369
|
final_response_schema = response_structure
|
369
|
-
|
370
|
+
|
370
371
|
while True:
|
371
|
-
|
372
|
+
|
372
373
|
response_data = self._call_gemini_api(payload)
|
373
374
|
if "error" in response_data:
|
374
375
|
print(
|
@@ -577,7 +578,6 @@ class Agent:
|
|
577
578
|
)
|
578
579
|
return final_text
|
579
580
|
return final_text
|
580
|
-
|
581
581
|
continue
|
582
582
|
|
583
583
|
except (KeyError, IndexError) as e:
|
{gemini_agent_framework-0.1.13.dist-info → gemini_agent_framework-0.1.15.dist-info}/METADATA
RENAMED
@@ -1,9 +1,9 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gemini-agent-framework
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.15
|
4
4
|
Summary: A framework for building agents that use Gemini's function calling capabilities
|
5
5
|
Project-URL: Homepage, https://github.com/m7mdony/gemini-agent-framework
|
6
|
-
Project-URL: Documentation, https://github.
|
6
|
+
Project-URL: Documentation, https://m7mdony.github.io/gemini-agent-framework
|
7
7
|
Project-URL: Repository, https://github.com/m7mdony/gemini-agent-framework.git
|
8
8
|
Project-URL: Issues, https://github.com/m7mdony/gemini-agent-framework/issues
|
9
9
|
Author-email: Mohamed Baathman <mohamed.baathman2001@gmail.com>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
gemini_agent/__init__.py,sha256=LFX-2Emo9kXG9rmleXchzu7GyCiwMpXLoxGETOEeKi8,69
|
2
|
+
gemini_agent/agent.py,sha256=gdtr6GDKZJxq6_rgbDxvdkZmMB75vUcMop1eBrQ1adY,26527
|
3
|
+
gemini_agent_framework-0.1.15.dist-info/METADATA,sha256=T9RiY-0KCOFbHkFazezxcD6-2NQdEwJPeirO_96OU64,5033
|
4
|
+
gemini_agent_framework-0.1.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
gemini_agent_framework-0.1.15.dist-info/licenses/LICENSE,sha256=NHp9eKeWbB-Fp6Ff24BXSemJOa6UEZa9IAp9U7O9oBM,1073
|
6
|
+
gemini_agent_framework-0.1.15.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
gemini_agent/__init__.py,sha256=VJDQ1Ve3Y3wf_xjRODOnr2gYm0bAg04sHA_i8HXGudc,69
|
2
|
-
gemini_agent/agent.py,sha256=eY9Vjbew4N1dbY31oK37UVRb4a9w-StUUjCuAYCF8N8,26740
|
3
|
-
gemini_agent_framework-0.1.13.dist-info/METADATA,sha256=Y_h_pZhD05QrRdYk2WrD0Xr2EeBjPun2JquhI8vIyCE,5039
|
4
|
-
gemini_agent_framework-0.1.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
gemini_agent_framework-0.1.13.dist-info/licenses/LICENSE,sha256=NHp9eKeWbB-Fp6Ff24BXSemJOa6UEZa9IAp9U7O9oBM,1073
|
6
|
-
gemini_agent_framework-0.1.13.dist-info/RECORD,,
|
File without changes
|
{gemini_agent_framework-0.1.13.dist-info → gemini_agent_framework-0.1.15.dist-info}/licenses/LICENSE
RENAMED
File without changes
|