sovigl 0.1.0__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.
- sovigl-0.1.0/PKG-INFO +9 -0
- sovigl-0.1.0/setup.cfg +4 -0
- sovigl-0.1.0/setup.py +10 -0
- sovigl-0.1.0/sovigl/__init__.py +1 -0
- sovigl-0.1.0/sovigl/client.py +52 -0
- sovigl-0.1.0/sovigl.egg-info/PKG-INFO +9 -0
- sovigl-0.1.0/sovigl.egg-info/SOURCES.txt +8 -0
- sovigl-0.1.0/sovigl.egg-info/dependency_links.txt +1 -0
- sovigl-0.1.0/sovigl.egg-info/requires.txt +1 -0
- sovigl-0.1.0/sovigl.egg-info/top_level.txt +1 -0
sovigl-0.1.0/PKG-INFO
ADDED
sovigl-0.1.0/setup.cfg
ADDED
sovigl-0.1.0/setup.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import evaluate
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
import uuid
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def map_status(status):
|
|
6
|
+
if status == "allowed":
|
|
7
|
+
return "approved"
|
|
8
|
+
if status == "pending_approval":
|
|
9
|
+
return "pending"
|
|
10
|
+
return status
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Decision:
|
|
14
|
+
def __init__(self, data):
|
|
15
|
+
self.status = map_status(data["status"])
|
|
16
|
+
self.reason = data.get("reason")
|
|
17
|
+
self.cdt = data.get("cdt")
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def approved(self):
|
|
21
|
+
return self.status == "approved"
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def pending(self):
|
|
25
|
+
return self.status == "pending"
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def blocked(self):
|
|
29
|
+
return self.status == "blocked"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def evaluate(action: str, context: dict, org_id: str = "demo_fintech"):
|
|
33
|
+
amount = context["amount"]
|
|
34
|
+
payload = {
|
|
35
|
+
"org_id": org_id,
|
|
36
|
+
"type": action.split(".")[0],
|
|
37
|
+
"amount": amount,
|
|
38
|
+
"role": "employee",
|
|
39
|
+
"user_id": "sdk_user",
|
|
40
|
+
"agent_id": "sdk_client",
|
|
41
|
+
"agent_type": "ai",
|
|
42
|
+
"decision_id": str(uuid.uuid4()),
|
|
43
|
+
}
|
|
44
|
+
if amount > 10000:
|
|
45
|
+
payload["description"] = "SDK test transaction"
|
|
46
|
+
|
|
47
|
+
response = requests.post(
|
|
48
|
+
"https://web-production-e334b.up.railway.app/evaluate",
|
|
49
|
+
json=payload,
|
|
50
|
+
)
|
|
51
|
+
data = response.json()
|
|
52
|
+
return Decision(data)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sovigl
|