Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions configure-environment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ title: Configure Environment
description: "Define environment parameters for your app"
---

On your first deployment, and when you add new hosts thereafter, you may need to
adjust the configuration of your environment for your app to be ready for
traffic.
On your first deployment, and when you add new connections thereafter, you may
need to adjust the configuration of your environment for your app to be ready
for traffic.

## Host secrets
## Connection secrets

If you included parameters for Host Secrets in your
If you included parameters for Connection Secrets in your
[app manifest](/modus/app-manifest), you'll need to add the parameter values in
the Hypermode Console.

From your project home, navigate to **Settings** → **Hosts**. Add the values for
your defined host authentication parameters.
From your project home, navigate to **Settings** → **Connections**. Add the
values for your defined connection authentication parameters.

## Model hosting

Expand Down
6 changes: 3 additions & 3 deletions getting-started-with-hyper-commerce.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ In the Hypermode console, you’ll see several key components of your project:
for search. Hypermode provides open source shared and dedicated model hosting
for rapid experimentation. You can also connect to your preferred large
language model, including OpenAI, Anthropic, and Gemini.
- **[Hosts](/modus/app-manifest#hosts):** You define all external connections
from your functions as hosts, with the runtime denying all other egress for
secure-by-default processing.
- **[Connections](/modus/app-manifest#connections):** You define all external
connections, with the runtime denying all other egress for secure-by-default
processing.
- **Endpoint:** The GraphQL endpoint for your project, which you’ll use to
interact with your APIs and query your data.

Expand Down
13 changes: 5 additions & 8 deletions hosted-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Need a bespoke model? You can include a model from

## Setup

To use a Hypermode-hosted model, set `host: "hypermode"`,
To use a Hypermode-hosted model, set `connection: "hypermode"`,
`provider: "hugging-face"`, and set `sourceModel` to be the model name as
specified on Hugging Face.

Expand All @@ -23,7 +23,7 @@ specified on Hugging Face.
"text-generator": {
"sourceModel": "meta-llama/Llama-3.1-8B-Instruct",
"provider": "hugging-face",
"host": "hypermode"
"connection": "hypermode"
}
}
...
Expand All @@ -36,12 +36,9 @@ We run our most popular models as multi-tenant, shared instances across projects
and customers.

By default, if the model you use is available as a shared model, your app uses
these shared models at runtime. You can override this default behavior by
setting `dedicated: true` on your model in the
[app manifest](/modus/app-manifest).

If the model you use isn't available as a shared model, Hypermode automatically
spins up a dedicated instance of the model for your project.
these shared models at runtime. If the model you use isn't available as a shared
model, Hypermode automatically spins up a dedicated instance of the model for
your project.

## Shared models

Expand Down
6 changes: 3 additions & 3 deletions modus/app-manifest.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ alphanumeric characters and hyphens.

Each connection has a `type` property, which controls how it's used and which
additional properties are available. The following table lists the available
host types:
connection types:

| Type | Purpose | Functions Namespaces |
| :----------- | :------------------------------- | :-------------------------- |
Expand Down Expand Up @@ -203,7 +203,7 @@ This example specifies a header named `X-API-Key` provided by a secret named
}
```

You can use a special syntax for hosts that require
You can use a special syntax for connections that require
[HTTP basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication).
In this example, secrets named `USERNAME` and `PASSWORD` combined and then are
base64-encoded to form a compliant `Authorization` header value:
Expand Down Expand Up @@ -358,7 +358,7 @@ alphanumeric characters and hyphens.
Connection for the model instance.

- Specify `"hypermode"` for models that [Hypermode hosts](/hosted-models).
- Otherwise, specify a name that matches a host defined in the
- Otherwise, specify a name that matches a connection defined in the
[`connections`](#connections) section of the manifest.

</ResponseField>
Expand Down
28 changes: 16 additions & 12 deletions modus/data-fetching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
)

// the name of the PostgreSQL connection, as specified in the modus.json manifest
const host = "my-database"
const connection = "my-database"

type Person struct {
Name string `json:"name"`
Expand All @@ -35,7 +35,7 @@ type Person struct {

func GetPerson(name string) (*Person, error) {
const query = "select * from persons where name = $1"
rows, _, _ := postgresql.Query[Person](host, query, name)
rows, _, _ := postgresql.Query[Person](connection, query, name)
return &rows[0], nil
}
```
Expand All @@ -44,7 +44,7 @@ func GetPerson(name string) (*Person, error) {
import { postgresql } from "@hypermode/modus-sdk-as"

// the name of the PostgreSQL connection, as specified in the modus.json manifest
const host = "my-database"
const connection = "my-database"

@json
class Person {
Expand All @@ -58,7 +58,7 @@ export function getPerson(name: string): Person {
const params = new postgresql.Params()
params.push(name)

const response = postgresql.query<Person>(host, query, params)
const response = postgresql.query<Person>(connection, query, params)
return response.rows[0]
}
```
Expand All @@ -84,7 +84,7 @@ import (
)

// the name of the Dgraph connection, as specified in the modus.json manifest
const hostName = "my-dgraph"
const connection = "my-dgraph"

// declare structures used to parse the JSON document returned by Dgraph query.
type Person struct {
Expand All @@ -109,7 +109,7 @@ func GetPerson(name string) (*Person, error) {
"$name": name,
}

response, _ := dgraph.Execute(hostName, &dgraph.Request{
response, _ := dgraph.Execute(connection, &dgraph.Request{
Query: &dgraph.Query{
Query: statement,
Variables: variables,
Expand All @@ -129,7 +129,7 @@ import { dgraph } from "@hypermode/modus-sdk-as"
import { JSON } from "json-as"

// the name of the Dgraph connection, as specified in the modus.json manifest
const hostName: string = "my-dgraph"
const connection: string = "my-dgraph"

// declare classes used to parse the JSON document returned by Dgraph query.
@json
Expand Down Expand Up @@ -157,7 +157,7 @@ export function getPerson(name: string): Person {
vars.set("$name", name)

const resp = dgraph.execute(
hostName,
connection,
new dgraph.Request(new dgraph.Query(statement, vars)),
)
const persons = JSON.parse<GetPersonResponse>(resp.Json).persons
Expand Down Expand Up @@ -245,7 +245,7 @@ import (
)

// the name of the GraphQL connection, as specified in the modus.json manifest
const hostName = "my-graphql-api"
const connection = "my-graphql-api"

// declare structures used to parse the JSON document returned
type Person struct {
Expand All @@ -269,7 +269,7 @@ func GetPerson(name string) (*Person, error) {
"name": name,
}

response, _ := graphql.Execute[GetPersonResponse](hostName, statement, vars)
response, _ := graphql.Execute[GetPersonResponse](connection, statement, vars)

return response.Data.Person, nil
}
Expand All @@ -279,7 +279,7 @@ func GetPerson(name string) (*Person, error) {
import { graphql } from "@hypermode/modus-sdk-as"

// the name of the GraphQL connection, as specified in the modus.json manifest
const hostName: string = "my-graphql-api"
const connection: string = "my-graphql-api"

// declare classes used to parse the JSON document returned
@json
Expand All @@ -304,7 +304,11 @@ export function getPerson(name: string): Person | null {
const vars = new graphql.Variables()
vars.set("name", name)

const response = graphql.execute<GetPersonResponse>(hostName, statement, vars)
const response = graphql.execute<GetPersonResponse>(
connection,
statement,
vars,
)

return response.data!.getPerson
}
Expand Down
28 changes: 16 additions & 12 deletions modus/sdk/dgraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ The APIs in the `dgraph` namespace are below, organized by category.
Execute a Dgraph query or mutation using a Dgraph Request object.

```go
function execute(hostName: string, request: Request): Response;
function execute(connectionName: string, request: Request): Response;
```

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="request" type="Request" required>
Expand All @@ -58,11 +59,12 @@ function execute(hostName: string, request: Request): Response;
Alter the schema of a Dgraph database.

```go
function alterSchema(hostName: string, schema: string): string;
function alterSchema(connectionName: string, schema: string): string;
```

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="schema" type="string" required>
Expand All @@ -74,11 +76,12 @@ function alterSchema(hostName: string, schema: string): string;
Drop an attribute from a Dgraph schema.

```go
function dropAttr(hostName: string, attr: string): string;
function dropAttr(connectionName: string, attr: string): string;
```

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="attr" type="string" required>
Expand All @@ -90,11 +93,12 @@ function dropAttr(hostName: string, attr: string): string;
Drop all data from a Dgraph database.

```go
function dropAll(hostName: string): string;
function dropAll(connectionName: string): string;
```

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

### Objects
Expand Down
7 changes: 4 additions & 3 deletions modus/sdk/graphql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ API endpoint.

```go
graphql.execute<T> (
hostName: string,
connection: string,
statement: string,
variables?: Variables
): Response<T>
Expand All @@ -65,8 +65,9 @@ and maps.
</Tip>
</ResponseField>

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connection" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connection).
</ResponseField>

<ResponseField name="statement" type="string" required>
Expand Down
16 changes: 8 additions & 8 deletions modus/sdk/http.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ JavaScript, but with some modifications to work with Hypermode Functions.

<Note>
As a security measure, you can only call HTTP endpoints that you
[defined in your app's manifest](../app-manifest#hosts). Any attempt to access an arbitrary URL, for a host not
[defined in your app's manifest](../app-manifest#connections). Any attempt to access an arbitrary URL, for a connection not
defined in your app's manifest, results in an error.

Additionally, you should use placeholders for host secrets in the manifest,
rather than hardcoding them in your functions. Enter the values for each hosts'
secrets via the Hypermode UI. This ensures that your secrets are securely
stored, aren't committed to your repository, and aren't visible or accessible
from your functions code.
Additionally, you should use placeholders for connection secrets in the
manifest, rather than hardcoding them in your functions. Enter the values for
each connections' secrets via environment variables or the Hypermode UI. This
ensures that your secrets are securely stored, aren't committed to your
repository, and aren't visible or accessible from your functions code.

</Note>

Expand Down Expand Up @@ -68,10 +68,10 @@ http.fetch(
Either a URL `string` or a [`Request`](#request) object, describing the HTTP request to make.

If a `string`, the operation uses the `GET` HTTP method with no headers other
than those defined in the manifest entry of the host.
than those defined in the manifest entry of the connection.

<Note>
Each request must match to a host entry in the manifest, using the `baseUrl` field. The request URL passed to the
Each request must match to a connection entry in the manifest, using the `baseUrl` field. The request URL passed to the
`fetch` function (or via a `Request` object) must start with the manifest entry's `baseUrl` value to match.
</Note>
</ResponseField>
Expand Down
21 changes: 12 additions & 9 deletions modus/sdk/postgresql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,15 @@ statements that don't return data.

```go
function postgresql.execute (
hostName: string,
connectionName: string,
statement: string,
params?: Params
): Response
```

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="statement" type="string" required>
Expand Down Expand Up @@ -87,7 +88,7 @@ the column names.

```go
function postgresql.query<T>(
hostName: string,
connectionName: string,
statement: string,
params?: Params,
): QueryResponse<T>
Expand All @@ -110,8 +111,9 @@ or [`Location`](#location) object to represent the data.
</Tip>
</ResponseField>

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="statement" type="string" required>
Expand Down Expand Up @@ -139,7 +141,7 @@ an identifier.

```go
function postgresql.queryScalar<T> (
hostName: string,
connectionName: string,
statement: string,
params?: Params
): ScalarResponse<T>
Expand All @@ -151,8 +153,9 @@ function postgresql.queryScalar<T> (
the type of the data returned from the SQL query.
</ResponseField>

<ResponseField name="hostName" type="string" required>
Name of the host, as [defined in the manifest](../app-manifest#hosts).
<ResponseField name="connectionName" type="string" required>
Name of the connection, as [defined in the
manifest](../app-manifest#connections).
</ResponseField>

<ResponseField name="statement" type="string" required>
Expand Down