(suggest)
REST APIs for managing LLM OAS suggestions
- suggest - Generate suggestions for improving an OpenAPI document.
- suggestOpenAPI - (DEPRECATED) Generate suggestions for improving an OpenAPI document.
- suggestOpenAPIRegistry - Generate suggestions for improving an OpenAPI document stored in the registry.
Get suggestions from an LLM model for improving an OpenAPI document.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.suggest.suggest({
xSessionId: "<id>",
suggestRequestBody: {
diagnostics: [
{
message: "<value>",
path: [
"/opt/include",
"/opt/share",
],
type: "<value>",
},
{
message: "<value>",
path: [
"/rescue",
],
type: "<value>",
},
],
oasSummary: {
info: {
description: "amid traffic the unfortunately underneath what father lovely out",
license: {},
summary: "<value>",
title: "<value>",
version: "<value>",
},
operations: [
{
description: "times dull than except",
method: "<value>",
operationId: "<id>",
path: "/mnt",
tags: [
"<value>",
"<value>",
],
},
],
},
suggestionType: "diagnostics-only",
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { suggestSuggest } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/suggestSuggest.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await suggestSuggest(speakeasy, {
xSessionId: "<id>",
suggestRequestBody: {
diagnostics: [
{
message: "<value>",
path: [
"/opt/include",
"/opt/share",
],
type: "<value>",
},
{
message: "<value>",
path: [
"/opt/include",
],
type: "<value>",
},
],
oasSummary: {
info: {
description: "amid traffic the unfortunately underneath what father lovely out",
license: {},
summary: "<value>",
title: "<value>",
version: "<value>",
},
operations: [
{
description: "times dull than except",
method: "<value>",
operationId: "<id>",
path: "/mnt",
tags: [
"<value>",
"<value>",
],
},
],
},
suggestionType: "diagnostics-only",
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SuggestRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<ReadableStream>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Get suggestions from an LLM model for improving an OpenAPI document.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
import { openAsBlob } from "node:fs";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.suggest.suggestOpenAPI({
xSessionId: "<id>",
requestBody: {
schema: await openAsBlob("example.file"),
},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { suggestSuggestOpenAPI } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/suggestSuggestOpenAPI.js";
import { openAsBlob } from "node:fs";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await suggestSuggestOpenAPI(speakeasy, {
xSessionId: "<id>",
requestBody: {
schema: await openAsBlob("example.file"),
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SuggestOpenAPIRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<ReadableStream>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |
Get suggestions from an LLM model for improving an OpenAPI document stored in the registry.
import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";
const speakeasy = new Speakeasy({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const result = await speakeasy.suggest.suggestOpenAPIRegistry({
xSessionId: "<id>",
namespaceName: "<value>",
revisionReference: "<value>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { suggestSuggestOpenAPIRegistry } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/suggestSuggestOpenAPIRegistry.js";
// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
security: {
apiKey: "<YOUR_API_KEY_HERE>",
},
});
async function run() {
const res = await suggestSuggestOpenAPIRegistry(speakeasy, {
xSessionId: "<id>",
namespaceName: "<value>",
revisionReference: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.SuggestOpenAPIRegistryRequest | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<ReadableStream>
Error Type | Status Code | Content Type |
---|---|---|
errors.SDKError | 4XX, 5XX | */* |