upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgsovereignty <gsovereignty@proton.me>2023-07-08 18:51:30 +0800
committerGitHub <noreply@github.com>2023-07-08 18:51:30 +0800
commit667c700c1cab5106655df2de528e960b4875db0d (patch)
treeb338500bc0d1fe9db6fded41dfde8cd0d42b5f5a
parentce552554a08bb5b9878621abfdde3207d54cae62 (diff)
Problem: some of the language is inconsistent
-rw-r--r--vending-machine.md53
1 files changed, 27 insertions, 26 deletions
diff --git a/vending-machine.md b/vending-machine.md
index eb26688..2f9c064 100644
--- a/vending-machine.md
+++ b/vending-machine.md
@@ -27,7 +27,7 @@ A request to have data processed -- published by a customer
27 "kind": 68001, 27 "kind": 68001,
28 "content": "", 28 "content": "",
29 "tags": [ 29 "tags": [
30 // The type data processing the user wants to be performed 30 // The type of data processing the user wants to be performed
31 [ "j", "<job-type>", "<optional-model>" ], 31 [ "j", "<job-type>", "<optional-model>" ],
32 32
33 // input(s) for the job request 33 // input(s) for the job request
@@ -49,12 +49,12 @@ A request to have data processed -- published by a customer
49An optional, human-readable description of what this job is for. 49An optional, human-readable description of what this job is for.
50 50
51### `j` tag 51### `j` tag
52Specifies the job to be executed. A job request MUST have exactly one `j` tag. 52Specifies the job to be executed. A job request MUST have exactly one (1) `j` tag.
53 53
54A `j` tag MIGHT name a specific model to be used for the computed with as the second value. 54A `j` tag MAY include a second value specifying the name of a model to be used when computing the result.
55 55
56### `i` (input) tag 56### `i` (input) tag
57Specifies the input that the job should be executed with. The input is relay-indexable so that clients interested in the exact same job can find it it's result if it's already fulfilled. 57Specifies the input data that the job is to be executed against. The input is relay-indexable so that clients interested in the exact same job can find the input data and the result result (if it's already fulfilled).
58 58
59A job request CAN have zero or more inputs. 59A job request CAN have zero or more inputs.
60 60
@@ -64,50 +64,51 @@ A job request CAN have zero or more inputs.
64 * `url`: a URL to be fetched 64 * `url`: a URL to be fetched
65 * `event`: a nostr event ID 65 * `event`: a nostr event ID
66 * `job`: the output of a previous job with the specified event ID 66 * `job`: the output of a previous job with the specified event ID
67* `<marker>`: 67* `<marker>`: an optional field indicating where the data can be found if it is a subset of the provided values, for example the name of the key(s) in a key/value set, or the start and end positions of the data if it's a bytestream.
68 68
69### `bid` tag 69### `bid` tag
70The user MIGHT specify an amount of millisats they are willing to pay for the job to be processed. The user MIGHT also specify a maximum amount of millisats they are willing to pay. 70The Customer MAY specify a maximum amount (in millisats) they are willing to pay for the job to be processed.
71 71
72### `relays` tag 72### `relays` tag
73A list of relays the service provider should publish its job result to. 73The Service Provider SHOULD publish job results to the relays specified in this this tag.
74 74
75### `p` tags 75### `p` tags
76A user MIGHT want to explicitly request this job to be processed by specific service provider(s). Other service providers might still choose to compete for this job. 76If a Customer has a preference for specific Service Provider(s) to process this job, they SHOULD indicate this by including the Service Provider(s) pubkey in a `p` tag. This is NOT intended to exclude other Service Providers and they MAY still choose to compete for jobs that have not tagged them.
77 77
78### `exp` 78### `exp`
79A user might specify that they will not be interested in results past a certain time (e.g. a time-sensitive job whos value is no longer relevant after some time, like a live transcription service) 79A Customer MAY indicate that they will not pay for results produced after a specific Block height or Unix Timestamp. This is intended for time-sensitive jobs where the result is not relevant unless produced within a certain timeframe, e.g. a live transcription service.
80 80
81## Job result 81## Job result
82The output of processing the data -- published by the service provider. 82The output of processing the data -- published by the Service Provider.
83```json 83```json
84{ 84{
85 "pubkey": "service-provider", 85 "pubkey": "service-provider pubkey in hex",
86 86
87 // result 87 // result
88 "content": "<payload>", 88 "content": "string: <payload>",
89 "kind": 68002,
89 "tags" [ 90 "tags" [
90 // stringified JSON request event 91 // stringified JSON request event
91 [ "request", "<68001-event>" ], 92 [ "request", "<id-of-68001-event>" ],
92 [ "e", <id-of-68001-event>], 93 [ "e", "<id-of-68001-event>" ],
93 [ "p", "<job-requester's pubkey>" ], 94 [ "p", "<Customer's pubkey>" ],
94 [ "status", "success", "<more-info>"], 95 [ "status", "success", "<more-info>" ],
95 [ "amount", "requested-payment-amount" ] 96 [ "amount", "requested-payment-amount" ]
96 ] 97 ]
97} 98}
98``` 99```
99 100
100The result of the job should be in the `content`. If the output is not text, the `content` field should be empty and an `output` tag should be used instead as described below. 101The result of the job SHOULD be included in the `content` field. If the output is not text, the `content` field SHOULD be empty and an `output` tag should be used instead as described below.
101 102
102#### `status` tag 103#### `status` tag
103The service provider might want to return an error to the user in case the job could not be processed correctly 104The Service Provider MAY indicate errors during processing by including them in the `status` tag, these errors are intended to be consumed by the Customer.
104 105
105#### `amount` 106#### `amount`
106The amount of millisats the service provider is requesting to be paid. This amount MIGHT be different than the amount specified by the user in the `bid` tag. The amount SHOULD be less than the maximum amount specified by the user in the `bid` tag. 107The amount (in millisats) that the Service Provider is requesting to be paid. This amount MAY differ to the amount specified by the Customer in the `bid` tag. The amount SHOULD be less than the maximum amount specified by the user in the `bid` tag.
107 108
108## Job types 109## Job types
109 110
110This NIP defines some job types, clients SHOULD specify these types for maximum compatibility with service providers. Other job types might be added to this NIP. 111This NIP defines some example job types, Customers SHOULD specify these types for maximum compatibility with Service Providers. Other job types MAY be added to this NIP after being observed in the wild.
111 112
112### `speech-to-text` 113### `speech-to-text`
113#### params 114#### params
@@ -127,24 +128,24 @@ This NIP defines some job types, clients SHOULD specify these types for maximum
127| `language` | req | requested language in BCP 47 format. 128| `language` | req | requested language in BCP 47 format.
128 129
129# Protocol Flow 130# Protocol Flow
130* User publishes a job request 131* Customer publishes a job request
131`{ "kind": 68001, "tags": [ [ "j", "speech-to-text" ], ... ] }` 132`{ "kind": 68001, "tags": [ [ "j", "speech-to-text" ], ... ] }`
132 133
133* Service providers listen for the type of jobs they can perform 134* Service Providers subsribe to the type of jobs they can perform
134`{"kinds":[68001], "#j": ["speech-to-text", "image-generation", ... ]}` 135`{"kinds":[68001], "#j": ["speech-to-text", "image-generation", ... ]}`
135 136
136* When a job comes in, the service providers who opt to attempt to fulfill the request begin processing it, or they can react to it with feedback for the user (e.g. _payment required_, _unprocessable entity_, etc.) 137* When a job comes in, the Service Providers who opt to attempt to fulfill the request begin processing it, or they can react to it with feedback for the user (e.g. _payment required_, _unprocessable entity_, etc.)
137* Upon completion, the service provider publishes the result of the job with a `job-result` event. 138* Upon completion, the service provider publishes the result of the job with a `job-result` event.
138* Upon acceptance, the user zaps the service provider, tagging the job result event. 139* Upon acceptance, the user zaps the service provider, tagging the job result event.
139 140
140# Payment 141# Payment
141Customers SHOULD pay service providers whose job results they accept. Users should zap the service provider, tagging the `kind:68002` job result. 142Customers SHOULD pay service providers whose job results they accept by zapping the Service Provider and tagging the `kind:68002` job result.
142 143
143 144
144# Job chaining 145# Job chaining
145A customer CAN request multiple jobs to be chained, so that the output of a job can be the input of the next job. (e.g. summarization of a podcast's transcription). This is done by specifying as `input` an eventID of a different job with the `job` marker. 146A Customer MAY request multiple jobs to be processed in a chained form, so that the output of a job can be the input of the next job. (e.g. summarization of a podcast's transcription). This is done by specifying as `input` an eventID of a different job with the `job` marker.
146 147
147Service providers might opt to start processing a subsequent job the moment they see the prior job's result, or they might choose to wait for a zap to have been published. This introduces the risk that service provider of job #1 might delay publishing the zap event in order to have an advantage. This risk is up to service providers to mitigate or to decide whether the service provider of job#1 tends to have good-enough results so as to not wait for a explicit zap to assume the job was accepted. 148Service Providers MAY begin processing a subsequent job the moment they see the prior job's result, but they will likely wait for a zap to be published first. This introduces a risk that Service Provider of job #1 might delay publishing the zap event in order to have an advantage. This risk is up to Service Providers to mitigate or to decide whether the service provider of job #1 tends to have good-enough results so as to not wait for a explicit zap to assume the job was accepted.
148 149
149# Reactions 150# Reactions
150> **Warning** 151> **Warning**