gemini-agent-framework 0.1.6__tar.gz → 0.1.9__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.1.6 → gemini_agent_framework-0.1.9}/PKG-INFO +1 -1
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/pyproject.toml +1 -1
- gemini_agent_framework-0.1.9/src/gemini_agent/__init__.py +4 -0
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/src/gemini_agent/agent.py +28 -2
- gemini_agent_framework-0.1.6/src/gemini_agent/__init__.py +0 -4
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/.gitignore +0 -0
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/README.md +0 -0
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/requirements.txt +0 -0
- {gemini_agent_framework-0.1.6 → gemini_agent_framework-0.1.9}/tests/test_agent.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: gemini-agent-framework
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.9
|
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://github.com/m7mdony/gemini-agent-framework#readme
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "gemini-agent-framework"
|
7
|
-
version = "0.1.
|
7
|
+
version = "0.1.9"
|
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"
|
@@ -143,6 +143,7 @@ class Agent:
|
|
143
143
|
def set_variable(self, name: str, value: Any, description: str = "", type_hint: type = None) -> None:
|
144
144
|
"""
|
145
145
|
Stores a variable in the agent's memory with metadata.
|
146
|
+
If a variable with the same name exists, creates a new variable with a counter suffix.
|
146
147
|
|
147
148
|
Args:
|
148
149
|
name: The name of the variable
|
@@ -150,6 +151,29 @@ class Agent:
|
|
150
151
|
description: A description of what the variable represents
|
151
152
|
type_hint: Optional type hint for the variable
|
152
153
|
"""
|
154
|
+
# Check if the base name exists
|
155
|
+
if name in self._stored_variables:
|
156
|
+
# Find all variables that start with the base name
|
157
|
+
existing_vars = [var_name for var_name in self._stored_variables.keys()
|
158
|
+
if var_name.startswith(name + '_') or var_name == name]
|
159
|
+
|
160
|
+
# Find the highest counter used
|
161
|
+
max_counter = 0
|
162
|
+
for var_name in existing_vars:
|
163
|
+
if var_name == name:
|
164
|
+
max_counter = max(max_counter, 1)
|
165
|
+
else:
|
166
|
+
try:
|
167
|
+
counter = int(var_name.split('_')[-1])
|
168
|
+
max_counter = max(max_counter, counter)
|
169
|
+
except ValueError:
|
170
|
+
continue
|
171
|
+
|
172
|
+
# Create new name with incremented counter
|
173
|
+
new_name = f"{name}_{max_counter + 1}"
|
174
|
+
print(f"Variable '{name}' already exists. Creating new variable '{new_name}'")
|
175
|
+
name = new_name
|
176
|
+
|
153
177
|
self._stored_variables[name] = {
|
154
178
|
'value': value,
|
155
179
|
'description': description,
|
@@ -213,7 +237,6 @@ class Agent:
|
|
213
237
|
- If a step requires multiple tools, execute them sequentially
|
214
238
|
- If you're unsure about the next step, explain your reasoning
|
215
239
|
- You can use both stored variables and values from the prompt
|
216
|
-
- You don't have the ability to set new varaibles during the conversation. and if you need to use them thhen you will need to use its actual value.
|
217
240
|
- When using stored variables, ALWAYS use the {{"variable": "variable_name"}} syntax
|
218
241
|
""".format(
|
219
242
|
tools_list="\n".join([f"- {name}: {desc}" for name, desc in
|
@@ -391,10 +414,13 @@ class Agent:
|
|
391
414
|
"name": tool_name,
|
392
415
|
"response": {
|
393
416
|
"content": function_result,
|
394
|
-
"
|
417
|
+
"key": result_key,
|
418
|
+
"content_type": type(function_result).__name__
|
395
419
|
}
|
396
420
|
}
|
397
421
|
}
|
422
|
+
|
423
|
+
self.set_variable(result_key, function_result, "the result of function call with name {tool_name} and arguments {args}")
|
398
424
|
payload["contents"].append({"role": "user", "parts": [function_response_part]})
|
399
425
|
|
400
426
|
except Exception as e:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|