gemini-agent-framework 0.2.2__tar.gz → 0.2.3__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.
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/PKG-INFO +1 -1
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/pyproject.toml +1 -1
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/src/gemini_agent/__init__.py +1 -1
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/src/gemini_agent/agent.py +0 -2
- gemini_agent_framework-0.2.3/tests/formatting_payload_2.json +82 -0
- gemini_agent_framework-0.2.3/tests/payload_0.json +49 -0
- gemini_agent_framework-0.2.3/tests/payload_1.json +90 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/tests/test_variables.py +5 -2
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.flake8 +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/ci.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/deploy-docs.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/docs.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/python-publish.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/tests.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.gitignore +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/CHANGELOG.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/CODE_OF_CONDUCT.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/CONTRIBUTING.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/LICENSE +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/README.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/api_reference.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/architecture.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/best_practices.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/index.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/installation.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/docs/tutorials.md +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/mkdocs.yml +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/payload_variable_0.json +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/requirements.txt +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/tests/__init__.py +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/tests/test_agent.py +0 -0
- {gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/tests/test_class_methods.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gemini-agent-framework
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.3
|
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
6
|
Project-URL: Documentation, https://m7mdony.github.io/gemini-agent-framework
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "gemini-agent-framework"
|
7
|
-
version = "0.2.
|
7
|
+
version = "0.2.3"
|
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"
|
@@ -314,7 +314,6 @@ class Agent:
|
|
314
314
|
|
315
315
|
def _log_json(self, json_data: Dict[str, Any], file_name: str, debug_scope: Optional[str] = None) -> None:
|
316
316
|
"""Logs the JSON data to a file."""
|
317
|
-
print("in log json")
|
318
317
|
if "json" not in debug_scope:
|
319
318
|
return
|
320
319
|
with open(file_name, "w") as f:
|
@@ -388,7 +387,6 @@ class Agent:
|
|
388
387
|
self._log_json(payload, f"payload_{count}.json", debug_scope)
|
389
388
|
count += 1
|
390
389
|
response_data = self._call_gemini_api(payload, debug_scope)
|
391
|
-
print("response data " , response_data)
|
392
390
|
if "error" in response_data:
|
393
391
|
self._log_text(
|
394
392
|
f"API call failed: {response_data['error'].get('message', 'Unknown API error')}"
|
@@ -0,0 +1,82 @@
|
|
1
|
+
{
|
2
|
+
"contents": [
|
3
|
+
{
|
4
|
+
"role": "user",
|
5
|
+
"parts": [
|
6
|
+
{
|
7
|
+
"text": "How many input tags are in the home page?"
|
8
|
+
}
|
9
|
+
]
|
10
|
+
},
|
11
|
+
{
|
12
|
+
"role": "model",
|
13
|
+
"parts": [
|
14
|
+
{
|
15
|
+
"functionCall": {
|
16
|
+
"name": "count_inputs",
|
17
|
+
"args": {
|
18
|
+
"html_content": {
|
19
|
+
"variable": "home_page"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
}
|
24
|
+
]
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"role": "user",
|
28
|
+
"parts": [
|
29
|
+
{
|
30
|
+
"text": "the return value of the function stored in the variable result_0"
|
31
|
+
}
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"role": "user",
|
36
|
+
"parts": [
|
37
|
+
{
|
38
|
+
"functionResponse": {
|
39
|
+
"name": "count_inputs",
|
40
|
+
"response": {
|
41
|
+
"content": {
|
42
|
+
"count": 0,
|
43
|
+
"input_types": []
|
44
|
+
},
|
45
|
+
"key": "result_0",
|
46
|
+
"content_type": "dict"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
]
|
51
|
+
},
|
52
|
+
{
|
53
|
+
"role": "user",
|
54
|
+
"parts": [
|
55
|
+
{
|
56
|
+
"text": "Based on our conversation above, please format the following information according to the requested JSON structure:\n\nThere are 0 input tags in the home page."
|
57
|
+
}
|
58
|
+
]
|
59
|
+
}
|
60
|
+
],
|
61
|
+
"generationConfig": {
|
62
|
+
"response_mime_type": "application/json",
|
63
|
+
"response_schema": {
|
64
|
+
"type": "object",
|
65
|
+
"properties": {
|
66
|
+
"count": {
|
67
|
+
"type": "integer"
|
68
|
+
},
|
69
|
+
"input_types": {
|
70
|
+
"type": "array",
|
71
|
+
"items": {
|
72
|
+
"type": "string"
|
73
|
+
}
|
74
|
+
}
|
75
|
+
},
|
76
|
+
"required": [
|
77
|
+
"count",
|
78
|
+
"input_types"
|
79
|
+
]
|
80
|
+
}
|
81
|
+
}
|
82
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
{
|
2
|
+
"system_instruction": {
|
3
|
+
"parts": [
|
4
|
+
{
|
5
|
+
"text": "You are a tool that counts the number of input tags in an HTML page."
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"text": "\n\n Available variables:\n - home_page: The HTML content of the home page (Type: <class 'str'>)\n \n IMPORTANT - Variable Usage:\n When you need to use a stored variable in a function call, you MUST use the following syntax:\n - For function arguments: {\"variable\": \"variable_name\"}\n - For example, if you want to use the 'current_user' variable in a function call:\n {\"user_id\": {\"variable\": \"current_user\"}}\n \n Remember:\n - Always perform one operation at a time\n - Use intermediate results from previous steps\n - If a step requires multiple tools, execute them sequentially\n - If you're unsure about the next step, explain your reasoning\n - You can use both stored variables and values from the prompt\n - When using stored variables, ALWAYS use the {\"variable\": \"variable_name\"} syntax\n "
|
9
|
+
}
|
10
|
+
]
|
11
|
+
},
|
12
|
+
"contents": [
|
13
|
+
{
|
14
|
+
"role": "user",
|
15
|
+
"parts": [
|
16
|
+
{
|
17
|
+
"text": "How many input tags are in the home page?"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"tools": [
|
23
|
+
{
|
24
|
+
"functionDeclarations": [
|
25
|
+
{
|
26
|
+
"name": "count_inputs",
|
27
|
+
"description": "Count the number of input tags in an HTML page",
|
28
|
+
"parameters": {
|
29
|
+
"type": "OBJECT",
|
30
|
+
"properties": {
|
31
|
+
"html_content": {
|
32
|
+
"type": "STRING",
|
33
|
+
"description": "The HTML content to analyze"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"required": [
|
37
|
+
"html_content"
|
38
|
+
]
|
39
|
+
}
|
40
|
+
}
|
41
|
+
]
|
42
|
+
}
|
43
|
+
],
|
44
|
+
"toolConfig": {
|
45
|
+
"functionCallingConfig": {
|
46
|
+
"mode": "AUTO"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
{
|
2
|
+
"system_instruction": {
|
3
|
+
"parts": [
|
4
|
+
{
|
5
|
+
"text": "You are a tool that counts the number of input tags in an HTML page."
|
6
|
+
},
|
7
|
+
{
|
8
|
+
"text": "\n\n Available variables:\n - home_page: The HTML content of the home page (Type: <class 'str'>)\n \n IMPORTANT - Variable Usage:\n When you need to use a stored variable in a function call, you MUST use the following syntax:\n - For function arguments: {\"variable\": \"variable_name\"}\n - For example, if you want to use the 'current_user' variable in a function call:\n {\"user_id\": {\"variable\": \"current_user\"}}\n \n Remember:\n - Always perform one operation at a time\n - Use intermediate results from previous steps\n - If a step requires multiple tools, execute them sequentially\n - If you're unsure about the next step, explain your reasoning\n - You can use both stored variables and values from the prompt\n - When using stored variables, ALWAYS use the {\"variable\": \"variable_name\"} syntax\n "
|
9
|
+
}
|
10
|
+
]
|
11
|
+
},
|
12
|
+
"contents": [
|
13
|
+
{
|
14
|
+
"role": "user",
|
15
|
+
"parts": [
|
16
|
+
{
|
17
|
+
"text": "How many input tags are in the home page?"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"role": "model",
|
23
|
+
"parts": [
|
24
|
+
{
|
25
|
+
"functionCall": {
|
26
|
+
"name": "count_inputs",
|
27
|
+
"args": {
|
28
|
+
"html_content": {
|
29
|
+
"variable": "home_page"
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"role": "user",
|
38
|
+
"parts": [
|
39
|
+
{
|
40
|
+
"text": "the return value of the function stored in the variable result_0"
|
41
|
+
}
|
42
|
+
]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
"role": "user",
|
46
|
+
"parts": [
|
47
|
+
{
|
48
|
+
"functionResponse": {
|
49
|
+
"name": "count_inputs",
|
50
|
+
"response": {
|
51
|
+
"content": {
|
52
|
+
"count": 0,
|
53
|
+
"input_types": []
|
54
|
+
},
|
55
|
+
"key": "result_0",
|
56
|
+
"content_type": "dict"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}
|
62
|
+
],
|
63
|
+
"tools": [
|
64
|
+
{
|
65
|
+
"functionDeclarations": [
|
66
|
+
{
|
67
|
+
"name": "count_inputs",
|
68
|
+
"description": "Count the number of input tags in an HTML page",
|
69
|
+
"parameters": {
|
70
|
+
"type": "OBJECT",
|
71
|
+
"properties": {
|
72
|
+
"html_content": {
|
73
|
+
"type": "STRING",
|
74
|
+
"description": "The HTML content to analyze"
|
75
|
+
}
|
76
|
+
},
|
77
|
+
"required": [
|
78
|
+
"html_content"
|
79
|
+
]
|
80
|
+
}
|
81
|
+
}
|
82
|
+
]
|
83
|
+
}
|
84
|
+
],
|
85
|
+
"toolConfig": {
|
86
|
+
"functionCallingConfig": {
|
87
|
+
"mode": "AUTO"
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from
|
1
|
+
from gemini_agent import Agent
|
2
2
|
import os
|
3
3
|
from dotenv import load_dotenv
|
4
4
|
import json
|
@@ -105,7 +105,10 @@ agent.set_variable(
|
|
105
105
|
# Example 1: Count inputs in home page
|
106
106
|
print("\nExample 1: Count inputs in home page")
|
107
107
|
response = agent.prompt(
|
108
|
-
|
108
|
+
|
109
|
+
user_prompt="How many input tags are in the home page?",
|
110
|
+
system_prompt="You are a tool that counts the number of input tags in an HTML page.",
|
111
|
+
debug_scope=["json"],
|
109
112
|
response_structure={
|
110
113
|
"type": "object",
|
111
114
|
"properties": {
|
File without changes
|
File without changes
|
{gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/deploy-docs.yml
RENAMED
File without changes
|
File without changes
|
{gemini_agent_framework-0.2.2 → gemini_agent_framework-0.2.3}/.github/workflows/python-publish.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|