semantic-kernel-nory 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.
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.4
2
+ Name: semantic-kernel-nory
3
+ Version: 0.1.0
4
+ Summary: Semantic Kernel plugins for x402 payments - let agents pay for APIs
5
+ Author-email: Nory <hello@noryx402.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://noryx402.com
8
+ Project-URL: Repository, https://github.com/TheMemeBanker/semantic-kernel-nory
9
+ Keywords: semantic-kernel,microsoft,ai-agents,payments,x402,solana
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: semantic-kernel>=1.0.0
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # semantic-kernel-nory
19
+
20
+ **Semantic Kernel plugins for x402 payments** - Let your agents pay for APIs.
21
+
22
+ ## Install
23
+ ```bash
24
+ pip install semantic-kernel-nory
25
+ ```
26
+
27
+ ## Usage
28
+ ```python
29
+ from semantic_kernel import Kernel
30
+ from semantic_kernel_nory import NoryPlugin
31
+
32
+ kernel = Kernel()
33
+ kernel.add_plugin(NoryPlugin(), "nory")
34
+ result = await kernel.invoke("nory", "crypto_prices", symbols="BTC,ETH")
35
+ ```
36
+
37
+ ## Functions
38
+ - `fetch_paid` - Fetch any URL with auto payment
39
+ - `crypto_prices` - Real-time crypto ($0.001)
40
+ - `weather` - Weather forecast ($0.002)
41
+ - `translate` - Translation ($0.005)
42
+ - `web_summary` - Extract webpage ($0.01)
43
+
44
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,27 @@
1
+ # semantic-kernel-nory
2
+
3
+ **Semantic Kernel plugins for x402 payments** - Let your agents pay for APIs.
4
+
5
+ ## Install
6
+ ```bash
7
+ pip install semantic-kernel-nory
8
+ ```
9
+
10
+ ## Usage
11
+ ```python
12
+ from semantic_kernel import Kernel
13
+ from semantic_kernel_nory import NoryPlugin
14
+
15
+ kernel = Kernel()
16
+ kernel.add_plugin(NoryPlugin(), "nory")
17
+ result = await kernel.invoke("nory", "crypto_prices", symbols="BTC,ETH")
18
+ ```
19
+
20
+ ## Functions
21
+ - `fetch_paid` - Fetch any URL with auto payment
22
+ - `crypto_prices` - Real-time crypto ($0.001)
23
+ - `weather` - Weather forecast ($0.002)
24
+ - `translate` - Translation ($0.005)
25
+ - `web_summary` - Extract webpage ($0.01)
26
+
27
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "semantic-kernel-nory"
7
+ version = "0.1.0"
8
+ description = "Semantic Kernel plugins for x402 payments - let agents pay for APIs"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [{name = "Nory", email = "hello@noryx402.com"}]
12
+ keywords = ["semantic-kernel", "microsoft", "ai-agents", "payments", "x402", "solana"]
13
+ classifiers = ["Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3"]
14
+ requires-python = ">=3.9"
15
+ dependencies = ["semantic-kernel>=1.0.0", "requests>=2.28.0"]
16
+
17
+ [project.urls]
18
+ Homepage = "https://noryx402.com"
19
+ Repository = "https://github.com/TheMemeBanker/semantic-kernel-nory"
20
+
21
+ [tool.setuptools.packages.find]
22
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ """Semantic Kernel Nory x402 Tools - Payment plugins for Microsoft Semantic Kernel."""
2
+ from semantic_kernel_nory.plugins import NoryPlugin
3
+ __version__ = "0.1.0"
4
+ __all__ = ["NoryPlugin"]
@@ -0,0 +1,56 @@
1
+ """Semantic Kernel plugins for Nory x402 payments."""
2
+ import os, json, requests
3
+ from typing import Annotated, Optional
4
+ from semantic_kernel.functions import kernel_function
5
+
6
+ NORY_BASE_URL = "https://noryx402.com"
7
+
8
+ def _make_paid_request(url: str, wallet_key: Optional[str] = None) -> dict:
9
+ key = wallet_key or os.environ.get("NORY_WALLET_KEY")
10
+ headers = {"Accept": "application/json"}
11
+ response = requests.get(url, headers=headers)
12
+ if response.status_code == 402:
13
+ if not key:
14
+ return {"error": "Payment required but no wallet key"}
15
+ requirements = response.json()
16
+ payment_response = requests.post(f"{NORY_BASE_URL}/api/x402/pay",
17
+ json={"requirements": requirements, "walletKey": key, "network": "solana-mainnet"},
18
+ headers={"Content-Type": "application/json"})
19
+ if payment_response.status_code != 200:
20
+ return {"error": "Payment failed"}
21
+ payment_data = payment_response.json()
22
+ headers["X-PAYMENT"] = payment_data.get("paymentHeader", "")
23
+ final_response = requests.get(url, headers=headers)
24
+ try:
25
+ return {"success": True, "data": final_response.json()}
26
+ except:
27
+ return {"success": True, "data": final_response.text}
28
+ try:
29
+ return {"success": True, "data": response.json()}
30
+ except:
31
+ return {"success": True, "data": response.text}
32
+
33
+ class NoryPlugin:
34
+ """Semantic Kernel plugin for x402 payments. Enables agents to pay for APIs."""
35
+ def __init__(self, wallet_key: Optional[str] = None):
36
+ self.wallet_key = wallet_key or os.environ.get("NORY_WALLET_KEY")
37
+
38
+ @kernel_function(name="fetch_paid", description="Fetch any URL with automatic x402 payment")
39
+ def fetch_paid(self, url: Annotated[str, "URL to fetch"]) -> str:
40
+ return json.dumps(_make_paid_request(url, self.wallet_key))
41
+
42
+ @kernel_function(name="crypto_prices", description="Get real-time crypto prices. $0.001 per request.")
43
+ def crypto_prices(self, symbols: Annotated[str, "Comma-separated symbols like BTC,ETH,SOL"] = "BTC,ETH,SOL") -> str:
44
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/live-crypto?symbols={symbols}", self.wallet_key))
45
+
46
+ @kernel_function(name="weather", description="Get weather and 7-day forecast. $0.002 per request.")
47
+ def weather(self, city: Annotated[str, "City name"]) -> str:
48
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/weather?city={city}", self.wallet_key))
49
+
50
+ @kernel_function(name="translate", description="Translate text between 20+ languages. $0.005 per request.")
51
+ def translate(self, text: Annotated[str, "Text to translate"], to_lang: Annotated[str, "Target language code"] = "es") -> str:
52
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/translate?text={text}&to={to_lang}", self.wallet_key))
53
+
54
+ @kernel_function(name="web_summary", description="Extract text from any webpage. $0.01 per request.")
55
+ def web_summary(self, url: Annotated[str, "URL to extract content from"]) -> str:
56
+ return json.dumps(_make_paid_request(f"{NORY_BASE_URL}/api/paid/web-summary?url={url}", self.wallet_key))
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.4
2
+ Name: semantic-kernel-nory
3
+ Version: 0.1.0
4
+ Summary: Semantic Kernel plugins for x402 payments - let agents pay for APIs
5
+ Author-email: Nory <hello@noryx402.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://noryx402.com
8
+ Project-URL: Repository, https://github.com/TheMemeBanker/semantic-kernel-nory
9
+ Keywords: semantic-kernel,microsoft,ai-agents,payments,x402,solana
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.9
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: semantic-kernel>=1.0.0
16
+ Requires-Dist: requests>=2.28.0
17
+
18
+ # semantic-kernel-nory
19
+
20
+ **Semantic Kernel plugins for x402 payments** - Let your agents pay for APIs.
21
+
22
+ ## Install
23
+ ```bash
24
+ pip install semantic-kernel-nory
25
+ ```
26
+
27
+ ## Usage
28
+ ```python
29
+ from semantic_kernel import Kernel
30
+ from semantic_kernel_nory import NoryPlugin
31
+
32
+ kernel = Kernel()
33
+ kernel.add_plugin(NoryPlugin(), "nory")
34
+ result = await kernel.invoke("nory", "crypto_prices", symbols="BTC,ETH")
35
+ ```
36
+
37
+ ## Functions
38
+ - `fetch_paid` - Fetch any URL with auto payment
39
+ - `crypto_prices` - Real-time crypto ($0.001)
40
+ - `weather` - Weather forecast ($0.002)
41
+ - `translate` - Translation ($0.005)
42
+ - `web_summary` - Extract webpage ($0.01)
43
+
44
+ Set `NORY_WALLET_KEY` env var. [Docs](https://noryx402.com)
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/semantic_kernel_nory/__init__.py
4
+ src/semantic_kernel_nory/plugins.py
5
+ src/semantic_kernel_nory.egg-info/PKG-INFO
6
+ src/semantic_kernel_nory.egg-info/SOURCES.txt
7
+ src/semantic_kernel_nory.egg-info/dependency_links.txt
8
+ src/semantic_kernel_nory.egg-info/requires.txt
9
+ src/semantic_kernel_nory.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ semantic-kernel>=1.0.0
2
+ requests>=2.28.0