Skip to content

Commit 23075a8

Browse files
Fix syntax
1 parent d13e9ad commit 23075a8

File tree

14 files changed

+188
-284
lines changed

14 files changed

+188
-284
lines changed

modus/sdk/assemblyscript/collections.mdx

Lines changed: 59 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,10 @@ The Modus Collection APIs allow you to add vector search within your functions.
1313

1414
To begin, import the `collections` namespace from the SDK:
1515

16-
<CodeGroup>
17-
18-
```go Go
19-
import github.com/hypermodeinc/modus/sdk/go/pkg/collections
20-
```
21-
22-
```ts AssemblyScript
16+
```ts
2317
import { collections } from "@hypermode/modus-sdk-as"
2418
```
2519

26-
</CodeGroup>
27-
2820
## Collections APIs
2921

3022
{/* <!-- vale Google.Headings = NO --> */}
@@ -44,7 +36,7 @@ Inserts or updates an item in a collection.
4436
not, it creates a new one.
4537
</Note>
4638

47-
```go
39+
```ts
4840
collections.upsert(
4941
collection: string,
5042
key: string | null,
@@ -86,7 +78,7 @@ Inserts or updates a batch of items into a collection.
8678
with the new text.
8779
</Note>
8880

89-
```go
81+
```ts
9082
collections.upsertBatch(
9183
collection: string,
9284
keys: string[] | null,
@@ -123,7 +115,7 @@ collections.upsertBatch(
123115

124116
Removes an item from the collection.
125117

126-
```go
118+
```ts
127119
collections.remove(
128120
collection: string,
129121
key: string,
@@ -157,7 +149,7 @@ useful for finding items that match a search query based on semantic meaning.
157149
for the text used when searching the collection.
158150
</Note>
159151

160-
```go
152+
```ts
161153
collections.search(
162154
collection: string,
163155
searchMethod: string,
@@ -204,7 +196,7 @@ requiring precise similarity calculations between pre-computed embeddings.
204196
for the vector used when searching the collection.
205197
</Note>
206198

207-
```go
199+
```ts
208200
collections.searchByVector(
209201
collection: string,
210202
searchMethod: string,
@@ -244,7 +236,7 @@ collections.searchByVector(
244236

245237
Classify an item in the collection using previous vectors' labels.
246238

247-
```go
239+
```ts
248240
collections.nnClassify(
249241
collection: string,
250242
searchMethod: string,
@@ -276,7 +268,7 @@ Classify an item in the collection using previous vectors' labels.
276268
Computes distance between two keys in a collection using a search method's
277269
embedder.
278270

279-
```go
271+
```ts
280272
collections.computeDistance(
281273
collection: string,
282274
searchMethod: string,
@@ -308,7 +300,7 @@ collections.computeDistance(
308300

309301
Gets an item's text from a collection, give the item's key.
310302

311-
```go
303+
```ts
312304
collections.getText(
313305
collection: string,
314306
key: string,
@@ -335,7 +327,7 @@ collections.getText(
335327
Get all items from a collection. The result is a map of key to text for all
336328
items in the collection.
337329

338-
```go
330+
```ts
339331
collections.getTexts(
340332
collection: string,
341333
namespace: string = "",
@@ -356,7 +348,7 @@ collections.getTexts(
356348

357349
Get all namespaces in a collection.
358350

359-
```go
351+
```ts
360352
collections.getNamespaces(
361353
collection: string,
362354
): string[]
@@ -371,7 +363,7 @@ collections.getNamespaces(
371363

372364
Get the vector for an item in a collection.
373365

374-
```go
366+
```ts
375367
collections.getVector(
376368
collection: string,
377369
searchMethod: string,
@@ -402,7 +394,7 @@ collections.getVector(
402394

403395
Get the labels for an item in a collection.
404396

405-
```go
397+
```ts
406398
collections.getLabels(
407399
collection: string,
408400
key: string,
@@ -433,7 +425,7 @@ resource-intensive, use it when necessary, for example after you have updated
433425
the method for embedding calculation and want to re-compute the embeddings for
434426
existing data in the collection.
435427

436-
```go
428+
```ts
437429
collections.recomputeSearchMethod(
438430
collection: string,
439431
searchMethod: string,
@@ -458,14 +450,14 @@ collections.recomputeSearchMethod(
458450

459451
#### CollectionMutationResult
460452

461-
```go
453+
```ts
462454
class CollectionMutationResult {
463-
collection: string;
464-
status: CollectionStatus;
465-
error: string;
466-
isSuccessful: bool;
467-
operation: string;
468-
keys: string[];
455+
collection: string
456+
status: CollectionStatus
457+
error: string
458+
isSuccessful: bool
459+
operation: string
460+
keys: string[]
469461
}
470462
```
471463

@@ -498,14 +490,14 @@ Represents the result of a mutation operation on a collection.
498490

499491
#### CollectionSearchResult
500492

