agentstr 0.1.10__tar.gz → 0.1.11__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- agentstr-0.1.11/MANIFEST.in +3 -0
- {agentstr-0.1.10/src/agentstr.egg-info → agentstr-0.1.11}/PKG-INFO +41 -28
- {agentstr-0.1.10 → agentstr-0.1.11}/README.md +37 -4
- {agentstr-0.1.10 → agentstr-0.1.11}/pyproject.toml +6 -9
- {agentstr-0.1.10 → agentstr-0.1.11/src/agentstr.egg-info}/PKG-INFO +41 -28
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr.egg-info/SOURCES.txt +0 -3
- agentstr-0.1.10/MANIFEST.in +0 -5
- agentstr-0.1.10/src/agentstr/examples/basic_cli/.env.example +0 -2
- agentstr-0.1.10/src/agentstr/examples/basic_cli/README.md +0 -11
- agentstr-0.1.10/src/agentstr/examples/basic_cli/main.py +0 -193
- {agentstr-0.1.10 → agentstr-0.1.11}/LICENSE +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/setup.cfg +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr/__init__.py +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr/marketplace.py +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr/nostr.py +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr.egg-info/dependency_links.txt +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr.egg-info/requires.txt +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/src/agentstr.egg-info/top_level.txt +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/tests/test_merchant.py +0 -0
- {agentstr-0.1.10 → agentstr-0.1.11}/tests/test_nostr.py +0 -0
@@ -1,31 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: agentstr
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11
|
4
4
|
Summary: Nostr extension for Phidata AI agents
|
5
5
|
Author-email: Synvya <info@synvya.com>
|
6
|
-
License: MIT
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
|
-
Project-URL: Homepage, https://github.com/synvya/agentstr
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://www.synvya.com
|
8
|
+
Project-URL: Repository, https://github.com/synvya/agentstr
|
29
9
|
Project-URL: Documentation, https://github.com/synvya/agentstr#readme
|
30
10
|
Project-URL: BugTracker, https://github.com/synvya/agentstr/issues
|
31
11
|
Requires-Python: <3.13,>=3.9
|
@@ -100,15 +80,48 @@ pip install agentstr
|
|
100
80
|
|
101
81
|
## Examples
|
102
82
|
|
103
|
-
|
83
|
+
You can find example code in the [examples](https://github.com/Synvya/agentstr/tree/main/examples/) directory.
|
104
84
|
|
105
|
-
|
85
|
+
### Instaling the examples
|
86
|
+
1. **Clone the repository**
|
87
|
+
```bash
|
88
|
+
git clone https://github.com/Synvya/agentstr.git
|
89
|
+
```
|
90
|
+
|
91
|
+
### Basic CLI Example
|
92
|
+
A simple command-line interface demonstrating agentstr's merchant capabilities:
|
93
|
+
|
94
|
+
|
95
|
+
- [Basic CLI Agent](https://github.com/Synvya/agentstr/tree/main/src/agentstr/examples/basic_cli/main.py) - A complete example showing:
|
106
96
|
- Setting up merchant profiles
|
107
97
|
- Creating stalls with shipping methods
|
108
98
|
- Defining products with shipping costs
|
109
99
|
- Configuring the agent with the merchant toolkit
|
110
100
|
- Running an interactive CLI application
|
111
101
|
|
102
|
+
1. ** Create a virtual environment**
|
103
|
+
```bash
|
104
|
+
cd agentstr/examples/basic_cli
|
105
|
+
python3 -m venv venv
|
106
|
+
source venv/bin/activate
|
107
|
+
```
|
108
|
+
|
109
|
+
2. ** Install dependencies**
|
110
|
+
```bash
|
111
|
+
pip install -r requirements.txt
|
112
|
+
```
|
113
|
+
|
114
|
+
3. ** Configure your environment**
|
115
|
+
```bash
|
116
|
+
cp .env.example .env
|
117
|
+
```
|
118
|
+
**Edit the .env file with your own API keys and Nostr credentials**
|
119
|
+
|
120
|
+
4. ** Run the example**
|
121
|
+
```bash
|
122
|
+
python main.py
|
123
|
+
```
|
124
|
+
|
112
125
|
|
113
126
|
## Documentation
|
114
127
|
|
@@ -116,14 +129,14 @@ For more detailed documentation and examples, see [Docs](https://github.com/Synv
|
|
116
129
|
|
117
130
|
## Development
|
118
131
|
|
119
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
132
|
+
See [CONTRIBUTING.md](https://github.com/Synvya/agentstr/blob/main/CONTRIBUTING.md) for:
|
120
133
|
- Development setup
|
121
134
|
- Testing instructions
|
122
135
|
- Contribution guidelines
|
123
136
|
|
124
137
|
## License
|
125
138
|
|
126
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
139
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Synvya/agentstr/blob/main/LICENSE) file for details.
|
127
140
|
|
128
141
|
## Acknowledgments
|
129
142
|
|
@@ -55,15 +55,48 @@ pip install agentstr
|
|
55
55
|
|
56
56
|
## Examples
|
57
57
|
|
58
|
-
|
58
|
+
You can find example code in the [examples](https://github.com/Synvya/agentstr/tree/main/examples/) directory.
|
59
59
|
|
60
|
-
|
60
|
+
### Instaling the examples
|
61
|
+
1. **Clone the repository**
|
62
|
+
```bash
|
63
|
+
git clone https://github.com/Synvya/agentstr.git
|
64
|
+
```
|
65
|
+
|
66
|
+
### Basic CLI Example
|
67
|
+
A simple command-line interface demonstrating agentstr's merchant capabilities:
|
68
|
+
|
69
|
+
|
70
|
+
- [Basic CLI Agent](https://github.com/Synvya/agentstr/tree/main/src/agentstr/examples/basic_cli/main.py) - A complete example showing:
|
61
71
|
- Setting up merchant profiles
|
62
72
|
- Creating stalls with shipping methods
|
63
73
|
- Defining products with shipping costs
|
64
74
|
- Configuring the agent with the merchant toolkit
|
65
75
|
- Running an interactive CLI application
|
66
76
|
|
77
|
+
1. ** Create a virtual environment**
|
78
|
+
```bash
|
79
|
+
cd agentstr/examples/basic_cli
|
80
|
+
python3 -m venv venv
|
81
|
+
source venv/bin/activate
|
82
|
+
```
|
83
|
+
|
84
|
+
2. ** Install dependencies**
|
85
|
+
```bash
|
86
|
+
pip install -r requirements.txt
|
87
|
+
```
|
88
|
+
|
89
|
+
3. ** Configure your environment**
|
90
|
+
```bash
|
91
|
+
cp .env.example .env
|
92
|
+
```
|
93
|
+
**Edit the .env file with your own API keys and Nostr credentials**
|
94
|
+
|
95
|
+
4. ** Run the example**
|
96
|
+
```bash
|
97
|
+
python main.py
|
98
|
+
```
|
99
|
+
|
67
100
|
|
68
101
|
## Documentation
|
69
102
|
|
@@ -71,14 +104,14 @@ For more detailed documentation and examples, see [Docs](https://github.com/Synv
|
|
71
104
|
|
72
105
|
## Development
|
73
106
|
|
74
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
107
|
+
See [CONTRIBUTING.md](https://github.com/Synvya/agentstr/blob/main/CONTRIBUTING.md) for:
|
75
108
|
- Development setup
|
76
109
|
- Testing instructions
|
77
110
|
- Contribution guidelines
|
78
111
|
|
79
112
|
## License
|
80
113
|
|
81
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
114
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Synvya/agentstr/blob/main/LICENSE) file for details.
|
82
115
|
|
83
116
|
## Acknowledgments
|
84
117
|
|
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "agentstr"
|
7
|
-
version = "0.1.
|
7
|
+
version = "0.1.11"
|
8
8
|
description = "Nostr extension for Phidata AI agents"
|
9
9
|
readme = "README.md"
|
10
10
|
requires-python = ">=3.9, <3.13"
|
11
|
-
license = {
|
11
|
+
license = { text = "MIT" }
|
12
12
|
authors = [
|
13
|
-
{name = "Synvya", email = "info@synvya.com"}
|
13
|
+
{name = "Synvya", email = "info@synvya.com"}
|
14
14
|
]
|
15
15
|
dependencies = [
|
16
16
|
"phidata>=2.7.0",
|
@@ -30,17 +30,14 @@ dev = [
|
|
30
30
|
]
|
31
31
|
|
32
32
|
[project.urls]
|
33
|
-
Homepage = "https://
|
33
|
+
Homepage = "https://www.synvya.com"
|
34
|
+
Repository = "https://github.com/synvya/agentstr"
|
34
35
|
Documentation = "https://github.com/synvya/agentstr#readme"
|
35
36
|
BugTracker = "https://github.com/synvya/agentstr/issues"
|
36
37
|
|
37
38
|
[tool.setuptools]
|
38
39
|
package-dir = {"" = "src"}
|
39
|
-
packages = [
|
40
|
-
"agentstr",
|
41
|
-
"agentstr.examples",
|
42
|
-
"agentstr.examples.basic_cli"
|
43
|
-
]
|
40
|
+
packages = ["agentstr"]
|
44
41
|
|
45
42
|
[tool.black]
|
46
43
|
line-length = 88
|
@@ -1,31 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: agentstr
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.11
|
4
4
|
Summary: Nostr extension for Phidata AI agents
|
5
5
|
Author-email: Synvya <info@synvya.com>
|
6
|
-
License: MIT
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
|
28
|
-
Project-URL: Homepage, https://github.com/synvya/agentstr
|
6
|
+
License: MIT
|
7
|
+
Project-URL: Homepage, https://www.synvya.com
|
8
|
+
Project-URL: Repository, https://github.com/synvya/agentstr
|
29
9
|
Project-URL: Documentation, https://github.com/synvya/agentstr#readme
|
30
10
|
Project-URL: BugTracker, https://github.com/synvya/agentstr/issues
|
31
11
|
Requires-Python: <3.13,>=3.9
|
@@ -100,15 +80,48 @@ pip install agentstr
|
|
100
80
|
|
101
81
|
## Examples
|
102
82
|
|
103
|
-
|
83
|
+
You can find example code in the [examples](https://github.com/Synvya/agentstr/tree/main/examples/) directory.
|
104
84
|
|
105
|
-
|
85
|
+
### Instaling the examples
|
86
|
+
1. **Clone the repository**
|
87
|
+
```bash
|
88
|
+
git clone https://github.com/Synvya/agentstr.git
|
89
|
+
```
|
90
|
+
|
91
|
+
### Basic CLI Example
|
92
|
+
A simple command-line interface demonstrating agentstr's merchant capabilities:
|
93
|
+
|
94
|
+
|
95
|
+
- [Basic CLI Agent](https://github.com/Synvya/agentstr/tree/main/src/agentstr/examples/basic_cli/main.py) - A complete example showing:
|
106
96
|
- Setting up merchant profiles
|
107
97
|
- Creating stalls with shipping methods
|
108
98
|
- Defining products with shipping costs
|
109
99
|
- Configuring the agent with the merchant toolkit
|
110
100
|
- Running an interactive CLI application
|
111
101
|
|
102
|
+
1. ** Create a virtual environment**
|
103
|
+
```bash
|
104
|
+
cd agentstr/examples/basic_cli
|
105
|
+
python3 -m venv venv
|
106
|
+
source venv/bin/activate
|
107
|
+
```
|
108
|
+
|
109
|
+
2. ** Install dependencies**
|
110
|
+
```bash
|
111
|
+
pip install -r requirements.txt
|
112
|
+
```
|
113
|
+
|
114
|
+
3. ** Configure your environment**
|
115
|
+
```bash
|
116
|
+
cp .env.example .env
|
117
|
+
```
|
118
|
+
**Edit the .env file with your own API keys and Nostr credentials**
|
119
|
+
|
120
|
+
4. ** Run the example**
|
121
|
+
```bash
|
122
|
+
python main.py
|
123
|
+
```
|
124
|
+
|
112
125
|
|
113
126
|
## Documentation
|
114
127
|
|
@@ -116,14 +129,14 @@ For more detailed documentation and examples, see [Docs](https://github.com/Synv
|
|
116
129
|
|
117
130
|
## Development
|
118
131
|
|
119
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
132
|
+
See [CONTRIBUTING.md](https://github.com/Synvya/agentstr/blob/main/CONTRIBUTING.md) for:
|
120
133
|
- Development setup
|
121
134
|
- Testing instructions
|
122
135
|
- Contribution guidelines
|
123
136
|
|
124
137
|
## License
|
125
138
|
|
126
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
139
|
+
This project is licensed under the MIT License - see the [LICENSE](https://github.com/Synvya/agentstr/blob/main/LICENSE) file for details.
|
127
140
|
|
128
141
|
## Acknowledgments
|
129
142
|
|
@@ -10,8 +10,5 @@ src/agentstr.egg-info/SOURCES.txt
|
|
10
10
|
src/agentstr.egg-info/dependency_links.txt
|
11
11
|
src/agentstr.egg-info/requires.txt
|
12
12
|
src/agentstr.egg-info/top_level.txt
|
13
|
-
src/agentstr/examples/basic_cli/.env.example
|
14
|
-
src/agentstr/examples/basic_cli/README.md
|
15
|
-
src/agentstr/examples/basic_cli/main.py
|
16
13
|
tests/test_merchant.py
|
17
14
|
tests/test_nostr.py
|
agentstr-0.1.10/MANIFEST.in
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Basic CLI Agent Example
|
2
|
-
|
3
|
-
This example demonstrates a complete setup of a merchant agent with:
|
4
|
-
- Multiple stalls (Hardware Store and Trade School)
|
5
|
-
- Multiple products per stall
|
6
|
-
- Different shipping zones and costs
|
7
|
-
- Interactive CLI interface
|
8
|
-
|
9
|
-
## Setup
|
10
|
-
|
11
|
-
1. Copy `.env.example` to `.env` and fill in your keys:
|
@@ -1,193 +0,0 @@
|
|
1
|
-
from os import getenv
|
2
|
-
from pathlib import Path
|
3
|
-
from typing import List, Tuple
|
4
|
-
|
5
|
-
import httpx
|
6
|
-
from dotenv import load_dotenv
|
7
|
-
from phi.agent import Agent # type: ignore
|
8
|
-
from phi.model.openai import OpenAIChat # type: ignore
|
9
|
-
|
10
|
-
from agentstr.marketplace import (
|
11
|
-
Merchant,
|
12
|
-
MerchantProduct,
|
13
|
-
MerchantStall,
|
14
|
-
Profile,
|
15
|
-
ShippingCost,
|
16
|
-
ShippingMethod,
|
17
|
-
)
|
18
|
-
|
19
|
-
load_dotenv()
|
20
|
-
|
21
|
-
RELAY = "wss://relay.damus.io"
|
22
|
-
|
23
|
-
# --*-- Merchant info
|
24
|
-
MERCHANT_NAME = "Merchant 1"
|
25
|
-
MERCHANT_DESCRIPTION = "Selling products peer to peer"
|
26
|
-
MERCHANT_PICTURE = "https://i.nostr.build/ocjZ5GlAKwrvgRhx.png"
|
27
|
-
|
28
|
-
# --*-- Stall info
|
29
|
-
STALL_1_NAME = "The Hardware Store"
|
30
|
-
STALL_1_ID = "212au4Pi" # "212a26qV"
|
31
|
-
STALL_1_DESCRIPTION = "Your neighborhood hardware store, now available online."
|
32
|
-
STALL_1_CURRENCY = "Sats"
|
33
|
-
|
34
|
-
STALL_2_NAME = "The Trade School"
|
35
|
-
STALL_2_ID = "c8762EFD"
|
36
|
-
STALL_2_DESCRIPTION = (
|
37
|
-
"Educational videos to put all your hardware supplies to good use."
|
38
|
-
)
|
39
|
-
STALL_2_CURRENCY = "Sats"
|
40
|
-
|
41
|
-
# --*-- Shipping info
|
42
|
-
SHIPPING_ZONE_1_NAME = "North America"
|
43
|
-
SHIPPING_ZONE_1_ID = "64be11rM"
|
44
|
-
SHIPPING_ZONE_1_REGIONS = ["Canada", "Mexico", "USA"]
|
45
|
-
|
46
|
-
SHIPPING_ZONE_2_NAME = "Rest of the World"
|
47
|
-
SHIPPING_ZONE_2_ID = "d041HK7s"
|
48
|
-
SHIPPING_ZONE_2_REGIONS = ["All other countries"]
|
49
|
-
|
50
|
-
SHIPPING_ZONE_3_NAME = "Worldwide"
|
51
|
-
SHIPPING_ZONE_3_ID = "R8Gzz96K"
|
52
|
-
SHIPPING_ZONE_3_REGIONS = ["Worldwide"]
|
53
|
-
|
54
|
-
# --*-- Product info
|
55
|
-
PRODUCT_1_NAME = "Wrench"
|
56
|
-
PRODUCT_1_ID = "bcf00Rx7"
|
57
|
-
PRODUCT_1_DESCRIPTION = "The perfect tool for a $5 wrench attack."
|
58
|
-
PRODUCT_1_IMAGES = ["https://i.nostr.build/BddyYILz0rjv1wEY.png"]
|
59
|
-
PRODUCT_1_CURRENCY = STALL_1_CURRENCY
|
60
|
-
PRODUCT_1_PRICE = 5000
|
61
|
-
PRODUCT_1_QUANTITY = 100
|
62
|
-
|
63
|
-
PRODUCT_2_NAME = "Shovel"
|
64
|
-
PRODUCT_2_ID = "bcf00Rx8"
|
65
|
-
PRODUCT_2_DESCRIPTION = "Dig holes like never before"
|
66
|
-
PRODUCT_2_IMAGES = ["https://i.nostr.build/psL0ZtN4FZcmeiIh.png"]
|
67
|
-
PRODUCT_2_CURRENCY = STALL_1_CURRENCY
|
68
|
-
PRODUCT_2_PRICE = 10000
|
69
|
-
PRODUCT_2_QUANTITY = 10
|
70
|
-
|
71
|
-
PRODUCT_3_NAME = "Shovel 101"
|
72
|
-
PRODUCT_3_ID = "ccf00Rx1"
|
73
|
-
PRODUCT_3_DESCRIPTION = "How to dig your own grave"
|
74
|
-
PRODUCT_3_IMAGES = ["https://i.nostr.build/psL0ZtN4FZcmeiIh.png"]
|
75
|
-
PRODUCT_3_CURRENCY = STALL_2_CURRENCY
|
76
|
-
PRODUCT_3_PRICE = 1000
|
77
|
-
PRODUCT_3_QUANTITY = 1000
|
78
|
-
|
79
|
-
# --*-- Define Shipping methods for stalls (nostr SDK type)
|
80
|
-
shipping_method_1 = (
|
81
|
-
ShippingMethod(id=SHIPPING_ZONE_1_ID, cost=5000)
|
82
|
-
.name(SHIPPING_ZONE_1_NAME)
|
83
|
-
.regions(SHIPPING_ZONE_1_REGIONS)
|
84
|
-
)
|
85
|
-
|
86
|
-
shipping_method_2 = (
|
87
|
-
ShippingMethod(id=SHIPPING_ZONE_2_ID, cost=5000)
|
88
|
-
.name(SHIPPING_ZONE_2_NAME)
|
89
|
-
.regions(SHIPPING_ZONE_2_REGIONS)
|
90
|
-
)
|
91
|
-
|
92
|
-
shipping_method_3 = (
|
93
|
-
ShippingMethod(id=SHIPPING_ZONE_3_ID, cost=0)
|
94
|
-
.name(SHIPPING_ZONE_3_NAME)
|
95
|
-
.regions(SHIPPING_ZONE_3_REGIONS)
|
96
|
-
)
|
97
|
-
|
98
|
-
# --*-- Define Shipping costs for products (nostr SDK type)
|
99
|
-
shipping_cost_1 = ShippingCost(id=SHIPPING_ZONE_1_ID, cost=1000)
|
100
|
-
shipping_cost_2 = ShippingCost(id=SHIPPING_ZONE_2_ID, cost=2000)
|
101
|
-
shipping_cost_3 = ShippingCost(id=SHIPPING_ZONE_3_ID, cost=3000)
|
102
|
-
|
103
|
-
# --*-- define stalls (using ShippingMethod)
|
104
|
-
test_stall_1 = MerchantStall(
|
105
|
-
id=STALL_1_ID,
|
106
|
-
name=STALL_1_NAME,
|
107
|
-
description=STALL_1_DESCRIPTION,
|
108
|
-
currency=STALL_1_CURRENCY,
|
109
|
-
shipping=[shipping_method_1, shipping_method_2],
|
110
|
-
)
|
111
|
-
|
112
|
-
test_stall_2 = MerchantStall(
|
113
|
-
id=STALL_2_ID,
|
114
|
-
name=STALL_2_NAME,
|
115
|
-
description=STALL_2_DESCRIPTION,
|
116
|
-
currency=STALL_2_CURRENCY,
|
117
|
-
shipping=[shipping_method_3], # Uses ShippingMethod
|
118
|
-
)
|
119
|
-
|
120
|
-
# --*-- define products (using ShippingZone)
|
121
|
-
test_product_1 = MerchantProduct(
|
122
|
-
id=PRODUCT_1_ID,
|
123
|
-
stall_id=STALL_1_ID,
|
124
|
-
name=PRODUCT_1_NAME,
|
125
|
-
description=PRODUCT_1_DESCRIPTION,
|
126
|
-
images=PRODUCT_1_IMAGES,
|
127
|
-
currency=PRODUCT_1_CURRENCY,
|
128
|
-
price=PRODUCT_1_PRICE,
|
129
|
-
quantity=PRODUCT_1_QUANTITY,
|
130
|
-
shipping=[shipping_cost_1, shipping_cost_2],
|
131
|
-
categories=None,
|
132
|
-
specs=[], # List of lists of strings, e.g. [["Color", "Red"], ["Size", "Large"]]
|
133
|
-
)
|
134
|
-
|
135
|
-
test_product_2 = MerchantProduct(
|
136
|
-
id=PRODUCT_2_ID,
|
137
|
-
stall_id=STALL_1_ID,
|
138
|
-
name=PRODUCT_2_NAME,
|
139
|
-
description=PRODUCT_2_DESCRIPTION,
|
140
|
-
images=PRODUCT_2_IMAGES,
|
141
|
-
currency=PRODUCT_2_CURRENCY,
|
142
|
-
price=PRODUCT_2_PRICE,
|
143
|
-
quantity=PRODUCT_2_QUANTITY,
|
144
|
-
shipping=[shipping_cost_1, shipping_cost_2],
|
145
|
-
categories=None,
|
146
|
-
specs=[], # List of lists of strings
|
147
|
-
)
|
148
|
-
|
149
|
-
test_product_3 = MerchantProduct(
|
150
|
-
id=PRODUCT_3_ID,
|
151
|
-
stall_id=STALL_2_ID,
|
152
|
-
name=PRODUCT_3_NAME,
|
153
|
-
description=PRODUCT_3_DESCRIPTION,
|
154
|
-
images=PRODUCT_3_IMAGES,
|
155
|
-
currency=PRODUCT_3_CURRENCY,
|
156
|
-
price=PRODUCT_3_PRICE,
|
157
|
-
quantity=PRODUCT_3_QUANTITY,
|
158
|
-
shipping=[shipping_cost_3],
|
159
|
-
categories=None,
|
160
|
-
specs=[], # List of lists of strings
|
161
|
-
)
|
162
|
-
|
163
|
-
nsec = getenv("NSEC_BASIC_CLI_KEY")
|
164
|
-
if nsec:
|
165
|
-
print(f"nsec: {nsec}")
|
166
|
-
else:
|
167
|
-
print(f"No NSEC found")
|
168
|
-
|
169
|
-
|
170
|
-
test_merchant = Profile(MERCHANT_NAME, MERCHANT_DESCRIPTION, MERCHANT_PICTURE, nsec)
|
171
|
-
|
172
|
-
|
173
|
-
agent = Agent( # type: ignore[call-arg]
|
174
|
-
name="Merchant Assistant",
|
175
|
-
model=OpenAIChat(id="gpt-4o"),
|
176
|
-
tools=[
|
177
|
-
Merchant(
|
178
|
-
merchant_profile=test_merchant,
|
179
|
-
relay=RELAY,
|
180
|
-
stalls=[test_stall_1, test_stall_2],
|
181
|
-
products=[test_product_1, test_product_2, test_product_3],
|
182
|
-
)
|
183
|
-
],
|
184
|
-
show_tool_calls=True,
|
185
|
-
debug_mode=True,
|
186
|
-
async_mode=True,
|
187
|
-
instructions=[
|
188
|
-
"The Merchant Toolkit functions return JSON arrays. Provide these JSON arrays back to the console as output."
|
189
|
-
],
|
190
|
-
)
|
191
|
-
|
192
|
-
# agent.print_response("List the products of the merchant")
|
193
|
-
agent.cli_app(stream=False)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|