gemini-agent-framework 0.1.12__py3-none-any.whl → 0.1.14__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 +31 -25
- {gemini_agent_framework-0.1.12.dist-info → gemini_agent_framework-0.1.14.dist-info}/METADATA +4 -4
- gemini_agent_framework-0.1.14.dist-info/RECORD +6 -0
- gemini_agent_framework-0.1.12.dist-info/RECORD +0 -6
- {gemini_agent_framework-0.1.12.dist-info → gemini_agent_framework-0.1.14.dist-info}/WHEEL +0 -0
- {gemini_agent_framework-0.1.12.dist-info → gemini_agent_framework-0.1.14.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,14 +240,7 @@ class Agent:
|
|
237
240
|
]
|
238
241
|
)
|
239
242
|
|
240
|
-
return """
|
241
|
-
When faced with a complex request:
|
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
|
243
|
+
return """
|
248
244
|
|
249
245
|
Available tools:
|
250
246
|
{tools_list}
|
@@ -281,11 +277,26 @@ class Agent:
|
|
281
277
|
"""Substitutes variable references in arguments with their actual values."""
|
282
278
|
result = {}
|
283
279
|
for key, value in args.items():
|
280
|
+
print("substituting variables", key, value)
|
284
281
|
if isinstance(value, str) and value.startswith("$"):
|
282
|
+
print("is string and starts with $")
|
283
|
+
# Handle $ prefixed variables
|
285
284
|
var_name = value[1:]
|
286
285
|
if var_name in self._stored_variables:
|
286
|
+
print("substituted")
|
287
|
+
|
288
|
+
result[key] = self._stored_variables[var_name]["value"]
|
289
|
+
else:
|
290
|
+
result[key] = value
|
291
|
+
elif isinstance(value, dict) and "variable" in value:
|
292
|
+
print("is dict and has variable")
|
293
|
+
# Handle dictionary-style variable references
|
294
|
+
var_name = value["variable"]
|
295
|
+
if var_name in self._stored_variables:
|
296
|
+
print("substituted")
|
287
297
|
result[key] = self._stored_variables[var_name]["value"]
|
288
298
|
else:
|
299
|
+
print("substituted")
|
289
300
|
result[key] = value
|
290
301
|
else:
|
291
302
|
result[key] = value
|
@@ -328,21 +339,17 @@ class Agent:
|
|
328
339
|
system_prompt = self._get_system_prompt() + system_prompt
|
329
340
|
|
330
341
|
current_contents = conversation_history if conversation_history else []
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
}
|
340
|
-
],
|
341
|
-
}
|
342
|
-
)
|
342
|
+
|
343
|
+
# Add system instruction to payload
|
344
|
+
payload: Dict[str, Any] = {
|
345
|
+
"system_instruction": {
|
346
|
+
"parts": [{"text": system_prompt}]
|
347
|
+
},
|
348
|
+
"contents": current_contents
|
349
|
+
}
|
343
350
|
|
344
|
-
|
345
|
-
payload:
|
351
|
+
# Add user prompt to contents
|
352
|
+
payload["contents"].append({"role": "user", "parts": [{"text": user_prompt}]})
|
346
353
|
|
347
354
|
if self._registered_tools_json:
|
348
355
|
payload["tools"] = [{"functionDeclarations": self._registered_tools_json}]
|
@@ -366,9 +373,9 @@ class Agent:
|
|
366
373
|
}
|
367
374
|
final_mime_type = "application/json"
|
368
375
|
final_response_schema = response_structure
|
369
|
-
|
376
|
+
|
370
377
|
while True:
|
371
|
-
|
378
|
+
|
372
379
|
response_data = self._call_gemini_api(payload)
|
373
380
|
if "error" in response_data:
|
374
381
|
print(
|
@@ -577,7 +584,6 @@ class Agent:
|
|
577
584
|
)
|
578
585
|
return final_text
|
579
586
|
return final_text
|
580
|
-
|
581
587
|
continue
|
582
588
|
|
583
589
|
except (KeyError, IndexError) as e:
|
{gemini_agent_framework-0.1.12.dist-info → gemini_agent_framework-0.1.14.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.14
|
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>
|
@@ -118,11 +118,11 @@ response = agent.prompt(
|
|
118
118
|
|
119
119
|
## Documentation
|
120
120
|
|
121
|
-
For detailed documentation, please visit our [documentation site](https://github.com/m7mdony/gemini-agent-framework
|
121
|
+
For detailed documentation, please visit our [documentation site](https://github.com/m7mdony/gemini-agent-framework).
|
122
122
|
|
123
123
|
### Key Topics
|
124
124
|
|
125
|
-
- [API Reference](https://m7mdony.github.io/gemini-agent-framework/
|
125
|
+
- [API Reference](https://m7mdony.github.io/gemini-agent-framework/api_reference/)
|
126
126
|
- [Tutorials](https://m7mdony.github.io/gemini-agent-framework/tutorials/)
|
127
127
|
- [Best Practices](https://m7mdony.github.io/gemini-agent-framework/best_practices/)
|
128
128
|
- [Architecture Overview](https://m7mdony.github.io/gemini-agent-framework/architecture/)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
gemini_agent/__init__.py,sha256=d3zKiVgPCRUKMEBijW61Gl_QsYm3NV4y-6vH1-qEjm8,69
|
2
|
+
gemini_agent/agent.py,sha256=jev8FSYBTznW9OUfMAqAbddzl5EqG_GWQ8-QVqulCSY,26700
|
3
|
+
gemini_agent_framework-0.1.14.dist-info/METADATA,sha256=VSPLaq039Q3Cirt56L2m9aomyx9zO8hpBbtqApa50wQ,5033
|
4
|
+
gemini_agent_framework-0.1.14.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
gemini_agent_framework-0.1.14.dist-info/licenses/LICENSE,sha256=NHp9eKeWbB-Fp6Ff24BXSemJOa6UEZa9IAp9U7O9oBM,1073
|
6
|
+
gemini_agent_framework-0.1.14.dist-info/RECORD,,
|
@@ -1,6 +0,0 @@
|
|
1
|
-
gemini_agent/__init__.py,sha256=huzUkDtkZ8p2huUAyUUvGsVkxicgsmFaODAG8CiwMmQ,69
|
2
|
-
gemini_agent/agent.py,sha256=eY9Vjbew4N1dbY31oK37UVRb4a9w-StUUjCuAYCF8N8,26740
|
3
|
-
gemini_agent_framework-0.1.12.dist-info/METADATA,sha256=q1jN4pSaNw-JB1mlVxHZmfdrasQkG5YktxDmCuKLvBU,5044
|
4
|
-
gemini_agent_framework-0.1.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
gemini_agent_framework-0.1.12.dist-info/licenses/LICENSE,sha256=NHp9eKeWbB-Fp6Ff24BXSemJOa6UEZa9IAp9U7O9oBM,1073
|
6
|
-
gemini_agent_framework-0.1.12.dist-info/RECORD,,
|
File without changes
|
{gemini_agent_framework-0.1.12.dist-info → gemini_agent_framework-0.1.14.dist-info}/licenses/LICENSE
RENAMED
File without changes
|