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 ADDED
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: sovigl
3
+ Version: 0.1.0
4
+ Summary: SOVIGL returns approved, pending, or blocked for any action.
5
+ Author: Ritesh Kumar
6
+ Requires-Dist: requests
7
+ Dynamic: author
8
+ Dynamic: requires-dist
9
+ Dynamic: summary
sovigl-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
sovigl-0.1.0/setup.py ADDED
@@ -0,0 +1,10 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="sovigl",
5
+ version="0.1.0",
6
+ packages=find_packages(),
7
+ install_requires=["requests"],
8
+ description="SOVIGL returns approved, pending, or blocked for any action.",
9
+ author="Ritesh Kumar",
10
+ )
@@ -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,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: sovigl
3
+ Version: 0.1.0
4
+ Summary: SOVIGL returns approved, pending, or blocked for any action.
5
+ Author: Ritesh Kumar
6
+ Requires-Dist: requests
7
+ Dynamic: author
8
+ Dynamic: requires-dist
9
+ Dynamic: summary
@@ -0,0 +1,8 @@
1
+ setup.py
2
+ sovigl/__init__.py
3
+ sovigl/client.py
4
+ sovigl.egg-info/PKG-INFO
5
+ sovigl.egg-info/SOURCES.txt
6
+ sovigl.egg-info/dependency_links.txt
7
+ sovigl.egg-info/requires.txt
8
+ sovigl.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests
@@ -0,0 +1 @@
1
+ sovigl