Skip to content

Commit de70408

Browse files
committed
models
1 parent a4aed03 commit de70408

File tree

2 files changed

+48
-59
lines changed

2 files changed

+48
-59
lines changed

modus/sdk/models.mdx

Lines changed: 47 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,55 @@ Since many models have unique interfaces, the design of the Models API is extrem
1010
common base class forms the core of the API, which extends to conform to any model's required
1111
schema.
1212

13-
A separate library, [`models-as`](https://github.com/hypermodeinc/models-as) contains both the base
14-
classes and pre-defined implementations for many commonly used models. You can either use one of the
15-
pre-defined classes, or can create custom classes for any model you like, by extending from the base
16-
`Model` class.
13+
The SDK contains both the base classes and pre-defined implementations for many commonly used
14+
models. You can either use one of the pre-defined classes, or can create custom classes for any
15+
model you like, by extending from the base `Model` class.
1716

18-
## Example project
19-
20-
For your reference, several complete examples for using the Models API are available on GitHub in
21-
the `hypermodeinc/functions-as` repository:
22-
23-
- [/examples/classification](https://github.com/hypermodeinc/modus/tree/main/sdk/assemblyscript/examples/classification)
24-
- [/examples/embedding](https://github.com/hypermodeinc/modus/tree/main/sdk/assemblyscript/examples/embedding)
25-
- [/examples/textgeneration](https://github.com/hypermodeinc/modus/tree/main/sdk/assemblyscript/examples/textgeneration)
17+
<Tip>
18+
For your reference, several complete examples for using the Models API are available in
19+
[Model Invoking](/modus/model-invoking).
2620

2721
Each example demonstrates using different types of AI models for different purposes. However, the
2822
Models interface isn't limited to these purposes. You can use it for any task that an AI model can
2923
perform.
3024

31-
<Note>
32-
Currently, the models interface doesn't support streaming data, either for input or output. For
33-
example, you can't use it with models that process streaming audio or video, nor provide streaming
34-
text output. We plan to address this limitation in a future release.
35-
</Note>
25+
</Tip>
3626

3727
## Import
3828

3929
To begin, import the `models` namespace from the SDK:
4030

41-
<CodeGroup>
42-
43-
```go Go
44-
import github.com/hypermodeinc/modus/sdk/go/pkg/models
45-
```
31+
<Tabs>
32+
<Tab title="Go">
33+
```go
34+
import github.com/hypermodeinc/modus/sdk/go/pkg/models
35+
```
4636

47-
```ts AssemblyScript
48-
import { models } from "@hypermode/modus-sdk-as"
49-
```
37+
You'll also need to import one or more classes for the model you are working with. For example:
5038

51-
</CodeGroup>
39+
```go
40+
import github.com/hypermodeinc/modus/sdk/go/pkg/models/experimental
41+
```
5242

53-
You'll also need to import one or more classes for the model you are working with.
43+
</Tab>
5444

55-
For example:
45+
<Tab title="AssemblyScript">
46+
```ts
47+
import { models } from "@hypermode/modus-sdk-as"
48+
```
5649

57-
<CodeGroup>
50+
You'll also need to import one or more classes for the model you are working with. For example:
5851

59-
```ts AssemblyScript
60-
import { ClassificationModel } from "@hypermode/models-as/models/experimental/classification"
61-
```
52+
```ts
53+
import { ClassificationModel } from "@hypermode/models-as/models/experimental/classification"
54+
```
6255

63-
Refer to the
64-
[`hypermodeinc/models-as`](https://github.com/hypermodeinc/models-as/tree/main/src/models)
65-
repository for the full list of available models. We're constantly adding new models, so the list
66-
may have grown since you last checked.
56+
</Tab>
57+
</Tabs>
6758

6859
If you would like to request a new model, please
69-
[open an issue](https://github.com/hypermodeinc/models-as/issues) on the `models-as` repository. You
70-
can also send a pull request, if you'd like to contribute a new model yourself.
71-
72-
</CodeGroup>
60+
[open an issue](https://github.com/hypermodeinc/modus/issues). You can also send a pull request, if
61+
you'd like to contribute a new model yourself.
7362

7463
## Models APIs
7564

@@ -89,9 +78,9 @@ The APIs in the `models` namespace are below, organized by category.
8978

9079
Get a model instance by name and type.
9180

92-
```go
93-
models.getModel<T>(modelName: string): T
94-
```
81+
```go
82+
models.getModel<T>(modelName: string): T
83+
```
9584

9685
<ResponseField name="T" type="Type" required>
9786
The type of model to return. This can be any class that extends the `Model` base class.
@@ -106,13 +95,13 @@ models.getModel<T>(modelName: string): T
10695

10796
#### Model
10897

109-
```go
110-
abstract class Model<TInput, TOutput> {
111-
debug: boolean;
112-
info: ModelInfo;
113-
invoke(input: TInput): TOutput;
114-
}
115-
```
98+
```go
99+
abstract class Model<TInput, TOutput> {
100+
debug: boolean;
101+
info: ModelInfo;
102+
invoke(input: TInput): TOutput;
103+
}
104+
```
116105

117106
The base class for all models that Hypermode functions can invoke.
118107

@@ -150,18 +139,18 @@ The base class for all models that Hypermode functions can invoke.
150139

151140
#### ModelInfo
152141

153-
```go
154-
class ModelInfo {
155-
readonly name: string;
156-
readonly fullName: string;
157-
}
158-
```
142+
```go
143+
class ModelInfo {
144+
readonly name: string;
145+
readonly fullName: string;
146+
}
147+
```
159148

160149
Information about a model that's used to construct a `Model` instance. It's also available as a
161150
property on the `Model` class.
162151

163152
<Info>
164-
This class relays information from the Hypermode Runtime to the model implementation. Generally, you don't need to
153+
This class relays information from the Modus runtime to the model implementation. Generally, you don't need to
165154
create `ModelInfo` instances directly.
166155

167156
However, if you are implementing a custom model, you may wish to use a property from this class,
@@ -172,7 +161,7 @@ We may add additional properties to this class in the future, as needed.
172161
</Info>
173162

174163
<ResponseField name="name" type="string">
175-
The name of the model from the Hypermode manifest.
164+
The name of the model from the app manifest.
176165
</ResponseField>
177166

178167
<ResponseField name="fullName" type="string">

styles/config/vocabularies/general/accept.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ queryScalar
4545
repo
4646
REST
4747
Scattergories
48-
SDK
48+
SDK|sdk
4949
serializable
5050
[Ss]erverless
5151
timeEnd

0 commit comments

Comments
 (0)