Skip to content
Merged
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ the basic components of a Modus app and how to deploy it to Hypermode.
Go to the `index.ts` file and locate the `generateText` function. Modify the function
to only respond like a surfer, like this:

<CodeGroup>

```ts AssemblyScript
export function generateText(text: string): string {
const model = models.getModel<OpenAIChatModel>("text-generator")
Expand All @@ -135,6 +137,32 @@ the basic components of a Modus app and how to deploy it to Hypermode.
}
```

```ts Go
func GenerateText(text string) (string, error) {
model, err := models.GetModel[openai.ChatModel]("text-generator")
if err != nil {
return "", err
}

input, err := model.CreateInput(
openai.NewSystemMessage("You are a helpful assistant. Only respond using surfing analogies and metaphors."),
openai.NewUserMessage(text),
)
if err != nil {
return "", err
}

output, err := model.Invoke(input)
if err != nil {
return "", err
}

return strings.TrimSpace(output.Choices[0].Message.Content), nil
}
```

</CodeGroup>

Save the file and push an update to your Git repo. Hypermode automatically redeploys
whenever you push an update to the target branch in your Git repo. Go back to the Hypermode Console
and run the same query as before. You should see the response now uses surfing analogies!
Expand Down