File tree 4 files changed +27
-1
lines changed
4 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 6
6
get_last_action ,
7
7
get_available_actions ,
8
8
get_formatted_actions ,
9
+ get_action_from_memory ,
9
10
search_actions ,
10
11
use_action ,
11
12
add_action ,
23
24
"get_last_action" ,
24
25
"get_available_actions" ,
25
26
"get_formatted_actions" ,
27
+ "get_action_from_memory" ,
26
28
"search_actions" ,
27
29
"use_action" ,
28
30
"add_action" ,
Original file line number Diff line number Diff line change @@ -124,6 +124,21 @@ def get_available_actions(search_text, n_results=5):
124
124
125
125
return available_actions
126
126
127
+ def get_action_from_memory (action_name ):
128
+ """
129
+ Retrieve an action from memory based on the action's name.
130
+
131
+ Args:
132
+ action_name: The name of the action to retrieve.
133
+
134
+ Returns:
135
+ A dictionary representing the action.
136
+ """
137
+ action = get_memories ("actions" , filter_metadata = {"name" : action_name }, n_results = 1 )
138
+ if len (action ) == 0 :
139
+ return None
140
+ return action [0 ]
141
+
127
142
128
143
def search_actions (search_text , n_results = 5 ):
129
144
"""
Original file line number Diff line number Diff line change 12
12
13
13
setup (
14
14
name = "agentaction" ,
15
- version = "0.1.2 " ,
15
+ version = "0.1.3 " ,
16
16
description = "Action chaining and history for agents" ,
17
17
long_description = readme , # added this line
18
18
long_description_content_type = "text/markdown" , # and this line
Original file line number Diff line number Diff line change 6
6
get_action_history ,
7
7
get_last_action ,
8
8
get_available_actions ,
9
+ get_action_from_memory ,
9
10
search_actions ,
10
11
use_action ,
11
12
add_action ,
@@ -112,6 +113,14 @@ def test_get_available_actions():
112
113
assert len (available_actions ) > 0 # Should be at least one action
113
114
cleanup () # Cleanup after the test
114
115
116
+ def get_get_action_from_memory ():
117
+ cleanup () # Ensure clean state before test
118
+ test_action = setup_test_action ()
119
+ add_action ("test" , test_action )
120
+
121
+ memory = get_action_from_memory ("test" )
122
+ assert memory is not None
123
+ cleanup () # Cleanup after the test
115
124
116
125
# Define a directory for testing import_actions
117
126
TEST_DIR = "test_actions_dir"
You can’t perform that action at this time.
0 commit comments