(suggest)
REST APIs for managing LLM OAS suggestions
- suggest - Generate suggestions for improving an OpenAPI document.
- suggestItems - Generate generic suggestions for a list of items.
- 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: [],
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: [],
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();
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useSuggestSuggestMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/suggestSuggest.js";
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 | */* |
Generate generic suggestions for a list of items.
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.suggestItems({
items: [],
prompt: "<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 { suggestSuggestItems } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/suggestSuggestItems.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 suggestSuggestItems(speakeasy, {
items: [],
prompt: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useSuggestSuggestItemsMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/suggestSuggestItems.js";
Parameter | Type | Required | Description |
---|---|---|---|
request |
shared.SuggestItemsRequestBody | ✔️ | 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<string[]>
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();
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useSuggestSuggestOpenAPIMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/suggestSuggestOpenAPI.js";
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();
This method can be used in React components through the following hooks and associated utilities.
Check out this guide for information about each of the utilities below and how to get started using React hooks.
import {
// Mutation hook for triggering the API call.
useSuggestSuggestOpenAPIRegistryMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/suggestSuggestOpenAPIRegistry.js";
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 | */* |