acp-plugin-gamesdk 0.1.4__tar.gz → 0.1.5__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.
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/PKG-INFO +4 -4
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/README.md +3 -3
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/acp_plugin_gamesdk/acp_client.py +19 -3
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/acp_plugin_gamesdk/acp_plugin.py +13 -10
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/pyproject.toml +1 -1
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/acp_plugin_gamesdk/acp_token.py +0 -0
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/acp_plugin_gamesdk/acp_token_abi.py +0 -0
- {acp_plugin_gamesdk-0.1.4 → acp_plugin_gamesdk-0.1.5}/acp_plugin_gamesdk/interface.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: acp-plugin-gamesdk
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.5
|
4
4
|
Summary: ACP Plugin for Python SDK for GAME by Virtuals
|
5
5
|
Author: Steven Lee Soon Fatt
|
6
6
|
Author-email: steven@virtuals.io
|
@@ -134,7 +134,7 @@ acp_plugin = AcpPlugin(
|
|
134
134
|
> - This is where you can get your session entity key ID:
|
135
135
|
> 
|
136
136
|
|
137
|
-
4. (
|
137
|
+
4. (Optional) If you want to use GAME's twitter client with the ACP plugin, you can initialize it by running:
|
138
138
|
|
139
139
|
```python
|
140
140
|
twitter_client_options = {
|
@@ -200,7 +200,7 @@ agent = Agent(
|
|
200
200
|
)
|
201
201
|
```
|
202
202
|
|
203
|
-
|
203
|
+
7. Buyer-specific configurations
|
204
204
|
|
205
205
|
- <i>[Setting buyer agent goal]</i> Define what item needs to be "bought" and which worker to go to look for the item, e.g.
|
206
206
|
|
@@ -208,7 +208,7 @@ agent = Agent(
|
|
208
208
|
agent_goal = "You are an agent that gains market traction by posting memes. Your interest are in cats and AI. You can head to acp to look for agents to help you generate memes."
|
209
209
|
```
|
210
210
|
|
211
|
-
|
211
|
+
8. Seller-specific configurations
|
212
212
|
|
213
213
|
- <i>[Setting seller agent goal]</i> Define what item needs to be "sold" and which worker to go to respond to jobs, e.g.
|
214
214
|
|
@@ -108,7 +108,7 @@ acp_plugin = AcpPlugin(
|
|
108
108
|
> - This is where you can get your session entity key ID:
|
109
109
|
> 
|
110
110
|
|
111
|
-
4. (
|
111
|
+
4. (Optional) If you want to use GAME's twitter client with the ACP plugin, you can initialize it by running:
|
112
112
|
|
113
113
|
```python
|
114
114
|
twitter_client_options = {
|
@@ -174,7 +174,7 @@ agent = Agent(
|
|
174
174
|
)
|
175
175
|
```
|
176
176
|
|
177
|
-
|
177
|
+
7. Buyer-specific configurations
|
178
178
|
|
179
179
|
- <i>[Setting buyer agent goal]</i> Define what item needs to be "bought" and which worker to go to look for the item, e.g.
|
180
180
|
|
@@ -182,7 +182,7 @@ agent = Agent(
|
|
182
182
|
agent_goal = "You are an agent that gains market traction by posting memes. Your interest are in cats and AI. You can head to acp to look for agents to help you generate memes."
|
183
183
|
```
|
184
184
|
|
185
|
-
|
185
|
+
8. Seller-specific configurations
|
186
186
|
|
187
187
|
- <i>[Setting seller agent goal]</i> Define what item needs to be "sold" and which worker to go to respond to jobs, e.g.
|
188
188
|
|
@@ -5,6 +5,7 @@ import requests
|
|
5
5
|
from acp_plugin_gamesdk.interface import AcpAgent, AcpJobPhases, AcpOffering, AcpState
|
6
6
|
from acp_plugin_gamesdk.acp_token import AcpToken, MemoType
|
7
7
|
import time
|
8
|
+
import traceback
|
8
9
|
|
9
10
|
|
10
11
|
class AcpClient:
|
@@ -40,7 +41,12 @@ class AcpClient:
|
|
40
41
|
response = requests.get(url)
|
41
42
|
|
42
43
|
if response.status_code != 200:
|
43
|
-
raise Exception(
|
44
|
+
raise Exception(
|
45
|
+
f"Error occured in browse_agents function. Failed to browse agents.\n"
|
46
|
+
f"Response status code: {response.status_code}\n"
|
47
|
+
f"Response description: {response.text}\n"
|
48
|
+
)
|
49
|
+
|
44
50
|
|
45
51
|
response_json = response.json()
|
46
52
|
|
@@ -98,7 +104,8 @@ class AcpClient:
|
|
98
104
|
break
|
99
105
|
|
100
106
|
except Exception as e:
|
101
|
-
print(f"Error
|
107
|
+
print(f"Error in create_job function: {e}")
|
108
|
+
print(traceback.format_exc())
|
102
109
|
if attempt < retry_count - 1:
|
103
110
|
time.sleep(retry_delay)
|
104
111
|
else:
|
@@ -194,7 +201,11 @@ class AcpClient:
|
|
194
201
|
)
|
195
202
|
|
196
203
|
if response.status_code != 200 and response.status_code != 201:
|
197
|
-
raise Exception(
|
204
|
+
raise Exception(
|
205
|
+
f"Error occured in add_tweet function. Failed to add tweet.\n"
|
206
|
+
f"Response status code: {response.status_code}\n"
|
207
|
+
f"Response description: {response.text}\n"
|
208
|
+
)
|
198
209
|
|
199
210
|
|
200
211
|
return response.json()
|
@@ -206,4 +217,9 @@ class AcpClient:
|
|
206
217
|
)
|
207
218
|
|
208
219
|
if response.status_code not in [200, 204]:
|
220
|
+
raise Exception(
|
221
|
+
f"Error occured in reset_state function. Failed to reset state\n"
|
222
|
+
f"Response status code: {response.status_code}\n"
|
223
|
+
f"Response description: {response.text}\n"
|
224
|
+
)
|
209
225
|
raise Exception(f"Failed to reset state: {response.status_code} {response.text}")
|
@@ -57,7 +57,10 @@ class AcpPlugin:
|
|
57
57
|
"""
|
58
58
|
self.cluster = options.cluster
|
59
59
|
self.evaluator_cluster = options.evaluator_cluster
|
60
|
-
self.twitter_plugin =
|
60
|
+
self.twitter_plugin = None
|
61
|
+
if (options.twitter_plugin is not None):
|
62
|
+
self.twitter_plugin = options.twitter_plugin
|
63
|
+
|
61
64
|
self.produced_inventory: List[IInventory] = []
|
62
65
|
self.acp_base_url = self.acp_token_client.acp_base_url if self.acp_token_client.acp_base_url is None else "https://acpx-staging.virtuals.io/api"
|
63
66
|
if (options.on_evaluate is not None):
|
@@ -72,7 +75,6 @@ class AcpPlugin:
|
|
72
75
|
Returns a tuple of (success, message).
|
73
76
|
"""
|
74
77
|
try:
|
75
|
-
print("Initializing socket after")
|
76
78
|
self.socket = socketio.Client()
|
77
79
|
|
78
80
|
# Set up authentication before connecting
|
@@ -252,7 +254,7 @@ class AcpPlugin:
|
|
252
254
|
|
253
255
|
args = [seller_wallet_address_arg, price_arg, reasoning_arg, service_requirements_arg, require_evaluation_arg, evaluator_keyword_arg]
|
254
256
|
|
255
|
-
if self.twitter_plugin is not None:
|
257
|
+
if hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None:
|
256
258
|
tweet_content_arg = Argument(
|
257
259
|
name="tweetContent",
|
258
260
|
type="string",
|
@@ -304,7 +306,7 @@ class AcpPlugin:
|
|
304
306
|
evaluatorAddress
|
305
307
|
)
|
306
308
|
|
307
|
-
if (self.twitter_plugin is not None and tweetContent is not None):
|
309
|
+
if (hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None and tweetContent is not None):
|
308
310
|
post_tweet_fn = self.twitter_plugin.get_function('post_tweet')
|
309
311
|
tweet_id = post_tweet_fn(tweetContent, None).get('data', {}).get('id')
|
310
312
|
if (tweet_id is not None):
|
@@ -343,7 +345,7 @@ class AcpPlugin:
|
|
343
345
|
|
344
346
|
args = [job_id_arg, decision_arg, reasoning_arg]
|
345
347
|
|
346
|
-
if self.twitter_plugin is not None:
|
348
|
+
if hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None:
|
347
349
|
tweet_content_arg = Argument(
|
348
350
|
name="tweetContent",
|
349
351
|
type="string",
|
@@ -389,7 +391,7 @@ class AcpPlugin:
|
|
389
391
|
reasoning
|
390
392
|
)
|
391
393
|
|
392
|
-
if (self.twitter_plugin is not None and tweetContent is not None):
|
394
|
+
if (hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None and tweetContent is not None):
|
393
395
|
tweet_history = job.get("tweetHistory", [])
|
394
396
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
395
397
|
if (tweet_id is not None):
|
@@ -429,7 +431,7 @@ class AcpPlugin:
|
|
429
431
|
|
430
432
|
args = [job_id_arg, amount_arg, reasoning_arg]
|
431
433
|
|
432
|
-
if self.twitter_plugin is not None:
|
434
|
+
if hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None:
|
433
435
|
tweet_content_arg = Argument(
|
434
436
|
name="tweetContent",
|
435
437
|
type="string",
|
@@ -476,7 +478,7 @@ class AcpPlugin:
|
|
476
478
|
reasoning
|
477
479
|
)
|
478
480
|
|
479
|
-
if (self.twitter_plugin is not None and tweetContent is not None):
|
481
|
+
if (hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None and tweetContent is not None):
|
480
482
|
tweet_history = job.get("tweetHistory", [])
|
481
483
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
482
484
|
if (tweet_id is not None):
|
@@ -522,7 +524,7 @@ class AcpPlugin:
|
|
522
524
|
|
523
525
|
args = [job_id_arg, deliverable_type_arg, deliverable_arg, reasoning_arg]
|
524
526
|
|
525
|
-
if self.twitter_plugin is not None:
|
527
|
+
if hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None:
|
526
528
|
tweet_content_arg = Argument(
|
527
529
|
name="tweetContent",
|
528
530
|
type="string",
|
@@ -579,7 +581,8 @@ class AcpPlugin:
|
|
579
581
|
json.dumps(deliverable),
|
580
582
|
)
|
581
583
|
|
582
|
-
if (self.twitter_plugin is not None and tweetContent is not None):
|
584
|
+
if (hasattr(self, 'twitter_plugin') and self.twitter_plugin is not None and tweetContent is not None):
|
585
|
+
|
583
586
|
tweet_history = job.get("tweetHistory", [])
|
584
587
|
tweet_id = tweet_history[-1].get("tweetId") if tweet_history else None
|
585
588
|
if (tweet_id is not None):
|
File without changes
|
File without changes
|
File without changes
|