Skip to content

Latest commit

 

History

History
263 lines (195 loc) · 9.95 KB

File metadata and controls

263 lines (195 loc) · 9.95 KB

Suggest

(suggest)

Overview

REST APIs for managing LLM OAS suggestions

Available Operations

  • 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.

suggest

Get suggestions from an LLM model for improving an OpenAPI document.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\SuggestRequest(
    suggestRequestBody: new Shared\SuggestRequestBody(
        diagnostics: [
            new Shared\Diagnostic(
                message: '<value>',
                path: [
                    '/rescue',
                ],
                type: '<value>',
            ),
        ],
        oasSummary: new Shared\OASSummary(
            info: new Shared\OASInfo(
                description: 'kielbasa psst stitcher cannon devoted blindly apropos low',
                license: new Shared\License(),
                summary: '<value>',
                title: '<value>',
                version: '<value>',
            ),
            operations: [
                new Shared\OASOperation(
                    description: 'via apparatus gray whether opposite what',
                    method: '<value>',
                    operationId: '<id>',
                    path: '/sys',
                    tags: [
                        '<value>',
                    ],
                ),
            ],
        ),
        suggestionType: Shared\SuggestRequestBodySuggestionType::MethodNames,
    ),
    xSessionId: '<id>',
);

$response = $sdk->suggest->suggest(
    request: $request
);

if ($response->schema !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\SuggestRequest ✔️ The request object to use for the request.

Response

?Operations\SuggestResponse

Errors

Error Type Status Code Content Type
Errorors\SDKException 4XX, 5XX */*

suggestItems

Generate generic suggestions for a list of items.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Shared\SuggestItemsRequestBody(
    items: [
        '<value>',
    ],
    prompt: '<value>',
);

$response = $sdk->suggest->suggestItems(
    request: $request
);

if ($response->strings !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Shared\SuggestItemsRequestBody ✔️ The request object to use for the request.

Response

?Operations\SuggestItemsResponse

Errors

Error Type Status Code Content Type
Errorors\SDKException 4XX, 5XX */*

suggestOpenAPI

Get suggestions from an LLM model for improving an OpenAPI document.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\SuggestOpenAPIRequest(
    requestBody: new Operations\SuggestOpenAPIRequestBody(
        schema: new Operations\Schema(
            content: '0x0beEcB7cF6',
            fileName: 'example.file',
        ),
    ),
    xSessionId: '<id>',
);

$response = $sdk->suggest->suggestOpenAPI(
    request: $request
);

if ($response->schema !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\SuggestOpenAPIRequest ✔️ The request object to use for the request.

Response

?Operations\SuggestOpenAPIResponse

Errors

Error Type Status Code Content Type
Errorors\SDKException 4XX, 5XX */*

suggestOpenAPIRegistry

Get suggestions from an LLM model for improving an OpenAPI document stored in the registry.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '<YOUR_API_KEY_HERE>',
        )
    )
    ->build();

$request = new Operations\SuggestOpenAPIRegistryRequest(
    namespaceName: '<value>',
    revisionReference: '<value>',
    xSessionId: '<id>',
);

$response = $sdk->suggest->suggestOpenAPIRegistry(
    request: $request
);

if ($response->schema !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
$request Operations\SuggestOpenAPIRegistryRequest ✔️ The request object to use for the request.

Response

?Operations\SuggestOpenAPIRegistryResponse

Errors

Error Type Status Code Content Type
Errorors\SDKException 4XX, 5XX */*