gemini-agent-framework 0.1.13__tar.gz → 0.1.15__tar.gz

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.
Files changed (29) hide show
  1. gemini_agent_framework-0.1.15/.github/workflows/deploy-docs.yml +1 -0
  2. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/PKG-INFO +2 -2
  3. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/pyproject.toml +2 -2
  4. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/src/gemini_agent/__init__.py +1 -1
  5. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/src/gemini_agent/agent.py +33 -33
  6. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.flake8 +0 -0
  7. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.github/workflows/ci.yml +0 -0
  8. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.github/workflows/docs.yml +0 -0
  9. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.github/workflows/python-publish.yml +0 -0
  10. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.github/workflows/tests.yml +0 -0
  11. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/.gitignore +0 -0
  12. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/CHANGELOG.md +0 -0
  13. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/CODE_OF_CONDUCT.md +0 -0
  14. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/CONTRIBUTING.md +0 -0
  15. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/LICENSE +0 -0
  16. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/README.md +0 -0
  17. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/api_reference.md +0 -0
  18. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/architecture.md +0 -0
  19. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/best_practices.md +0 -0
  20. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/index.md +0 -0
  21. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/installation.md +0 -0
  22. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/docs/tutorials.md +0 -0
  23. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/mkdocs.yml +0 -0
  24. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/payload_variable_0.json +0 -0
  25. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/requirements.txt +0 -0
  26. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/tests/__init__.py +0 -0
  27. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/tests/test_agent.py +0 -0
  28. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/tests/test_class_methods.py +0 -0
  29. {gemini_agent_framework-0.1.13 → gemini_agent_framework-0.1.15}/tests/test_variables.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gemini-agent-framework
3
- Version: 0.1.13
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.com/m7mdony/gemini-agent-framework/wiki
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>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "gemini-agent-framework"
7
- version = "0.1.13"
7
+ version = "0.1.15"
8
8
  description = "A framework for building agents that use Gemini's function calling capabilities"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -30,7 +30,7 @@ dependencies = [
30
30
 
31
31
  [project.urls]
32
32
  Homepage = "https://github.com/m7mdony/gemini-agent-framework"
33
- Documentation = "https://github.com/m7mdony/gemini-agent-framework/wiki"
33
+ Documentation = "https://m7mdony.github.io/gemini-agent-framework"
34
34
  Repository = "https://github.com/m7mdony/gemini-agent-framework.git"
35
35
  Issues = "https://github.com/m7mdony/gemini-agent-framework/issues"
36
36
 
@@ -1,4 +1,4 @@
1
1
  from .agent import Agent
2
2
 
3
- __version__ = "0.1.13"
3
+ __version__ = "0.1.15"
4
4
  __all__ = ["Agent"]
@@ -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 """You are an AI assistant that can break down complex tasks into sequential steps using available tools.
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
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
- if not system_prompt:
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
- if system_prompt and not current_contents:
332
- current_contents.append({"role": "user", "parts": [{"text": system_prompt}]})
333
- current_contents.append(
334
- {
335
- "role": "model",
336
- "parts": [
337
- {
338
- "text": "I understand I should break down complex tasks into sequential steps using the available tools and variables."
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
- current_contents.append({"role": "user", "parts": [{"text": user_prompt}]})
345
- payload: Dict[str, Any] = {"contents": current_contents}
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: