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
> This tutorial does not work with Spin `v3.0` or above as the on disk representation of the models have changed. Refer to the [V3 tutorial](/spin/v3/ai-sentiment-analysis-api-tutorial) depending on your Spin version.
34
+
> This tutorial does not work with Spin `v3.0` or above as the on disk representation of the models have changed. Refer to the [V3 tutorial](/spin/v3/ai-sentiment-analysis-api-tutorial) depending on your Spin version.
35
35
36
36
Artificial Intelligence (AI) Inferencing performs well on GPUs. However, GPU infrastructure is both scarce and expensive. This tutorial will show you how to use Fermyon Serverless AI to quickly build advanced AI-enabled serverless applications that can run on Fermyon Cloud. Your applications will benefit from 50 millisecond cold start times and operate 100x faster than other on-demand AI infrastructure services. Take a quick look at the video below to learn about executing inferencing on LLMs with no extra setup.
37
37
@@ -45,9 +45,9 @@ In this tutorial we will:
45
45
46
46
## Tutorial Prerequisites
47
47
48
-
### Spin
48
+
### Spin
49
49
50
-
You will need to [install the latest version of Spin](install#installing-spin). Serverless AI is supported on Spin versions 1.5 and above.
50
+
You will need to [install the latest version of Spin](install#installing-spin). Serverless AI is supported on Spin versions 1.5 and above.
51
51
52
52
If you already have Spin installed, [check what version you are on and upgrade](upgrade#are-you-on-the-latest-version) if required.
> This tutorial uses [Meta AI](https://ai.meta.com/)'s Llama 2, Llama Chat and Code Llama models you will need to visit [Meta's Llama webpage](https://ai.meta.com/resources/models-and-libraries/llama-downloads/) and agree to Meta's License, Acceptable Use Policy, and to Meta’s privacy policy before fetching and using Llama models.
97
97
98
-
## Serverless AI Inferencing With Spin Applications
98
+
## Serverless AI Inferencing With Spin Applications
99
99
100
100
Now, let's dive deep into a comprehensive tutorial and unlock your potential to use Fermyon Serverless AI.
101
101
**Note:** The full source code with other examples can be found in our [Github repo](https://github.com/fermyon/ai-examples/tree/main)
@@ -804,9 +804,9 @@ We create an `assets` directory where we can store files to serve statically (se
804
804
$ mkdir assets
805
805
```
806
806
807
-
### Add the Front-End
807
+
### Add the Front-End
808
808
809
-
We can add a webpage that asks the user for some text and does the sentiment analysis on it. In your assets folder, create two files `dynamic.js` and `index.html`.
809
+
We can add a webpage that asks the user for some text and does the sentiment analysis on it. In your assets folder, create two files `dynamic.js` and `index.html`.
810
810
811
811
Here's the code snippet for `index.html`
812
812
@@ -880,7 +880,7 @@ Here's the code snippet for `index.html`
Deploying to the Fermyon Cloud is one simple command. If you have not logged into your Fermyon Cloud account already, the CLI will prompt you to login. Follow the instructions to complete the authorization process.
1077
+
Deploying to the Fermyon Cloud is one simple command. If you have not logged into your Fermyon Cloud account already, the CLI will prompt you to login. Follow the instructions to complete the authorization process.
You can find a complete example of using outbound HTTP in the JavaScript SDK repository on [GitHub](https://github.com/spinframework/spin-js-sdk/tree/sdk-v2/examples/common-patterns/outbound-http)
106
106
107
-
**Note**: `fetch` currently only works when building for the HTTP trigger.
107
+
**Note**: `fetch` currently only works when building for the HTTP trigger.
108
108
109
109
{{ blockEnd }}
110
110
@@ -132,13 +132,13 @@ You can find a complete example for using outbound HTTP in the [Python SDK repos
132
132
133
133
{{ startTab "TinyGo"}}
134
134
135
-
> [**Want to go straight to the reference documentation?** Find it here.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2@v2.0.0/http)
135
+
> [**Want to go straight to the reference documentation?** Find it here.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2@v2.2.1/http)
136
136
137
-
HTTP functions are available in the `github.com/fermyon/spin/sdk/go/v2/http` package. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2/http) The general function is named `Send`, but the Go SDK also surfaces individual functions, with request-specific parameters, for the `Get` and `Post` operations. For example:
137
+
HTTP functions are available in the `github.com/spinframework/spin-go-sdk/v2/http` package. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2/http) The general function is named `Send`, but the Go SDK also surfaces individual functions, with request-specific parameters, for the `Get` and `Post` operations. For example:
Copy file name to clipboardExpand all lines: content/v2/http-trigger.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ For example, suppose the application `base` path is `base = "/shop"`. Then a tr
104
104
### Resolving Overlapping Routes
105
105
106
106
If multiple triggers could potentially handle the same request based on their
107
-
defined routes, the trigger whose route has the longest matching prefix
107
+
defined routes, the trigger whose route has the longest matching prefix
108
108
takes precedence. This also means that exact matches take precedence over wildcard matches.
109
109
110
110
In the following example, requests starting with the `/users/` prefix (e.g. `/users/1`)
@@ -305,7 +305,7 @@ class IncomingHandler(http.IncomingHandler):
305
305
306
306
{{ startTab "TinyGo"}}
307
307
308
-
> [**Want to go straight to the reference documentation?** Find it here.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2@v2.0.0/http)
308
+
> [**Want to go straight to the reference documentation?** Find it here.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2@v2.2.1/http)
309
309
310
310
In Go, you register the handler as a callback in your program's `init` function. Call `spinhttp.Handle`, passing your handler as the sole argument. Your handler takes a `http.Request` record, from the standard `net/http` package, and a `ResponseWriter` to construct the response.
@@ -507,7 +507,7 @@ When exposing HTTP triggers using HTTPS you must provide `spin up` with a TLS ce
507
507
508
508
The `spin up` command's `--tls-cert` and `--tls-key` trigger options provide a way for you to specify both a TLS certificate and a private key (whilst running the `spin up` command).
509
509
510
-
The `--tls-cert` option specifies the path to the TLS certificate to use for HTTPS, if this is not set, normal HTTP will be used. The certificate should be in PEM format.
510
+
The `--tls-cert` option specifies the path to the TLS certificate to use for HTTPS, if this is not set, normal HTTP will be used. The certificate should be in PEM format.
511
511
512
512
The `--tls-key` option specifies the path to the private key to use for HTTPS, if this is not set, normal HTTP will be used. The key should be in PKCS#8 format. For more information, please see the [Spin CLI Reference](./cli-reference#trigger-options).
Copy file name to clipboardExpand all lines: content/v2/key-value-store-tutorial.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ $ spin new -t http-go spin-key-value
109
109
110
110
## Configuration
111
111
112
-
Good news - Spin will take care of setting up your Key Value store. However, in order to make sure your Spin application has permission to access the Key Value store, you must add the `key_value_stores = ["default"]` line in the `[component.<component-name>]` section of the `spin.toml` file, for each component which needs access to the Key Value store. This line is necessary to communicate to Spin that a given component has access to the default Key Value store. A newly scaffolded Spin application will not have this line; you will need to add it.
112
+
Good news - Spin will take care of setting up your Key Value store. However, in order to make sure your Spin application has permission to access the Key Value store, you must add the `key_value_stores = ["default"]` line in the `[component.<component-name>]` section of the `spin.toml` file, for each component which needs access to the Key Value store. This line is necessary to communicate to Spin that a given component has access to the default Key Value store. A newly scaffolded Spin application will not have this line; you will need to add it.
113
113
114
114
> Note: `[component.spin_key_value]` contains the name of the component. If you used a different name, when creating the application, this sections name would be different.
In this section, we use the Spin SDK to open and persist our application's data inside our default key/value store. This is a special store that every environment running Spin applications will make available for their application.
153
+
In this section, we use the Spin SDK to open and persist our application's data inside our default key/value store. This is a special store that every environment running Spin applications will make available for their application.
- For set, the value argument can be of any type that implements `AsRef<[u8]>`
@@ -129,7 +129,7 @@ class IncomingHandler(http.IncomingHandler):
129
129
with key_value.open_default() as store:
130
130
store.set("test", bytes("hello world!", "utf-8"))
131
131
val = store.get("test")
132
-
132
+
133
133
return Response(
134
134
200,
135
135
{"content-type": "text/plain"},
@@ -148,12 +148,12 @@ class IncomingHandler(http.IncomingHandler):
148
148
149
149
{{ startTab "TinyGo"}}
150
150
151
-
> [**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2@v2.0.0/kv)
151
+
> [**Want to go straight to the Spin SDK reference documentation?** Find it here.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2@v2.2.1/kv)
152
152
153
-
Key value functions are provided by the `github.com/fermyon/spin/sdk/go/v2/kv` module. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2/kv) For example:
153
+
Key value functions are provided by the `github.com/spinframework/spin-go-sdk/v2/kv` module. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2/kv) For example:
Copy file name to clipboardExpand all lines: content/v2/language-support-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ This page contains information about language support for Spin features:
85
85
86
86
{{ startTab "TinyGo"}}
87
87
88
-
**[📄 Visit the TinyGo Spin SDK reference documentation](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2) to see specific modules, functions, variables and syntax relating to the following TinyGo SDK.**
88
+
**[📄 Visit the TinyGo Spin SDK reference documentation](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2) to see specific modules, functions, variables and syntax relating to the following TinyGo SDK.**
@@ -529,7 +529,7 @@ The `hello-python` directory structure created by the Spin `http-py` template is
529
529
```text
530
530
├── app.py
531
531
├── spin.toml
532
-
└── requirements.txt
532
+
└── requirements.txt
533
533
```
534
534
535
535
The additional `spin.toml` file is the manifest file, which tells Spin what events should trigger what components. In this case our trigger is HTTP, for a Web application, and we have only one component, at the route `/...`. This is a wildcard that matches any route.
with mysql.open("mysql://root:@127.0.0.1/spin_dev") as db:
119
119
print(db.query("select * from test", []))
120
-
120
+
121
121
return Response(
122
122
200,
123
123
{"content-type": "text/plain"},
@@ -129,9 +129,9 @@ class IncomingHandler(http.IncomingHandler):
129
129
130
130
{{ startTab "TinyGo"}}
131
131
132
-
> [**Want to go straight to the reference documentation?** Find it here.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2)
132
+
> [**Want to go straight to the reference documentation?** Find it here.](github.com/spinframework/spin-go-sdk/v2)
133
133
134
-
MySQL functions are available in the `github.com/fermyon/spin/sdk/go/v2/mysql` package, and PostgreSQL in `github.com/fermyon/spin/sdk/go/v2/pg`. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/fermyon/spin/sdk/go/v2)
134
+
MySQL functions are available in the `github.com/spinframework/spin-go-sdk/v2/mysql` package, and PostgreSQL in `github.com/spinframework/spin-go-sdk/v2/pg`. [See Go Packages for reference documentation.](https://pkg.go.dev/github.com/spinframework/spin-go-sdk/v2)
135
135
136
136
The package follows the usual Go database API. Use `Open` to return a connection to the database of type `*sql.DB` - see the [Go standard library documentation](https://pkg.go.dev/database/sql#DB) for usage information. For example:
0 commit comments