gemini-agent-framework 0.1.8__py3-none-any.whl → 0.1.9__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 +28 -1
- {gemini_agent_framework-0.1.8.dist-info → gemini_agent_framework-0.1.9.dist-info}/METADATA +1 -1
- gemini_agent_framework-0.1.9.dist-info/RECORD +5 -0
- gemini_agent_framework-0.1.8.dist-info/RECORD +0 -5
- {gemini_agent_framework-0.1.8.dist-info → gemini_agent_framework-0.1.9.dist-info}/WHEEL +0 -0
gemini_agent/__init__.py
CHANGED
gemini_agent/agent.py
CHANGED
@@ -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.
|
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,9 +414,13 @@ class Agent:
|
|
391
414
|
"name": tool_name,
|
392
415
|
"response": {
|
393
416
|
"content": function_result,
|
417
|
+
"key": result_key,
|
418
|
+
"content_type": type(function_result).__name__
|
394
419
|
}
|
395
420
|
}
|
396
421
|
}
|
422
|
+
|
423
|
+
self.set_variable(result_key, function_result, "the result of function call with name {tool_name} and arguments {args}")
|
397
424
|
payload["contents"].append({"role": "user", "parts": [function_response_part]})
|
398
425
|
|
399
426
|
except Exception as e:
|
@@ -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
|
@@ -0,0 +1,5 @@
|
|
1
|
+
gemini_agent/__init__.py,sha256=7FDPUc1fVrUccXn0FvUfpzjXTI2rjDL0F0LtrLa5Mxw,71
|
2
|
+
gemini_agent/agent.py,sha256=8DZKLCAP1L30s1oiImjIhKj6S8ynxvxcZVQmZDCze3s,25612
|
3
|
+
gemini_agent_framework-0.1.9.dist-info/METADATA,sha256=MGED2_JeI2kkMyMX89s5Tgc1uFzMpXMqVYeuXEjhoYM,2386
|
4
|
+
gemini_agent_framework-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
+
gemini_agent_framework-0.1.9.dist-info/RECORD,,
|
@@ -1,5 +0,0 @@
|
|
1
|
-
gemini_agent/__init__.py,sha256=dwWKWKg_cIpvF30zdShQowwQM4fwhbFGau-zB7jxZP8,71
|
2
|
-
gemini_agent/agent.py,sha256=Of-iGnxirZbF2qIfUt2accqgIfyPGByeWqHBMKvWg70,24251
|
3
|
-
gemini_agent_framework-0.1.8.dist-info/METADATA,sha256=Ln2w6h2R6AFKEH5cTpX02gbP6whmxQAx8OPCIMWSsG8,2386
|
4
|
-
gemini_agent_framework-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
gemini_agent_framework-0.1.8.dist-info/RECORD,,
|
File without changes
|