CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/next/lib/api/schema/guesslang.ts
Views: 687
1
import { z } from "../framework";
2
3
import { FailedAPIOperationSchema } from "./common";
4
5
// OpenAPI spec
6
//
7
export const GuesslangInputSchema = z
8
.object({
9
code: z.string().describe("A snippet of code."),
10
cutoff: z
11
.number()
12
.positive()
13
.default(5)
14
.describe("Maximum number of results to return."),
15
})
16
.describe(
17
`Use a sophisticated machine learning model (see
18
\`@vscode/vscode-languagedetection\`) to guess the language of a snippet of
19
code.`,
20
);
21
22
export const GuesslangOutputSchema = z.union([
23
FailedAPIOperationSchema,
24
z.object({
25
result: z
26
.array(z.string())
27
.describe(
28
`List of likely guesses for the type of code, from most likely to least
29
likely.`,
30
),
31
}),
32
]);
33
34
export type GuesslangInput = z.infer<typeof GuesslangInputSchema>;
35
export type GuesslangOutput = z.infer<typeof GuesslangOutputSchema>;
36
37