You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix section "3-Bad Word Service" in e2e tutorial (#6425)
* Fix section "3-Bad Word Service" in e2e tutorial
The latest func cli generates a different Python function template than
shown in the tutorial. There is no setup.py anymore and the project
uses a toml file for configuration. The entire section was updated and
code was corrected.
The required func cli version `v0.46.0` was added to the tutorial with a
link to the GitHub func repository tags page.
The `solution-create-bad-word-filter-service.md` was removed because it
was identical to the `create-bad-word-filter-service.md`. All references
to it were removed.
Issue #6420.
Signed-off-by: Stanislav Jakuschevskij <[email protected]>
* Remove func version
Signed-off-by: Stanislav Jakuschevskij <[email protected]>
---------
Signed-off-by: Stanislav Jakuschevskij <[email protected]>
Copy file name to clipboardExpand all lines: docs/versioned/bookstore/page-2/sentiment-analysis-service-for-bookstore-reviews.md
+10-18Lines changed: 10 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,6 +43,7 @@ In order to do so, you need to install the func CLI. You can follow the [officia
43
43
???+ success "Verify"
44
44
Running `func version` in your terminal to verify the installation, and you should see the version of the func CLI you installed.
45
45
46
+
46
47
???+ bug "Troubleshooting"
47
48
If you see `command not found`, you may need to add the func CLI to your PATH.
48
49
@@ -206,9 +207,9 @@ The `sentiment-analysis-app/pyproject.toml` file contains the project configurat
206
207
Knative Function will automatically install the dependencies listed here when you build the function.
207
208
208
209
### **Step 4: Build and run your Knative Function locally (Optional)**
210
+
209
211
??? info "Click here to expand"
210
-
211
-
212
+
212
213

213
214
214
215
In Knative Function, there are two ways to build: using the [pack build](https://github.com/knative/func/blob/8f3f718a5a036aa6b6eaa9f70c03aeea740015b9/docs/reference/func_build.md?plain=1#L46){:target="_blank"} or using the [source-to-image (s2i) build](https://github.com/knative/func/blob/4f48549c8ad4dad34bf750db243d81d503f0090f/docs/reference/func_build.md?plain=1#L43){:target="_blank"}.
@@ -276,7 +277,7 @@ Knative Function will automatically install the dependencies listed here when yo
276
277
277
278
In this case, you will get the full CloudEvent response:
278
279
279
-
```
280
+
```sh
280
281
Context Attributes,
281
282
specversion: 1.0
282
283
type: new-review-comment
@@ -319,7 +320,7 @@ func deploy -b=s2i -v
319
320
Function deployed in namespace "default" and exposed at URL:
@@ -368,7 +368,7 @@ After deployment, the `func` CLI provides a URL to access your function. You can
368
368
369
369
Simply use Knative Function's command `func invoke` to directly send a CloudEvent to the function on your cluster:
370
370
371
-
```bash
371
+
```sh
372
372
func invoke -f=cloudevent --data='{"reviewText":"I love Knative so much"}' -v
373
373
```
374
374
@@ -380,7 +380,7 @@ func invoke -f=cloudevent --data='{"reviewText":"I love Knative so much"}' -v
380
380
381
381
If you see the response, it means that the function is running successfully.
382
382
383
-
```
383
+
```sh
384
384
Context Attributes,
385
385
specversion: 1.0
386
386
type: moderated-comment
@@ -399,23 +399,15 @@ func invoke -f=cloudevent --data='{"reviewText":"I love Knative so much"}' -v
399
399
}
400
400
```
401
401
402
+
## **Next Step**
403
+
402
404

403
405
404
406
In this tutorial, you learned how to create a serverless function for a simple sentiment analysis service with Knative.
405
407
406
-
## **Next Step**
407
-
408
-

409
-
410
-
Next, we'll deploy another ML service following the same procedure. We encourage you to try it yourself!
408
+
Next, we'll deploy another ML service following the same procedure.
411
409
412
410
!!! tip
413
411
Don't forget to `cd` into the root directory `/start` before proceeding.
414
412
415
-
If you feel comfortable deploying the other ML service yourself, follow this **simplified guide**:
416
-
417
413
[Go to Deploy ML workflow: Bad word filter :fontawesome-solid-paper-plane:](../page-3/create-bad-word-filter-service.md){ .md-button .md-button--primary }
418
-
419
-
If you encounter any issues, don't worry—we have a detailed tutorial ready for you.
420
-
421
-
[Solution - Go to Deploy ML workflow: Bad word filter :fontawesome-solid-paper-plane:](../page-3/solution-create-bad-word-filter-service.md){ .md-button .md-button--primary }
Copy file name to clipboardExpand all lines: docs/versioned/bookstore/page-3/create-bad-word-filter-service.md
+91-65Lines changed: 91 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,7 @@ function: tutorial
10
10
11
11

12
12
13
-
As a bookstore owner, you aim to receive instant notifications in a Slack channel whenever a customer submits a new negative review comment. By leveraging Knative Function, you can set up a serverless function that contains a simple bad word filter service to tell whether the text contains any hateful/insultive speech.
14
-
15
-
If you ever get stuck, check the solution here.
16
-
17
-
[Solution - Go to Deploy ML workflow: Bad word filter :fontawesome-solid-paper-plane:](../page-3/solution-create-bad-word-filter-service.md){ .md-button .md-button--primary }
13
+
As a bookstore owner, you aim to receive instant notifications in a Slack channel whenever a customer submits a new negative review comment. By leveraging Knative Function, you can set up a serverless function that contains a simple bad word filter service to tell whether the text contains any hateful/insulting speech.
### **Step 2: Replace the generated code with the bad word filter logic**
76
73
77
74

78
75
79
-
`bad-word-filter/func.py` is the file that contains the code for the function. You can replace the generated code with the bad word filter logic. You can use the following code as a starting point:
76
+
`bad-word-filter/function/func.py` is the file that contains the code for the function. You can replace the generated code with the bad word filter logic. You can use the following code as a starting point:
0 commit comments