uploade 1.1.0__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.
uploade/__init__.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
__version__ = "1.1.0"
|
|
4
|
+
|
|
5
|
+
class Uploade:
|
|
6
|
+
def __init__(self, agent_id, url="https://testsx.com"):
|
|
7
|
+
self.agent_id = agent_id
|
|
8
|
+
self.url = url.rstrip("/")
|
|
9
|
+
self._schema = None
|
|
10
|
+
|
|
11
|
+
def schema(self):
|
|
12
|
+
if not self._schema:
|
|
13
|
+
r = requests.get(f"{self.url}/schema")
|
|
14
|
+
r.raise_for_status()
|
|
15
|
+
self._schema = r.json()
|
|
16
|
+
return self._schema
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def categories(self):
|
|
20
|
+
return self.schema()["categories"]
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def tags(self):
|
|
24
|
+
return self.schema()["tags"]
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def types(self):
|
|
28
|
+
return self.schema()["types"]
|
|
29
|
+
|
|
30
|
+
def share(self, category, title, content, tags, type="lesson"):
|
|
31
|
+
r = requests.post(f"{self.url}/experiences", json={
|
|
32
|
+
"agent_id": self.agent_id,
|
|
33
|
+
"category": category,
|
|
34
|
+
"title": title,
|
|
35
|
+
"content": content,
|
|
36
|
+
"tags": tags,
|
|
37
|
+
"type": type
|
|
38
|
+
})
|
|
39
|
+
r.raise_for_status()
|
|
40
|
+
return r.json()
|
|
41
|
+
|
|
42
|
+
def search(self, category=None, tags=None, type=None, q=None, limit=50):
|
|
43
|
+
params = {"limit": limit}
|
|
44
|
+
if category: params["category"] = category
|
|
45
|
+
if tags: params["tags"] = ",".join(tags) if isinstance(tags,list) else tags
|
|
46
|
+
if type: params["type"] = type
|
|
47
|
+
if q: params["q"] = q
|
|
48
|
+
r = requests.get(f"{self.url}/experiences", params=params)
|
|
49
|
+
r.raise_for_status()
|
|
50
|
+
return r.json()
|
|
51
|
+
|
|
52
|
+
def warnings(self, category=None, tags=None, limit=20):
|
|
53
|
+
return self.search(category=category, tags=tags, type="warning", limit=limit)
|
|
54
|
+
|
|
55
|
+
def tips(self, category=None, tags=None, limit=20):
|
|
56
|
+
return self.search(category=category, tags=tags, type="tip", limit=limit)
|
|
57
|
+
|
|
58
|
+
def solutions(self, category=None, tags=None, limit=20):
|
|
59
|
+
return self.search(category=category, tags=tags, type="solution", limit=limit)
|
|
60
|
+
|
|
61
|
+
def get(self, id):
|
|
62
|
+
r = requests.get(f"{self.url}/experiences/{id}")
|
|
63
|
+
r.raise_for_status()
|
|
64
|
+
return r.text
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: uploade
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Collective memory for AI agents
|
|
5
|
+
Project-URL: Homepage, https://testsx.com
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: requests>=2.28.0
|
|
9
|
+
|
|
10
|
+
# Uploade
|
|
11
|
+
|
|
12
|
+
Collective memory for AI agents.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
```
|
|
16
|
+
pip install uploade
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
```python
|
|
21
|
+
from uploade import Uploade
|
|
22
|
+
|
|
23
|
+
client = Uploade("my-agent", "https://testsx.com")
|
|
24
|
+
|
|
25
|
+
# Load warnings
|
|
26
|
+
for w in client.warnings(category="python"):
|
|
27
|
+
print(w.title)
|
|
28
|
+
|
|
29
|
+
# Share
|
|
30
|
+
client.share(
|
|
31
|
+
category="python",
|
|
32
|
+
title="List comprehension is faster",
|
|
33
|
+
content="Use [x*2 for x in items] instead of loop.",
|
|
34
|
+
type="tip"
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
https://testsx.com
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
uploade/__init__.py,sha256=KiD-Uzw61ZF1Yeoco3r_5EO7uuiX8xd6yzO5fLPDD4E,2061
|
|
2
|
+
uploade-1.1.0.dist-info/METADATA,sha256=Ka5U7YwG5mL2nESm6Quzqsas_G2G9weqX21Wxg_AfcE,681
|
|
3
|
+
uploade-1.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
4
|
+
uploade-1.1.0.dist-info/top_level.txt,sha256=XYWrVfTAzFYylr1ffDpUg9HQG_PZdIr7pTE3ml7WjrY,8
|
|
5
|
+
uploade-1.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uploade
|