501-
```go
493+
```ts
502494
class CollectionSearchResult {
503-
collection: string;
504-
status: CollectionStatus;
505-
error: string;
506-
isSuccessful: bool;
507-
searchMethod: string;
508-
objects: CollectionSearchResultObject[];
495+
collection: string
496+
status: CollectionStatus
497+
error: string
498+
isSuccessful: bool
499+
searchMethod: string
500+
objects: CollectionSearchResultObject[]
509501
}
510502
```
511503

@@ -538,14 +530,14 @@ Represents the result of a search operation on a collection.
538530

539531
#### CollectionSearchResultObject
540532

541-
```go
533+
```ts
542534
class CollectionSearchResultObject {
543-
namespace: string;
544-
key: string;
545-
text: string;
546-
labels: string[];
547-
distance: f64;
548-
score: f64;
535+
namespace: string
536+
key: string
537+
text: string
538+
labels: string[]
539+
distance: f64
540+
score: f64
549541
}
550542
```
551543

@@ -573,15 +565,15 @@ Represents an object in the search results.
573565

574566
#### CollectionClassificationResult
575567

576-
```go
568+
```ts
577569
class CollectionClassificationResult {
578-
collection: string;
579-
status: CollectionStatus;
580-
error: string;
581-
isSuccessful: bool;
582-
searchMethod: string;
583-
labelsResult: CollectionClassificationLabelObject[];
584-
cluster: CollectionClassificationResultObject[];
570+
collection: string
571+
status: CollectionStatus
572+
error: string
573+
isSuccessful: bool
574+
searchMethod: string
575+
labelsResult: CollectionClassificationLabelObject[]
576+
cluster: CollectionClassificationResultObject[]
585577
}
586578
```
587579

@@ -618,10 +610,10 @@ Represents the result of a classification operation on a collection.
618610

619611
#### CollectionClassificationLabelObject
620612

621-
```go
613+
```ts
622614
class CollectionClassificationLabelObject {
623-
label: string;
624-
confidence: f64;
615+
label: string
616+
confidence: f64
625617
}
626618
```
627619

@@ -637,12 +629,12 @@ Represents a classification label.
637629

638630
#### CollectionClassificationResultObject
639631

640-
```go
632+
```ts
641633
class CollectionClassificationResultObject {
642-
key: string;
643-
labels: string[];
644-
distance: f64;
645-
score: f64;
634+
key: string
635+
labels: string[]
636+
distance: f64
637+
score: f64
646638
}
647639
```
648640

@@ -666,7 +658,7 @@ Represents an object in the classification results.
666658

667659
#### CollectionStatus
668660

669-
```go
661+
```ts
670662
enum CollectionStatus {
671663
Success = "success";
672664
Error = "error";
@@ -685,14 +677,14 @@ The status of a collection operation.
685677

686678
#### SearchMethodMutationResult
687679

688-
```go
680+
```ts
689681
class SearchMethodMutationResult {
690-
collection: string;
691-
status: CollectionStatus;
692-
error: string;
693-
isSuccessful: bool;
694-
operation: string;
695-
searchMethod: string;
682+
collection: string
683+
status: CollectionStatus
684+
error: string
685+
isSuccessful: bool
686+
operation: string
687+
searchMethod: string
696688
}
697689
```
698690

modus/sdk/assemblyscript/console.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ The APIs in the `console` namespace are below, organized by category.
3939

4040
Asserts that a condition is true, and logs an error if it's not.
4141

42-
```go
42+
```ts
4343
console.assert(assertion: any, message?: string): void
4444
```
4545

@@ -58,7 +58,7 @@ console.assert(assertion: any, message?: string): void
5858

5959
Generate a log message, with no particular logging level.
6060

61-
```go
61+
```ts
6262
console.log(message?: string): void
6363
```
6464

@@ -70,7 +70,7 @@ console.log(message?: string): void
7070

7171
Generate a log message with the "debug" logging level.
7272

73-
```go
73+
```ts
7474
console.debug(message?: string): void
7575
```
7676

@@ -82,7 +82,7 @@ console.debug(message?: string): void
8282

8383
Generate a log message with the "info" logging level.
8484

85-
```go
85+
```ts
8686
console.info(message?: string): void
8787
```
8888

@@ -94,7 +94,7 @@ console.info(message?: string): void
9494

9595
Generate a log message with the "warning" logging level.
9696

97-
```go
97+
```ts
9898
console.warn(message?: string): void
9999
```
100100

@@ -106,7 +106,7 @@ console.warn(message?: string): void
106106

107107
Generate a log message with the "error" logging level.
108108

109-
```go
109+
```ts
110110
console.error(message?: string): void
111111
```
112112

@@ -120,7 +120,7 @@ console.error(message?: string): void
120120

121121
Starts a new timer using the specified label.
122122

123-
```go
123+
```ts
124124
console.time(label?: string): void
125125
```
126126

@@ -132,7 +132,7 @@ console.time(label?: string): void
132132

133133
Logs the current value of a timer previously started with `console.time`.
134134

135-
```go
135+
```ts
136136
console.timeLog(label?: string): void
137137
```
138138

@@ -145,7 +145,7 @@ console.timeLog(label?: string): void
145145
Logs the current value of a timer previously started with `console.time`, and
146146
discards the timer.
147147

148-
```go
148+
```ts
149149
console.timeEnd(label?: string): void
150150
```
151151

0 commit comments

Comments
 (0)