(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.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Suggest.Suggest(ctx, operations.SuggestRequest{
SuggestRequestBody: shared.SuggestRequestBody{
Diagnostics: []shared.Diagnostic{
shared.Diagnostic{
Message: "<value>",
Path: []string{
"/opt/include",
"/opt/share",
},
Type: "<value>",
},
shared.Diagnostic{
Message: "<value>",
Path: []string{
},
Type: "<value>",
},
},
OasSummary: shared.OASSummary{
Info: shared.OASInfo{
Description: "amid traffic the unfortunately underneath what father lovely out",
License: shared.License{},
Summary: "<value>",
Title: "<value>",
Version: "<value>",
},
Operations: []shared.OASOperation{
shared.OASOperation{
Description: "times dull than except",
Method: "<value>",
OperationID: "<id>",
Path: "/mnt",
Tags: []string{
"<value>",
"<value>",
},
},
},
},
SuggestionType: shared.SuggestRequestBodySuggestionTypeDiagnosticsOnly,
},
XSessionID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.Schema != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SuggestRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SuggestResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
Generate generic suggestions for a list of items.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Suggest.SuggestItems(ctx, shared.SuggestItemsRequestBody{
Items: []string{
},
Prompt: "<value>",
})
if err != nil {
log.Fatal(err)
}
if res.Strings != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
shared.SuggestItemsRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SuggestItemsResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
Get suggestions from an LLM model for improving an OpenAPI document.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"os"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
content, fileErr := os.Open("example.file")
if fileErr != nil {
panic(fileErr)
}
res, err := s.Suggest.SuggestOpenAPI(ctx, operations.SuggestOpenAPIRequest{
RequestBody: operations.SuggestOpenAPIRequestBody{
Schema: operations.Schema{
Content: content,
FileName: "example.file",
},
},
XSessionID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.Schema != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SuggestOpenAPIRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SuggestOpenAPIResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |
Get suggestions from an LLM model for improving an OpenAPI document stored in the registry.
package main
import(
"context"
speakeasyclientsdkgo "github.com/speakeasy-api/speakeasy-client-sdk-go/v3"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/shared"
"github.com/speakeasy-api/speakeasy-client-sdk-go/v3/pkg/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := speakeasyclientsdkgo.New(
speakeasyclientsdkgo.WithSecurity(shared.Security{
APIKey: speakeasyclientsdkgo.String("<YOUR_API_KEY_HERE>"),
}),
)
res, err := s.Suggest.SuggestOpenAPIRegistry(ctx, operations.SuggestOpenAPIRegistryRequest{
NamespaceName: "<value>",
RevisionReference: "<value>",
XSessionID: "<id>",
})
if err != nil {
log.Fatal(err)
}
if res.Schema != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SuggestOpenAPIRegistryRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SuggestOpenAPIRegistryResponse, error
Error Type | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4XX, 5XX | */* |