diff --git a/CHANGELOG.md b/CHANGELOG.md index ca689632fc..e9b625c16f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## 65.56.1 - 2024-01-23 +### Added +- Support for the Generative AI service +- Support for additional currencies and countries for paid listings in the Marketplace service +- Support for process sets in the Stack Monitoring service + + ## 65.56.0 - 2024-01-16 ### Added - Support for resource id filter on the service work requests in the Container Instances service diff --git a/Makefile b/Makefile index 871c565b4c..26db2a0388 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ DOC_SERVER_URL=https:\/\/docs.cloud.oracle.com -GEN_TARGETS = identity core objectstorage loadbalancer database audit dns filestorage email containerengine resourcesearch keymanagement announcementsservice healthchecks waas autoscaling streaming ons monitoring resourcemanager budget workrequests functions limits events dts oce oda analytics integration osmanagement marketplace apigateway applicationmigration datacatalog dataflow datascience nosql secrets vault bds cims datasafe mysql dataintegration ocvp usageapi blockchain loggingingestion logging loganalytics managementdashboard sch loggingsearch managementagent cloudguard opsi computeinstanceagent optimizer tenantmanagercontrolplane rover databasemanagement artifacts apmsynthetics goldengate apmcontrolplane apmtraces networkloadbalancer vulnerabilityscanning databasemigration servicecatalog ailanguage operatoraccesscontrol bastion genericartifactscontent jms devops aianomalydetection datalabelingservice datalabelingservicedataplane apmconfig waf certificates certificatesmanagement usage databasetools servicemanagerproxy appmgmtcontrol ospgateway identitydataplane visualbuilder osubusage osubsubscription osuborganizationsubscription osubbillingschedule dashboardservice threatintelligence aivision aispeech stackmonitoring servicemesh adm licensemanager onesubscription governancerulescontrolplane waa networkfirewall vnmonitoring emwarehouse lockbox fusionapps mediaservices opa opensearch cloudmigrations cloudbridge disasterrecovery containerinstances aidocument queue recovery vbsinst identitydomains accessgovernancecp ocicontrolcenter osmanagementhub fleetsoftwareupdate computecloudatcustomer marketplacepublisher redis jmsjavadownloads psql ##SPECNAME## +GEN_TARGETS = identity core objectstorage loadbalancer database audit dns filestorage email containerengine resourcesearch keymanagement announcementsservice healthchecks waas autoscaling streaming ons monitoring resourcemanager budget workrequests functions limits events dts oce oda analytics integration osmanagement marketplace apigateway applicationmigration datacatalog dataflow datascience nosql secrets vault bds cims datasafe mysql dataintegration ocvp usageapi blockchain loggingingestion logging loganalytics managementdashboard sch loggingsearch managementagent cloudguard opsi computeinstanceagent optimizer tenantmanagercontrolplane rover databasemanagement artifacts apmsynthetics goldengate apmcontrolplane apmtraces networkloadbalancer vulnerabilityscanning databasemigration servicecatalog ailanguage operatoraccesscontrol bastion genericartifactscontent jms devops aianomalydetection datalabelingservice datalabelingservicedataplane apmconfig waf certificates certificatesmanagement usage databasetools servicemanagerproxy appmgmtcontrol ospgateway identitydataplane visualbuilder osubusage osubsubscription osuborganizationsubscription osubbillingschedule dashboardservice threatintelligence aivision aispeech stackmonitoring servicemesh adm licensemanager onesubscription governancerulescontrolplane waa networkfirewall vnmonitoring emwarehouse lockbox fusionapps mediaservices opa opensearch cloudmigrations cloudbridge disasterrecovery containerinstances aidocument queue recovery vbsinst identitydomains accessgovernancecp ocicontrolcenter osmanagementhub fleetsoftwareupdate computecloudatcustomer marketplacepublisher redis jmsjavadownloads psql generativeai generativeaiinference ##SPECNAME## NON_GEN_TARGETS = common common/auth objectstorage/transfer example TARGETS = $(NON_GEN_TARGETS) $(GEN_TARGETS) diff --git a/common/http.go b/common/http.go index 9927366e07..aea6ab3060 100644 --- a/common/http.go +++ b/common/http.go @@ -1068,6 +1068,11 @@ func responseToStruct(response *http.Response, val *reflect.Value, unmarshaler P // Notice the current implementation only supports native types:int, strings, floats, bool as the field types func UnmarshalResponse(httpResponse *http.Response, responseStruct interface{}) (err error) { + // Check for text/event-stream content type, which cannot be Unmarshalled by the SDK + if httpResponse != nil && httpResponse.Header != nil && strings.ToLower(httpResponse.Header.Get("content-type")) == "text/event-stream" { + return fmt.Errorf("streaming mode is currently not supported. Please use non-streaming mode for this API instead") + } + var val *reflect.Value if val, err = checkForValidResponseStruct(responseStruct); err != nil { return diff --git a/common/version.go b/common/version.go index ab4bfdf198..1adcf443f2 100644 --- a/common/version.go +++ b/common/version.go @@ -13,7 +13,7 @@ import ( const ( major = "65" minor = "56" - patch = "0" + patch = "1" tag = "" ) diff --git a/generativeai/action_type.go b/generativeai/action_type.go new file mode 100644 index 0000000000..d81a964145 --- /dev/null +++ b/generativeai/action_type.go @@ -0,0 +1,75 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// ActionTypeEnum Enum with underlying type: string +type ActionTypeEnum string + +// Set of constants representing the allowable values for ActionTypeEnum +const ( + ActionTypeCreated ActionTypeEnum = "CREATED" + ActionTypeUpdated ActionTypeEnum = "UPDATED" + ActionTypeDeleted ActionTypeEnum = "DELETED" + ActionTypeInProgress ActionTypeEnum = "IN_PROGRESS" + ActionTypeRelated ActionTypeEnum = "RELATED" + ActionTypeFailed ActionTypeEnum = "FAILED" +) + +var mappingActionTypeEnum = map[string]ActionTypeEnum{ + "CREATED": ActionTypeCreated, + "UPDATED": ActionTypeUpdated, + "DELETED": ActionTypeDeleted, + "IN_PROGRESS": ActionTypeInProgress, + "RELATED": ActionTypeRelated, + "FAILED": ActionTypeFailed, +} + +var mappingActionTypeEnumLowerCase = map[string]ActionTypeEnum{ + "created": ActionTypeCreated, + "updated": ActionTypeUpdated, + "deleted": ActionTypeDeleted, + "in_progress": ActionTypeInProgress, + "related": ActionTypeRelated, + "failed": ActionTypeFailed, +} + +// GetActionTypeEnumValues Enumerates the set of values for ActionTypeEnum +func GetActionTypeEnumValues() []ActionTypeEnum { + values := make([]ActionTypeEnum, 0) + for _, v := range mappingActionTypeEnum { + values = append(values, v) + } + return values +} + +// GetActionTypeEnumStringValues Enumerates the set of values in String for ActionTypeEnum +func GetActionTypeEnumStringValues() []string { + return []string{ + "CREATED", + "UPDATED", + "DELETED", + "IN_PROGRESS", + "RELATED", + "FAILED", + } +} + +// GetMappingActionTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingActionTypeEnum(val string) (ActionTypeEnum, bool) { + enum, ok := mappingActionTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/change_dedicated_ai_cluster_compartment_details.go b/generativeai/change_dedicated_ai_cluster_compartment_details.go new file mode 100644 index 0000000000..bd8a1476e4 --- /dev/null +++ b/generativeai/change_dedicated_ai_cluster_compartment_details.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ChangeDedicatedAiClusterCompartmentDetails The details to move a dedicated AI cluster to another compartment. +type ChangeDedicatedAiClusterCompartmentDetails struct { + + // The OCID of the compartment to move the dedicated AI cluster to. + CompartmentId *string `mandatory:"true" json:"compartmentId"` +} + +func (m ChangeDedicatedAiClusterCompartmentDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ChangeDedicatedAiClusterCompartmentDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/change_dedicated_ai_cluster_compartment_request_response.go b/generativeai/change_dedicated_ai_cluster_compartment_request_response.go new file mode 100644 index 0000000000..3c3c21f8f6 --- /dev/null +++ b/generativeai/change_dedicated_ai_cluster_compartment_request_response.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ChangeDedicatedAiClusterCompartmentRequest wrapper for the ChangeDedicatedAiClusterCompartment operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeDedicatedAiClusterCompartment.go.html to see an example of how to use ChangeDedicatedAiClusterCompartmentRequest. +type ChangeDedicatedAiClusterCompartmentRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + DedicatedAiClusterId *string `mandatory:"true" contributesTo:"path" name:"dedicatedAiClusterId"` + + // The information to be updated. + ChangeDedicatedAiClusterCompartmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ChangeDedicatedAiClusterCompartmentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ChangeDedicatedAiClusterCompartmentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ChangeDedicatedAiClusterCompartmentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ChangeDedicatedAiClusterCompartmentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ChangeDedicatedAiClusterCompartmentRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ChangeDedicatedAiClusterCompartmentResponse wrapper for the ChangeDedicatedAiClusterCompartment operation +type ChangeDedicatedAiClusterCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ChangeDedicatedAiClusterCompartmentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ChangeDedicatedAiClusterCompartmentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/change_endpoint_compartment_details.go b/generativeai/change_endpoint_compartment_details.go new file mode 100644 index 0000000000..8adabe85ec --- /dev/null +++ b/generativeai/change_endpoint_compartment_details.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ChangeEndpointCompartmentDetails The details to move an endpoint to another compartment. +type ChangeEndpointCompartmentDetails struct { + + // The OCID of the compartment to move the endpoint to. + CompartmentId *string `mandatory:"true" json:"compartmentId"` +} + +func (m ChangeEndpointCompartmentDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ChangeEndpointCompartmentDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/change_endpoint_compartment_request_response.go b/generativeai/change_endpoint_compartment_request_response.go new file mode 100644 index 0000000000..7d4174db7f --- /dev/null +++ b/generativeai/change_endpoint_compartment_request_response.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ChangeEndpointCompartmentRequest wrapper for the ChangeEndpointCompartment operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeEndpointCompartment.go.html to see an example of how to use ChangeEndpointCompartmentRequest. +type ChangeEndpointCompartmentRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the endpoint. + EndpointId *string `mandatory:"true" contributesTo:"path" name:"endpointId"` + + // The endpoint information to be updated. + ChangeEndpointCompartmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ChangeEndpointCompartmentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ChangeEndpointCompartmentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ChangeEndpointCompartmentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ChangeEndpointCompartmentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ChangeEndpointCompartmentRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ChangeEndpointCompartmentResponse wrapper for the ChangeEndpointCompartment operation +type ChangeEndpointCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ChangeEndpointCompartmentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ChangeEndpointCompartmentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/change_model_compartment_details.go b/generativeai/change_model_compartment_details.go new file mode 100644 index 0000000000..976ad6c8ab --- /dev/null +++ b/generativeai/change_model_compartment_details.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ChangeModelCompartmentDetails The details to move a custom model to another compartment. +type ChangeModelCompartmentDetails struct { + + // The compartment OCID to create the model in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` +} + +func (m ChangeModelCompartmentDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ChangeModelCompartmentDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/change_model_compartment_request_response.go b/generativeai/change_model_compartment_request_response.go new file mode 100644 index 0000000000..5e59e9e303 --- /dev/null +++ b/generativeai/change_model_compartment_request_response.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ChangeModelCompartmentRequest wrapper for the ChangeModelCompartment operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeModelCompartment.go.html to see an example of how to use ChangeModelCompartmentRequest. +type ChangeModelCompartmentRequest struct { + + // The model OCID + ModelId *string `mandatory:"true" contributesTo:"path" name:"modelId"` + + // The information to be updated. + ChangeModelCompartmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ChangeModelCompartmentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ChangeModelCompartmentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ChangeModelCompartmentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ChangeModelCompartmentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ChangeModelCompartmentRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ChangeModelCompartmentResponse wrapper for the ChangeModelCompartment operation +type ChangeModelCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ChangeModelCompartmentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ChangeModelCompartmentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/content_moderation_config.go b/generativeai/content_moderation_config.go new file mode 100644 index 0000000000..b51d42f7ab --- /dev/null +++ b/generativeai/content_moderation_config.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ContentModerationConfig The configuration details, whether to add the content moderation feature to the model. Content moderation removes toxic and biased content from responses. It's recommended to use content moderation. +type ContentModerationConfig struct { + + // Whether to enable the content moderation feature. + IsEnabled *bool `mandatory:"true" json:"isEnabled"` +} + +func (m ContentModerationConfig) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ContentModerationConfig) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/create_dedicated_ai_cluster_details.go b/generativeai/create_dedicated_ai_cluster_details.go new file mode 100644 index 0000000000..27e177925d --- /dev/null +++ b/generativeai/create_dedicated_ai_cluster_details.go @@ -0,0 +1,81 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CreateDedicatedAiClusterDetails The data to create a dedicated AI cluster. +type CreateDedicatedAiClusterDetails struct { + + // The dedicated AI cluster type indicating whether this is a fine-tuning/training processor or hosting/inference processor. + // Allowed values are: + // - HOSTING + // - FINE_TUNING + Type DedicatedAiClusterTypeEnum `mandatory:"true" json:"type"` + + // The compartment OCID to create the dedicated AI cluster in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The number of dedicated units in this AI cluster. + UnitCount *int `mandatory:"true" json:"unitCount"` + + // The shape of dedicated unit in this AI cluster. The underlying hardware configuration is hidden from customers. + // Allowed values are: + // - LARGE_COHERE + // - SMALL_COHERE + // - EMBED_COHERE + // - LLAMA2_70 + UnitShape DedicatedAiClusterUnitShapeEnum `mandatory:"true" json:"unitShape"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the dedicated AI cluster. + Description *string `mandatory:"false" json:"description"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m CreateDedicatedAiClusterDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CreateDedicatedAiClusterDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingDedicatedAiClusterTypeEnum(string(m.Type)); !ok && m.Type != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Type: %s. Supported values are: %s.", m.Type, strings.Join(GetDedicatedAiClusterTypeEnumStringValues(), ","))) + } + if _, ok := GetMappingDedicatedAiClusterUnitShapeEnum(string(m.UnitShape)); !ok && m.UnitShape != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for UnitShape: %s. Supported values are: %s.", m.UnitShape, strings.Join(GetDedicatedAiClusterUnitShapeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/create_dedicated_ai_cluster_request_response.go b/generativeai/create_dedicated_ai_cluster_request_response.go new file mode 100644 index 0000000000..f546426fa8 --- /dev/null +++ b/generativeai/create_dedicated_ai_cluster_request_response.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// CreateDedicatedAiClusterRequest wrapper for the CreateDedicatedAiCluster operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateDedicatedAiCluster.go.html to see an example of how to use CreateDedicatedAiClusterRequest. +type CreateDedicatedAiClusterRequest struct { + + // Details for the new dedicated AI cluster. + CreateDedicatedAiClusterDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request CreateDedicatedAiClusterRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request CreateDedicatedAiClusterRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request CreateDedicatedAiClusterRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request CreateDedicatedAiClusterRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request CreateDedicatedAiClusterRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// CreateDedicatedAiClusterResponse wrapper for the CreateDedicatedAiCluster operation +type CreateDedicatedAiClusterResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DedicatedAiCluster instance + DedicatedAiCluster `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateDedicatedAiClusterResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response CreateDedicatedAiClusterResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/create_endpoint_details.go b/generativeai/create_endpoint_details.go new file mode 100644 index 0000000000..7172315908 --- /dev/null +++ b/generativeai/create_endpoint_details.go @@ -0,0 +1,66 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CreateEndpointDetails The data to create an endpoint. +type CreateEndpointDetails struct { + + // The compartment OCID to create the endpoint in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The ID of the model that's used to create this endpoint. + ModelId *string `mandatory:"true" json:"modelId"` + + // The OCID of the dedicated AI cluster on which a model will be deployed to. + DedicatedAiClusterId *string `mandatory:"true" json:"dedicatedAiClusterId"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the endpoint. + Description *string `mandatory:"false" json:"description"` + + ContentModerationConfig *ContentModerationConfig `mandatory:"false" json:"contentModerationConfig"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m CreateEndpointDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CreateEndpointDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/create_endpoint_request_response.go b/generativeai/create_endpoint_request_response.go new file mode 100644 index 0000000000..2a88127774 --- /dev/null +++ b/generativeai/create_endpoint_request_response.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// CreateEndpointRequest wrapper for the CreateEndpoint operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateEndpoint.go.html to see an example of how to use CreateEndpointRequest. +type CreateEndpointRequest struct { + + // Details for the new endpoint. + CreateEndpointDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request CreateEndpointRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request CreateEndpointRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request CreateEndpointRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request CreateEndpointRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request CreateEndpointRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// CreateEndpointResponse wrapper for the CreateEndpoint operation +type CreateEndpointResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Endpoint instance + Endpoint `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateEndpointResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response CreateEndpointResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/create_model_details.go b/generativeai/create_model_details.go new file mode 100644 index 0000000000..0f30d60275 --- /dev/null +++ b/generativeai/create_model_details.go @@ -0,0 +1,69 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CreateModelDetails The data to create a custom model. +type CreateModelDetails struct { + + // The compartment OCID for fine-tuned models. For pretrained models, this value is null. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the base model that's used for fine-tuning. + BaseModelId *string `mandatory:"true" json:"baseModelId"` + + FineTuneDetails *FineTuneDetails `mandatory:"true" json:"fineTuneDetails"` + + // A user-friendly name. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The provider of the model. + Vendor *string `mandatory:"false" json:"vendor"` + + // The version of the model. + Version *string `mandatory:"false" json:"version"` + + // An optional description of the model. + Description *string `mandatory:"false" json:"description"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m CreateModelDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CreateModelDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/create_model_request_response.go b/generativeai/create_model_request_response.go new file mode 100644 index 0000000000..cff80dffd9 --- /dev/null +++ b/generativeai/create_model_request_response.go @@ -0,0 +1,107 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// CreateModelRequest wrapper for the CreateModel operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateModel.go.html to see an example of how to use CreateModelRequest. +type CreateModelRequest struct { + + // Details for the new model. + CreateModelDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of running that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and removed from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request CreateModelRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request CreateModelRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request CreateModelRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request CreateModelRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request CreateModelRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// CreateModelResponse wrapper for the CreateModel operation +type CreateModelResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Model instance + Model `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateModelResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response CreateModelResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/dataset.go b/generativeai/dataset.go new file mode 100644 index 0000000000..a8c734f2cc --- /dev/null +++ b/generativeai/dataset.go @@ -0,0 +1,121 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Dataset The dataset used to fine-tune the model. +// Only one dataset is allowed per custom model, which is split 90-10 for training and validating. You must provide the dataset in a JSON Lines (JSONL) file. Each line in the JSONL file must have the format: +// +// `{"prompt": "", "completion": ""}` +type Dataset interface { +} + +type dataset struct { + JsonData []byte + DatasetType string `json:"datasetType"` +} + +// UnmarshalJSON unmarshals json +func (m *dataset) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerdataset dataset + s := struct { + Model Unmarshalerdataset + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.DatasetType = s.Model.DatasetType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *dataset) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.DatasetType { + case "OBJECT_STORAGE": + mm := ObjectStorageDataset{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for Dataset: %s.", m.DatasetType) + return *m, nil + } +} + +func (m dataset) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m dataset) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DatasetDatasetTypeEnum Enum with underlying type: string +type DatasetDatasetTypeEnum string + +// Set of constants representing the allowable values for DatasetDatasetTypeEnum +const ( + DatasetDatasetTypeObjectStorage DatasetDatasetTypeEnum = "OBJECT_STORAGE" +) + +var mappingDatasetDatasetTypeEnum = map[string]DatasetDatasetTypeEnum{ + "OBJECT_STORAGE": DatasetDatasetTypeObjectStorage, +} + +var mappingDatasetDatasetTypeEnumLowerCase = map[string]DatasetDatasetTypeEnum{ + "object_storage": DatasetDatasetTypeObjectStorage, +} + +// GetDatasetDatasetTypeEnumValues Enumerates the set of values for DatasetDatasetTypeEnum +func GetDatasetDatasetTypeEnumValues() []DatasetDatasetTypeEnum { + values := make([]DatasetDatasetTypeEnum, 0) + for _, v := range mappingDatasetDatasetTypeEnum { + values = append(values, v) + } + return values +} + +// GetDatasetDatasetTypeEnumStringValues Enumerates the set of values in String for DatasetDatasetTypeEnum +func GetDatasetDatasetTypeEnumStringValues() []string { + return []string{ + "OBJECT_STORAGE", + } +} + +// GetMappingDatasetDatasetTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingDatasetDatasetTypeEnum(val string) (DatasetDatasetTypeEnum, bool) { + enum, ok := mappingDatasetDatasetTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/dedicated_ai_cluster.go b/generativeai/dedicated_ai_cluster.go new file mode 100644 index 0000000000..b4b144130c --- /dev/null +++ b/generativeai/dedicated_ai_cluster.go @@ -0,0 +1,320 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedAiCluster Dedicated AI clusters are compute resources that you can use for fine-tuning custom models or for hosting endpoints for custom models. The clusters are dedicated to your models and not shared with users in other tenancies. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator who gives OCI resource access to users. See +// Getting Started with Policies (https://docs.cloud.oracle.com/iaas/Content/Identity/policiesgs/get-started-with-policies.htm) and Getting Access to Generative AI Resouces (https://docs.cloud.oracle.com/iaas/Content/generative-ai/iam-policies.htm). +type DedicatedAiCluster struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + Id *string `mandatory:"true" json:"id"` + + // The dedicated AI cluster type indicating whether this is a fine-tuning/training processor or hosting/inference processor. + Type DedicatedAiClusterTypeEnum `mandatory:"true" json:"type"` + + // The compartment OCID to create the dedicated AI cluster in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The date and time the dedicated AI cluster was created, in the format defined by RFC 3339 + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current state of the dedicated AI cluster. + LifecycleState DedicatedAiClusterLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The number of dedicated units in this AI cluster. + UnitCount *int `mandatory:"true" json:"unitCount"` + + // The shape of dedicated unit in this AI cluster. The underlying hardware configuration is hidden from customers. + UnitShape DedicatedAiClusterUnitShapeEnum `mandatory:"true" json:"unitShape"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the dedicated AI cluster. + Description *string `mandatory:"false" json:"description"` + + // The date and time the dedicated AI cluster was updated, in the format defined by RFC 3339 + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // A message describing the current state with detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + Capacity DedicatedAiClusterCapacity `mandatory:"false" json:"capacity"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m DedicatedAiCluster) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m DedicatedAiCluster) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingDedicatedAiClusterTypeEnum(string(m.Type)); !ok && m.Type != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Type: %s. Supported values are: %s.", m.Type, strings.Join(GetDedicatedAiClusterTypeEnumStringValues(), ","))) + } + if _, ok := GetMappingDedicatedAiClusterLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetDedicatedAiClusterLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingDedicatedAiClusterUnitShapeEnum(string(m.UnitShape)); !ok && m.UnitShape != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for UnitShape: %s. Supported values are: %s.", m.UnitShape, strings.Join(GetDedicatedAiClusterUnitShapeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *DedicatedAiCluster) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + Description *string `json:"description"` + TimeUpdated *common.SDKTime `json:"timeUpdated"` + LifecycleDetails *string `json:"lifecycleDetails"` + Capacity dedicatedaiclustercapacity `json:"capacity"` + FreeformTags map[string]string `json:"freeformTags"` + DefinedTags map[string]map[string]interface{} `json:"definedTags"` + SystemTags map[string]map[string]interface{} `json:"systemTags"` + Id *string `json:"id"` + Type DedicatedAiClusterTypeEnum `json:"type"` + CompartmentId *string `json:"compartmentId"` + TimeCreated *common.SDKTime `json:"timeCreated"` + LifecycleState DedicatedAiClusterLifecycleStateEnum `json:"lifecycleState"` + UnitCount *int `json:"unitCount"` + UnitShape DedicatedAiClusterUnitShapeEnum `json:"unitShape"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.DisplayName = model.DisplayName + + m.Description = model.Description + + m.TimeUpdated = model.TimeUpdated + + m.LifecycleDetails = model.LifecycleDetails + + nn, e = model.Capacity.UnmarshalPolymorphicJSON(model.Capacity.JsonData) + if e != nil { + return + } + if nn != nil { + m.Capacity = nn.(DedicatedAiClusterCapacity) + } else { + m.Capacity = nil + } + + m.FreeformTags = model.FreeformTags + + m.DefinedTags = model.DefinedTags + + m.SystemTags = model.SystemTags + + m.Id = model.Id + + m.Type = model.Type + + m.CompartmentId = model.CompartmentId + + m.TimeCreated = model.TimeCreated + + m.LifecycleState = model.LifecycleState + + m.UnitCount = model.UnitCount + + m.UnitShape = model.UnitShape + + return +} + +// DedicatedAiClusterTypeEnum Enum with underlying type: string +type DedicatedAiClusterTypeEnum string + +// Set of constants representing the allowable values for DedicatedAiClusterTypeEnum +const ( + DedicatedAiClusterTypeHosting DedicatedAiClusterTypeEnum = "HOSTING" + DedicatedAiClusterTypeFineTuning DedicatedAiClusterTypeEnum = "FINE_TUNING" +) + +var mappingDedicatedAiClusterTypeEnum = map[string]DedicatedAiClusterTypeEnum{ + "HOSTING": DedicatedAiClusterTypeHosting, + "FINE_TUNING": DedicatedAiClusterTypeFineTuning, +} + +var mappingDedicatedAiClusterTypeEnumLowerCase = map[string]DedicatedAiClusterTypeEnum{ + "hosting": DedicatedAiClusterTypeHosting, + "fine_tuning": DedicatedAiClusterTypeFineTuning, +} + +// GetDedicatedAiClusterTypeEnumValues Enumerates the set of values for DedicatedAiClusterTypeEnum +func GetDedicatedAiClusterTypeEnumValues() []DedicatedAiClusterTypeEnum { + values := make([]DedicatedAiClusterTypeEnum, 0) + for _, v := range mappingDedicatedAiClusterTypeEnum { + values = append(values, v) + } + return values +} + +// GetDedicatedAiClusterTypeEnumStringValues Enumerates the set of values in String for DedicatedAiClusterTypeEnum +func GetDedicatedAiClusterTypeEnumStringValues() []string { + return []string{ + "HOSTING", + "FINE_TUNING", + } +} + +// GetMappingDedicatedAiClusterTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingDedicatedAiClusterTypeEnum(val string) (DedicatedAiClusterTypeEnum, bool) { + enum, ok := mappingDedicatedAiClusterTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// DedicatedAiClusterLifecycleStateEnum Enum with underlying type: string +type DedicatedAiClusterLifecycleStateEnum string + +// Set of constants representing the allowable values for DedicatedAiClusterLifecycleStateEnum +const ( + DedicatedAiClusterLifecycleStateCreating DedicatedAiClusterLifecycleStateEnum = "CREATING" + DedicatedAiClusterLifecycleStateActive DedicatedAiClusterLifecycleStateEnum = "ACTIVE" + DedicatedAiClusterLifecycleStateUpdating DedicatedAiClusterLifecycleStateEnum = "UPDATING" + DedicatedAiClusterLifecycleStateDeleting DedicatedAiClusterLifecycleStateEnum = "DELETING" + DedicatedAiClusterLifecycleStateDeleted DedicatedAiClusterLifecycleStateEnum = "DELETED" + DedicatedAiClusterLifecycleStateFailed DedicatedAiClusterLifecycleStateEnum = "FAILED" + DedicatedAiClusterLifecycleStateNeedsAttention DedicatedAiClusterLifecycleStateEnum = "NEEDS_ATTENTION" +) + +var mappingDedicatedAiClusterLifecycleStateEnum = map[string]DedicatedAiClusterLifecycleStateEnum{ + "CREATING": DedicatedAiClusterLifecycleStateCreating, + "ACTIVE": DedicatedAiClusterLifecycleStateActive, + "UPDATING": DedicatedAiClusterLifecycleStateUpdating, + "DELETING": DedicatedAiClusterLifecycleStateDeleting, + "DELETED": DedicatedAiClusterLifecycleStateDeleted, + "FAILED": DedicatedAiClusterLifecycleStateFailed, + "NEEDS_ATTENTION": DedicatedAiClusterLifecycleStateNeedsAttention, +} + +var mappingDedicatedAiClusterLifecycleStateEnumLowerCase = map[string]DedicatedAiClusterLifecycleStateEnum{ + "creating": DedicatedAiClusterLifecycleStateCreating, + "active": DedicatedAiClusterLifecycleStateActive, + "updating": DedicatedAiClusterLifecycleStateUpdating, + "deleting": DedicatedAiClusterLifecycleStateDeleting, + "deleted": DedicatedAiClusterLifecycleStateDeleted, + "failed": DedicatedAiClusterLifecycleStateFailed, + "needs_attention": DedicatedAiClusterLifecycleStateNeedsAttention, +} + +// GetDedicatedAiClusterLifecycleStateEnumValues Enumerates the set of values for DedicatedAiClusterLifecycleStateEnum +func GetDedicatedAiClusterLifecycleStateEnumValues() []DedicatedAiClusterLifecycleStateEnum { + values := make([]DedicatedAiClusterLifecycleStateEnum, 0) + for _, v := range mappingDedicatedAiClusterLifecycleStateEnum { + values = append(values, v) + } + return values +} + +// GetDedicatedAiClusterLifecycleStateEnumStringValues Enumerates the set of values in String for DedicatedAiClusterLifecycleStateEnum +func GetDedicatedAiClusterLifecycleStateEnumStringValues() []string { + return []string{ + "CREATING", + "ACTIVE", + "UPDATING", + "DELETING", + "DELETED", + "FAILED", + "NEEDS_ATTENTION", + } +} + +// GetMappingDedicatedAiClusterLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingDedicatedAiClusterLifecycleStateEnum(val string) (DedicatedAiClusterLifecycleStateEnum, bool) { + enum, ok := mappingDedicatedAiClusterLifecycleStateEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// DedicatedAiClusterUnitShapeEnum Enum with underlying type: string +type DedicatedAiClusterUnitShapeEnum string + +// Set of constants representing the allowable values for DedicatedAiClusterUnitShapeEnum +const ( + DedicatedAiClusterUnitShapeLargeCohere DedicatedAiClusterUnitShapeEnum = "LARGE_COHERE" + DedicatedAiClusterUnitShapeSmallCohere DedicatedAiClusterUnitShapeEnum = "SMALL_COHERE" + DedicatedAiClusterUnitShapeEmbedCohere DedicatedAiClusterUnitShapeEnum = "EMBED_COHERE" + DedicatedAiClusterUnitShapeLlama270 DedicatedAiClusterUnitShapeEnum = "LLAMA2_70" +) + +var mappingDedicatedAiClusterUnitShapeEnum = map[string]DedicatedAiClusterUnitShapeEnum{ + "LARGE_COHERE": DedicatedAiClusterUnitShapeLargeCohere, + "SMALL_COHERE": DedicatedAiClusterUnitShapeSmallCohere, + "EMBED_COHERE": DedicatedAiClusterUnitShapeEmbedCohere, + "LLAMA2_70": DedicatedAiClusterUnitShapeLlama270, +} + +var mappingDedicatedAiClusterUnitShapeEnumLowerCase = map[string]DedicatedAiClusterUnitShapeEnum{ + "large_cohere": DedicatedAiClusterUnitShapeLargeCohere, + "small_cohere": DedicatedAiClusterUnitShapeSmallCohere, + "embed_cohere": DedicatedAiClusterUnitShapeEmbedCohere, + "llama2_70": DedicatedAiClusterUnitShapeLlama270, +} + +// GetDedicatedAiClusterUnitShapeEnumValues Enumerates the set of values for DedicatedAiClusterUnitShapeEnum +func GetDedicatedAiClusterUnitShapeEnumValues() []DedicatedAiClusterUnitShapeEnum { + values := make([]DedicatedAiClusterUnitShapeEnum, 0) + for _, v := range mappingDedicatedAiClusterUnitShapeEnum { + values = append(values, v) + } + return values +} + +// GetDedicatedAiClusterUnitShapeEnumStringValues Enumerates the set of values in String for DedicatedAiClusterUnitShapeEnum +func GetDedicatedAiClusterUnitShapeEnumStringValues() []string { + return []string{ + "LARGE_COHERE", + "SMALL_COHERE", + "EMBED_COHERE", + "LLAMA2_70", + } +} + +// GetMappingDedicatedAiClusterUnitShapeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingDedicatedAiClusterUnitShapeEnum(val string) (DedicatedAiClusterUnitShapeEnum, bool) { + enum, ok := mappingDedicatedAiClusterUnitShapeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/dedicated_ai_cluster_capacity.go b/generativeai/dedicated_ai_cluster_capacity.go new file mode 100644 index 0000000000..f2d0c94bc4 --- /dev/null +++ b/generativeai/dedicated_ai_cluster_capacity.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedAiClusterCapacity The total capacity for a dedicated AI cluster. +type DedicatedAiClusterCapacity interface { +} + +type dedicatedaiclustercapacity struct { + JsonData []byte + CapacityType string `json:"capacityType"` +} + +// UnmarshalJSON unmarshals json +func (m *dedicatedaiclustercapacity) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerdedicatedaiclustercapacity dedicatedaiclustercapacity + s := struct { + Model Unmarshalerdedicatedaiclustercapacity + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.CapacityType = s.Model.CapacityType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *dedicatedaiclustercapacity) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.CapacityType { + case "HOSTING_CAPACITY": + mm := DedicatedAiClusterHostingCapacity{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for DedicatedAiClusterCapacity: %s.", m.CapacityType) + return *m, nil + } +} + +func (m dedicatedaiclustercapacity) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m dedicatedaiclustercapacity) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DedicatedAiClusterCapacityCapacityTypeEnum Enum with underlying type: string +type DedicatedAiClusterCapacityCapacityTypeEnum string + +// Set of constants representing the allowable values for DedicatedAiClusterCapacityCapacityTypeEnum +const ( + DedicatedAiClusterCapacityCapacityTypeHostingCapacity DedicatedAiClusterCapacityCapacityTypeEnum = "HOSTING_CAPACITY" +) + +var mappingDedicatedAiClusterCapacityCapacityTypeEnum = map[string]DedicatedAiClusterCapacityCapacityTypeEnum{ + "HOSTING_CAPACITY": DedicatedAiClusterCapacityCapacityTypeHostingCapacity, +} + +var mappingDedicatedAiClusterCapacityCapacityTypeEnumLowerCase = map[string]DedicatedAiClusterCapacityCapacityTypeEnum{ + "hosting_capacity": DedicatedAiClusterCapacityCapacityTypeHostingCapacity, +} + +// GetDedicatedAiClusterCapacityCapacityTypeEnumValues Enumerates the set of values for DedicatedAiClusterCapacityCapacityTypeEnum +func GetDedicatedAiClusterCapacityCapacityTypeEnumValues() []DedicatedAiClusterCapacityCapacityTypeEnum { + values := make([]DedicatedAiClusterCapacityCapacityTypeEnum, 0) + for _, v := range mappingDedicatedAiClusterCapacityCapacityTypeEnum { + values = append(values, v) + } + return values +} + +// GetDedicatedAiClusterCapacityCapacityTypeEnumStringValues Enumerates the set of values in String for DedicatedAiClusterCapacityCapacityTypeEnum +func GetDedicatedAiClusterCapacityCapacityTypeEnumStringValues() []string { + return []string{ + "HOSTING_CAPACITY", + } +} + +// GetMappingDedicatedAiClusterCapacityCapacityTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingDedicatedAiClusterCapacityCapacityTypeEnum(val string) (DedicatedAiClusterCapacityCapacityTypeEnum, bool) { + enum, ok := mappingDedicatedAiClusterCapacityCapacityTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/dedicated_ai_cluster_collection.go b/generativeai/dedicated_ai_cluster_collection.go new file mode 100644 index 0000000000..ed94adc6e3 --- /dev/null +++ b/generativeai/dedicated_ai_cluster_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedAiClusterCollection Results of a dedicate AI cluster search. Contains DedicatedAiClusterSummary items and other information such as metadata. +type DedicatedAiClusterCollection struct { + + // List of dedicated AI clusters. + Items []DedicatedAiClusterSummary `mandatory:"true" json:"items"` +} + +func (m DedicatedAiClusterCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m DedicatedAiClusterCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/dedicated_ai_cluster_hosting_capacity.go b/generativeai/dedicated_ai_cluster_hosting_capacity.go new file mode 100644 index 0000000000..6ffb7fc12d --- /dev/null +++ b/generativeai/dedicated_ai_cluster_hosting_capacity.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedAiClusterHostingCapacity The capacity of a hosting type dedicated AI cluster. +type DedicatedAiClusterHostingCapacity struct { + + // The total number of endpoints that can be hosted on this dedicated AI cluster. + TotalEndpointCapacity *int `mandatory:"false" json:"totalEndpointCapacity"` + + // The number of endpoints hosted on this dedicated AI cluster. + UsedEndpointCapacity *int `mandatory:"false" json:"usedEndpointCapacity"` +} + +func (m DedicatedAiClusterHostingCapacity) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m DedicatedAiClusterHostingCapacity) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m DedicatedAiClusterHostingCapacity) MarshalJSON() (buff []byte, e error) { + type MarshalTypeDedicatedAiClusterHostingCapacity DedicatedAiClusterHostingCapacity + s := struct { + DiscriminatorParam string `json:"capacityType"` + MarshalTypeDedicatedAiClusterHostingCapacity + }{ + "HOSTING_CAPACITY", + (MarshalTypeDedicatedAiClusterHostingCapacity)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeai/dedicated_ai_cluster_summary.go b/generativeai/dedicated_ai_cluster_summary.go new file mode 100644 index 0000000000..10e613afde --- /dev/null +++ b/generativeai/dedicated_ai_cluster_summary.go @@ -0,0 +1,175 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedAiClusterSummary Summary information about a dedicated AI cluster. +type DedicatedAiClusterSummary struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + Id *string `mandatory:"true" json:"id"` + + // The dedicated AI cluster type indicating whether this is a fine-tuning/training processor or hosting/inference processor. + // Allowed values are: + // - HOSTING + // - FINE_TUNING + Type DedicatedAiClusterTypeEnum `mandatory:"true" json:"type"` + + // The compartment OCID to create the dedicated AI cluster in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The date and time the dedicated AI cluster was created, in the format defined by RFC 3339. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current state of the dedicated AI cluster. + // Allowed values are: + // - CREATING + // - ACTIVE + // - UPDATING + // - DELETING + // - DELETED + // - FAILED + // - NEEDS_ATTENTION + LifecycleState DedicatedAiClusterLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The number of dedicated units in this AI cluster. + UnitCount *int `mandatory:"true" json:"unitCount"` + + // The shape of dedicated unit in this AI cluster. The underlying hardware configuration is hidden from customers. + UnitShape DedicatedAiClusterUnitShapeEnum `mandatory:"true" json:"unitShape"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the dedicated AI cluster. + Description *string `mandatory:"false" json:"description"` + + // The date and time the dedicated AI cluster was updated, in the format defined by RFC 3339. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // A message describing the current state of the dedicated AI cluster in more detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + Capacity DedicatedAiClusterCapacity `mandatory:"false" json:"capacity"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m DedicatedAiClusterSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m DedicatedAiClusterSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingDedicatedAiClusterTypeEnum(string(m.Type)); !ok && m.Type != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Type: %s. Supported values are: %s.", m.Type, strings.Join(GetDedicatedAiClusterTypeEnumStringValues(), ","))) + } + if _, ok := GetMappingDedicatedAiClusterLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetDedicatedAiClusterLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingDedicatedAiClusterUnitShapeEnum(string(m.UnitShape)); !ok && m.UnitShape != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for UnitShape: %s. Supported values are: %s.", m.UnitShape, strings.Join(GetDedicatedAiClusterUnitShapeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *DedicatedAiClusterSummary) UnmarshalJSON(data []byte) (e error) { + model := struct { + DisplayName *string `json:"displayName"` + Description *string `json:"description"` + TimeUpdated *common.SDKTime `json:"timeUpdated"` + LifecycleDetails *string `json:"lifecycleDetails"` + Capacity dedicatedaiclustercapacity `json:"capacity"` + FreeformTags map[string]string `json:"freeformTags"` + DefinedTags map[string]map[string]interface{} `json:"definedTags"` + SystemTags map[string]map[string]interface{} `json:"systemTags"` + Id *string `json:"id"` + Type DedicatedAiClusterTypeEnum `json:"type"` + CompartmentId *string `json:"compartmentId"` + TimeCreated *common.SDKTime `json:"timeCreated"` + LifecycleState DedicatedAiClusterLifecycleStateEnum `json:"lifecycleState"` + UnitCount *int `json:"unitCount"` + UnitShape DedicatedAiClusterUnitShapeEnum `json:"unitShape"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.DisplayName = model.DisplayName + + m.Description = model.Description + + m.TimeUpdated = model.TimeUpdated + + m.LifecycleDetails = model.LifecycleDetails + + nn, e = model.Capacity.UnmarshalPolymorphicJSON(model.Capacity.JsonData) + if e != nil { + return + } + if nn != nil { + m.Capacity = nn.(DedicatedAiClusterCapacity) + } else { + m.Capacity = nil + } + + m.FreeformTags = model.FreeformTags + + m.DefinedTags = model.DefinedTags + + m.SystemTags = model.SystemTags + + m.Id = model.Id + + m.Type = model.Type + + m.CompartmentId = model.CompartmentId + + m.TimeCreated = model.TimeCreated + + m.LifecycleState = model.LifecycleState + + m.UnitCount = model.UnitCount + + m.UnitShape = model.UnitShape + + return +} diff --git a/generativeai/delete_dedicated_ai_cluster_request_response.go b/generativeai/delete_dedicated_ai_cluster_request_response.go new file mode 100644 index 0000000000..8282b69130 --- /dev/null +++ b/generativeai/delete_dedicated_ai_cluster_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// DeleteDedicatedAiClusterRequest wrapper for the DeleteDedicatedAiCluster operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteDedicatedAiCluster.go.html to see an example of how to use DeleteDedicatedAiClusterRequest. +type DeleteDedicatedAiClusterRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + DedicatedAiClusterId *string `mandatory:"true" contributesTo:"path" name:"dedicatedAiClusterId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request DeleteDedicatedAiClusterRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request DeleteDedicatedAiClusterRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request DeleteDedicatedAiClusterRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request DeleteDedicatedAiClusterRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request DeleteDedicatedAiClusterRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DeleteDedicatedAiClusterResponse wrapper for the DeleteDedicatedAiCluster operation +type DeleteDedicatedAiClusterResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteDedicatedAiClusterResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response DeleteDedicatedAiClusterResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/delete_endpoint_request_response.go b/generativeai/delete_endpoint_request_response.go new file mode 100644 index 0000000000..2b355dd5db --- /dev/null +++ b/generativeai/delete_endpoint_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// DeleteEndpointRequest wrapper for the DeleteEndpoint operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteEndpoint.go.html to see an example of how to use DeleteEndpointRequest. +type DeleteEndpointRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the endpoint. + EndpointId *string `mandatory:"true" contributesTo:"path" name:"endpointId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request DeleteEndpointRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request DeleteEndpointRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request DeleteEndpointRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request DeleteEndpointRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request DeleteEndpointRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DeleteEndpointResponse wrapper for the DeleteEndpoint operation +type DeleteEndpointResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteEndpointResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response DeleteEndpointResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/delete_model_request_response.go b/generativeai/delete_model_request_response.go new file mode 100644 index 0000000000..b9099c867a --- /dev/null +++ b/generativeai/delete_model_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// DeleteModelRequest wrapper for the DeleteModel operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteModel.go.html to see an example of how to use DeleteModelRequest. +type DeleteModelRequest struct { + + // The model OCID + ModelId *string `mandatory:"true" contributesTo:"path" name:"modelId"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request DeleteModelRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request DeleteModelRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request DeleteModelRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request DeleteModelRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request DeleteModelRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DeleteModelResponse wrapper for the DeleteModel operation +type DeleteModelResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteModelResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response DeleteModelResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/endpoint.go b/generativeai/endpoint.go new file mode 100644 index 0000000000..55001713a0 --- /dev/null +++ b/generativeai/endpoint.go @@ -0,0 +1,148 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Endpoint To host a custom model for inference, create an endpoint for that model on a dedicated AI cluster of type HOSTING. +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator who gives OCI resource access to users. See +// Getting Started with Policies (https://docs.cloud.oracle.com/iaas/Content/Identity/policiesgs/get-started-with-policies.htm) and Getting Access to Generative AI Resouces (https://docs.cloud.oracle.com/iaas/Content/generative-ai/iam-policies.htm). +type Endpoint struct { + + // An OCID that uniquely identifies this endpoint resource. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the model that's used to create this endpoint. + ModelId *string `mandatory:"true" json:"modelId"` + + // The compartment OCID to create the endpoint in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the dedicated AI cluster on which the model will be deployed to. + DedicatedAiClusterId *string `mandatory:"true" json:"dedicatedAiClusterId"` + + // The date and time that the endpoint was created in the format of an RFC3339 datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current state of the endpoint. + LifecycleState EndpointLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the endpoint. + Description *string `mandatory:"false" json:"description"` + + // The date and time that the endpoint was updated in the format of an RFC3339 datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // A message describing the current state of the endpoint in more detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + ContentModerationConfig *ContentModerationConfig `mandatory:"false" json:"contentModerationConfig"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m Endpoint) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m Endpoint) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingEndpointLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetEndpointLifecycleStateEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// EndpointLifecycleStateEnum Enum with underlying type: string +type EndpointLifecycleStateEnum string + +// Set of constants representing the allowable values for EndpointLifecycleStateEnum +const ( + EndpointLifecycleStateActive EndpointLifecycleStateEnum = "ACTIVE" + EndpointLifecycleStateCreating EndpointLifecycleStateEnum = "CREATING" + EndpointLifecycleStateUpdating EndpointLifecycleStateEnum = "UPDATING" + EndpointLifecycleStateDeleting EndpointLifecycleStateEnum = "DELETING" + EndpointLifecycleStateDeleted EndpointLifecycleStateEnum = "DELETED" + EndpointLifecycleStateFailed EndpointLifecycleStateEnum = "FAILED" +) + +var mappingEndpointLifecycleStateEnum = map[string]EndpointLifecycleStateEnum{ + "ACTIVE": EndpointLifecycleStateActive, + "CREATING": EndpointLifecycleStateCreating, + "UPDATING": EndpointLifecycleStateUpdating, + "DELETING": EndpointLifecycleStateDeleting, + "DELETED": EndpointLifecycleStateDeleted, + "FAILED": EndpointLifecycleStateFailed, +} + +var mappingEndpointLifecycleStateEnumLowerCase = map[string]EndpointLifecycleStateEnum{ + "active": EndpointLifecycleStateActive, + "creating": EndpointLifecycleStateCreating, + "updating": EndpointLifecycleStateUpdating, + "deleting": EndpointLifecycleStateDeleting, + "deleted": EndpointLifecycleStateDeleted, + "failed": EndpointLifecycleStateFailed, +} + +// GetEndpointLifecycleStateEnumValues Enumerates the set of values for EndpointLifecycleStateEnum +func GetEndpointLifecycleStateEnumValues() []EndpointLifecycleStateEnum { + values := make([]EndpointLifecycleStateEnum, 0) + for _, v := range mappingEndpointLifecycleStateEnum { + values = append(values, v) + } + return values +} + +// GetEndpointLifecycleStateEnumStringValues Enumerates the set of values in String for EndpointLifecycleStateEnum +func GetEndpointLifecycleStateEnumStringValues() []string { + return []string{ + "ACTIVE", + "CREATING", + "UPDATING", + "DELETING", + "DELETED", + "FAILED", + } +} + +// GetMappingEndpointLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingEndpointLifecycleStateEnum(val string) (EndpointLifecycleStateEnum, bool) { + enum, ok := mappingEndpointLifecycleStateEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/endpoint_collection.go b/generativeai/endpoint_collection.go new file mode 100644 index 0000000000..da18e97bf3 --- /dev/null +++ b/generativeai/endpoint_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// EndpointCollection Results of an endpoint search. Contains EndpointSummary items and other information such as metadata. +type EndpointCollection struct { + + // List of endpoints. + Items []EndpointSummary `mandatory:"true" json:"items"` +} + +func (m EndpointCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m EndpointCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/endpoint_summary.go b/generativeai/endpoint_summary.go new file mode 100644 index 0000000000..483058f41f --- /dev/null +++ b/generativeai/endpoint_summary.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// EndpointSummary Summary information for an endpoint resource. +type EndpointSummary struct { + + // An OCID that uniquely identifies this endpoint resource. + Id *string `mandatory:"true" json:"id"` + + // The OCID of the model that's used to create this endpoint. + ModelId *string `mandatory:"true" json:"modelId"` + + // The compartment OCID to create the endpoint in. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The OCID of the dedicated AI cluster on which a model will be deployed to. + DedicatedAiClusterId *string `mandatory:"true" json:"dedicatedAiClusterId"` + + // The date and time that the endpoint was created in the format of an RFC3339 datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current state of the endpoint. + // Allowed values are: + // - ACTIVE + // - CREATING + // - UPDATING + // - DELETING + // - DELETED + // - FAILED + LifecycleState EndpointLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the endpoint. + Description *string `mandatory:"false" json:"description"` + + // The date and time the endpoint was updated in the format of n RFC3339 datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // A message describing the current state with detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + ContentModerationConfig *ContentModerationConfig `mandatory:"false" json:"contentModerationConfig"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m EndpointSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m EndpointSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingEndpointLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetEndpointLifecycleStateEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/fine_tune_details.go b/generativeai/fine_tune_details.go new file mode 100644 index 0000000000..26dbd98922 --- /dev/null +++ b/generativeai/fine_tune_details.go @@ -0,0 +1,84 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// FineTuneDetails Details about fine-tuning a custom model. +type FineTuneDetails struct { + TrainingDataset Dataset `mandatory:"true" json:"trainingDataset"` + + // The OCID of the dedicated AI cluster this fine-tuning runs on. + DedicatedAiClusterId *string `mandatory:"true" json:"dedicatedAiClusterId"` + + TrainingConfig TrainingConfig `mandatory:"false" json:"trainingConfig"` +} + +func (m FineTuneDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m FineTuneDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *FineTuneDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + TrainingConfig trainingconfig `json:"trainingConfig"` + TrainingDataset dataset `json:"trainingDataset"` + DedicatedAiClusterId *string `json:"dedicatedAiClusterId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + nn, e = model.TrainingConfig.UnmarshalPolymorphicJSON(model.TrainingConfig.JsonData) + if e != nil { + return + } + if nn != nil { + m.TrainingConfig = nn.(TrainingConfig) + } else { + m.TrainingConfig = nil + } + + nn, e = model.TrainingDataset.UnmarshalPolymorphicJSON(model.TrainingDataset.JsonData) + if e != nil { + return + } + if nn != nil { + m.TrainingDataset = nn.(Dataset) + } else { + m.TrainingDataset = nil + } + + m.DedicatedAiClusterId = model.DedicatedAiClusterId + + return +} diff --git a/generativeai/generativeai_client.go b/generativeai/generativeai_client.go new file mode 100644 index 0000000000..b891be14e3 --- /dev/null +++ b/generativeai/generativeai_client.go @@ -0,0 +1,1404 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "github.com/oracle/oci-go-sdk/v65/common/auth" + "net/http" +) + +// GenerativeAiClient a client for GenerativeAi +type GenerativeAiClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewGenerativeAiClientWithConfigurationProvider Creates a new default GenerativeAi client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewGenerativeAiClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client GenerativeAiClient, err error) { + if enabled := common.CheckForEnabledServices("generativeai"); !enabled { + return client, fmt.Errorf("the Developer Tool configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local developer-tool-configuration.json file configured the service you're targeting or contact the cloud provider on the availability of this service") + } + provider, err := auth.GetGenericConfigurationProvider(configProvider) + if err != nil { + return client, err + } + baseClient, e := common.NewClientWithConfig(provider) + if e != nil { + return client, e + } + return newGenerativeAiClientFromBaseClient(baseClient, provider) +} + +// NewGenerativeAiClientWithOboToken Creates a new default GenerativeAi client with the given configuration provider. +// The obotoken will be added to default headers and signed; the configuration provider will be used for the signer +// +// as well as reading the region +func NewGenerativeAiClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client GenerativeAiClient, err error) { + baseClient, err := common.NewClientWithOboToken(configProvider, oboToken) + if err != nil { + return client, err + } + + return newGenerativeAiClientFromBaseClient(baseClient, configProvider) +} + +func newGenerativeAiClientFromBaseClient(baseClient common.BaseClient, configProvider common.ConfigurationProvider) (client GenerativeAiClient, err error) { + // GenerativeAi service default circuit breaker is enabled + baseClient.Configuration.CircuitBreaker = common.NewCircuitBreaker(common.DefaultCircuitBreakerSettingWithServiceName("GenerativeAi")) + common.ConfigCircuitBreakerFromEnvVar(&baseClient) + common.ConfigCircuitBreakerFromGlobalVar(&baseClient) + + client = GenerativeAiClient{BaseClient: baseClient} + client.BasePath = "20231130" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *GenerativeAiClient) SetRegion(region string) { + client.Host = common.StringToRegion(region).EndpointForTemplate("generativeai", "https://generativeai.{region}.oci.{secondLevelDomain}") +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *GenerativeAiClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.SetRegion(region) + if client.Host == "" { + return fmt.Errorf("invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region") + } + client.config = &configProvider + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *GenerativeAiClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// ChangeDedicatedAiClusterCompartment Moves a dedicated AI cluster into a different compartment within the same tenancy. For information about moving resources between compartments, see Moving Resources to a Different Compartment (https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes). +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeDedicatedAiClusterCompartment.go.html to see an example of how to use ChangeDedicatedAiClusterCompartment API. +// A default retry strategy applies to this operation ChangeDedicatedAiClusterCompartment() +func (client GenerativeAiClient) ChangeDedicatedAiClusterCompartment(ctx context.Context, request ChangeDedicatedAiClusterCompartmentRequest) (response ChangeDedicatedAiClusterCompartmentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.changeDedicatedAiClusterCompartment, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ChangeDedicatedAiClusterCompartmentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ChangeDedicatedAiClusterCompartmentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ChangeDedicatedAiClusterCompartmentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ChangeDedicatedAiClusterCompartmentResponse") + } + return +} + +// changeDedicatedAiClusterCompartment implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) changeDedicatedAiClusterCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/dedicatedAiClusters/{dedicatedAiClusterId}/actions/changeCompartment", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ChangeDedicatedAiClusterCompartmentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ChangeDedicatedAiClusterCompartment", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ChangeEndpointCompartment Moves an endpoint into a different compartment within the same tenancy. For information about moving resources between compartments, see Moving Resources to a Different Compartment (https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes). +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeEndpointCompartment.go.html to see an example of how to use ChangeEndpointCompartment API. +// A default retry strategy applies to this operation ChangeEndpointCompartment() +func (client GenerativeAiClient) ChangeEndpointCompartment(ctx context.Context, request ChangeEndpointCompartmentRequest) (response ChangeEndpointCompartmentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.changeEndpointCompartment, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ChangeEndpointCompartmentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ChangeEndpointCompartmentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ChangeEndpointCompartmentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ChangeEndpointCompartmentResponse") + } + return +} + +// changeEndpointCompartment implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) changeEndpointCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/endpoints/{endpointId}/actions/changeCompartment", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ChangeEndpointCompartmentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ChangeEndpointCompartment", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ChangeModelCompartment Moves a custom model into a different compartment. For information about moving resources between compartments, see Moving Resources to a Different Compartment (https://docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes). +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ChangeModelCompartment.go.html to see an example of how to use ChangeModelCompartment API. +// A default retry strategy applies to this operation ChangeModelCompartment() +func (client GenerativeAiClient) ChangeModelCompartment(ctx context.Context, request ChangeModelCompartmentRequest) (response ChangeModelCompartmentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.changeModelCompartment, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ChangeModelCompartmentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ChangeModelCompartmentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ChangeModelCompartmentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ChangeModelCompartmentResponse") + } + return +} + +// changeModelCompartment implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) changeModelCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/models/{modelId}/actions/changeCompartment", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ChangeModelCompartmentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ChangeModelCompartment", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// CreateDedicatedAiCluster Creates a dedicated AI cluster. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateDedicatedAiCluster.go.html to see an example of how to use CreateDedicatedAiCluster API. +// A default retry strategy applies to this operation CreateDedicatedAiCluster() +func (client GenerativeAiClient) CreateDedicatedAiCluster(ctx context.Context, request CreateDedicatedAiClusterRequest) (response CreateDedicatedAiClusterResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.createDedicatedAiCluster, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = CreateDedicatedAiClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = CreateDedicatedAiClusterResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(CreateDedicatedAiClusterResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into CreateDedicatedAiClusterResponse") + } + return +} + +// createDedicatedAiCluster implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) createDedicatedAiCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/dedicatedAiClusters", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response CreateDedicatedAiClusterResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "CreateDedicatedAiCluster", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// CreateEndpoint Creates an endpoint. +// The header contains an opc-work-request-id, which is the id for the WorkRequest that tracks the endpoint creation progress. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateEndpoint.go.html to see an example of how to use CreateEndpoint API. +// A default retry strategy applies to this operation CreateEndpoint() +func (client GenerativeAiClient) CreateEndpoint(ctx context.Context, request CreateEndpointRequest) (response CreateEndpointResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.createEndpoint, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = CreateEndpointResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = CreateEndpointResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(CreateEndpointResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into CreateEndpointResponse") + } + return +} + +// createEndpoint implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) createEndpoint(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/endpoints", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response CreateEndpointResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "CreateEndpoint", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// CreateModel Creates a custom model by fine-tuning a base model with your own dataset. You can create a new custom models or create a new version of existing custom model.. +// The header contains an opc-work-request-id, which is the id for the WorkRequest that tracks the model creation progress. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/CreateModel.go.html to see an example of how to use CreateModel API. +// A default retry strategy applies to this operation CreateModel() +func (client GenerativeAiClient) CreateModel(ctx context.Context, request CreateModelRequest) (response CreateModelResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.createModel, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = CreateModelResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = CreateModelResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(CreateModelResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into CreateModelResponse") + } + return +} + +// createModel implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) createModel(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/models", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response CreateModelResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "CreateModel", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// DeleteDedicatedAiCluster Deletes a dedicated AI cluster. +// You can only delete clusters without attached resources. Before you delete a hosting dedicated AI cluster, you must delete the endpoints associated to that cluster. Before you delete a fine-tuning dedicated AI cluster, you must delete the custom model on that cluster. The delete action permanently deletes the cluster. This action can't be undone. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteDedicatedAiCluster.go.html to see an example of how to use DeleteDedicatedAiCluster API. +// A default retry strategy applies to this operation DeleteDedicatedAiCluster() +func (client GenerativeAiClient) DeleteDedicatedAiCluster(ctx context.Context, request DeleteDedicatedAiClusterRequest) (response DeleteDedicatedAiClusterResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.deleteDedicatedAiCluster, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = DeleteDedicatedAiClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = DeleteDedicatedAiClusterResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(DeleteDedicatedAiClusterResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into DeleteDedicatedAiClusterResponse") + } + return +} + +// deleteDedicatedAiCluster implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) deleteDedicatedAiCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodDelete, "/dedicatedAiClusters/{dedicatedAiClusterId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response DeleteDedicatedAiClusterResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "DeleteDedicatedAiCluster", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// DeleteEndpoint Deletes an endpoint. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteEndpoint.go.html to see an example of how to use DeleteEndpoint API. +// A default retry strategy applies to this operation DeleteEndpoint() +func (client GenerativeAiClient) DeleteEndpoint(ctx context.Context, request DeleteEndpointRequest) (response DeleteEndpointResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.deleteEndpoint, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = DeleteEndpointResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = DeleteEndpointResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(DeleteEndpointResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into DeleteEndpointResponse") + } + return +} + +// deleteEndpoint implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) deleteEndpoint(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodDelete, "/endpoints/{endpointId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response DeleteEndpointResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "DeleteEndpoint", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// DeleteModel Deletes a custom model. A model shouldn't be deleted if there's one or more active endpoints associated with that model. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/DeleteModel.go.html to see an example of how to use DeleteModel API. +// A default retry strategy applies to this operation DeleteModel() +func (client GenerativeAiClient) DeleteModel(ctx context.Context, request DeleteModelRequest) (response DeleteModelResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.deleteModel, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = DeleteModelResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = DeleteModelResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(DeleteModelResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into DeleteModelResponse") + } + return +} + +// deleteModel implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) deleteModel(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodDelete, "/models/{modelId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response DeleteModelResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "DeleteModel", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetDedicatedAiCluster Gets information about a dedicated AI cluster. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetDedicatedAiCluster.go.html to see an example of how to use GetDedicatedAiCluster API. +// A default retry strategy applies to this operation GetDedicatedAiCluster() +func (client GenerativeAiClient) GetDedicatedAiCluster(ctx context.Context, request GetDedicatedAiClusterRequest) (response GetDedicatedAiClusterResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getDedicatedAiCluster, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetDedicatedAiClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetDedicatedAiClusterResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetDedicatedAiClusterResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetDedicatedAiClusterResponse") + } + return +} + +// getDedicatedAiCluster implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) getDedicatedAiCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedAiClusters/{dedicatedAiClusterId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetDedicatedAiClusterResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "GetDedicatedAiCluster", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetEndpoint Gets information about an endpoint. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetEndpoint.go.html to see an example of how to use GetEndpoint API. +// A default retry strategy applies to this operation GetEndpoint() +func (client GenerativeAiClient) GetEndpoint(ctx context.Context, request GetEndpointRequest) (response GetEndpointResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getEndpoint, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetEndpointResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetEndpointResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetEndpointResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetEndpointResponse") + } + return +} + +// getEndpoint implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) getEndpoint(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/endpoints/{endpointId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetEndpointResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "GetEndpoint", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetModel Gets information about a custom model. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetModel.go.html to see an example of how to use GetModel API. +// A default retry strategy applies to this operation GetModel() +func (client GenerativeAiClient) GetModel(ctx context.Context, request GetModelRequest) (response GetModelResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getModel, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetModelResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetModelResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetModelResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetModelResponse") + } + return +} + +// getModel implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) getModel(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/models/{modelId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetModelResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "GetModel", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GetWorkRequest Gets the details of a work request. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetWorkRequest.go.html to see an example of how to use GetWorkRequest API. +// A default retry strategy applies to this operation GetWorkRequest() +func (client GenerativeAiClient) GetWorkRequest(ctx context.Context, request GetWorkRequestRequest) (response GetWorkRequestResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getWorkRequest, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetWorkRequestResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetWorkRequestResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetWorkRequestResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetWorkRequestResponse") + } + return +} + +// getWorkRequest implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) getWorkRequest(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests/{workRequestId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetWorkRequestResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "GetWorkRequest", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListDedicatedAiClusters Lists the dedicated AI clusters in a specific compartment. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListDedicatedAiClusters.go.html to see an example of how to use ListDedicatedAiClusters API. +// A default retry strategy applies to this operation ListDedicatedAiClusters() +func (client GenerativeAiClient) ListDedicatedAiClusters(ctx context.Context, request ListDedicatedAiClustersRequest) (response ListDedicatedAiClustersResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listDedicatedAiClusters, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListDedicatedAiClustersResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListDedicatedAiClustersResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListDedicatedAiClustersResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListDedicatedAiClustersResponse") + } + return +} + +// listDedicatedAiClusters implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listDedicatedAiClusters(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/dedicatedAiClusters", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListDedicatedAiClustersResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListDedicatedAiClusters", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListEndpoints Lists the endpoints of a specific compartment. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListEndpoints.go.html to see an example of how to use ListEndpoints API. +// A default retry strategy applies to this operation ListEndpoints() +func (client GenerativeAiClient) ListEndpoints(ctx context.Context, request ListEndpointsRequest) (response ListEndpointsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listEndpoints, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListEndpointsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListEndpointsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListEndpointsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListEndpointsResponse") + } + return +} + +// listEndpoints implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listEndpoints(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/endpoints", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListEndpointsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListEndpoints", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListModels Lists the models in a specific compartment. Includes pretrained base models and fine-tuned custom models. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListModels.go.html to see an example of how to use ListModels API. +// A default retry strategy applies to this operation ListModels() +func (client GenerativeAiClient) ListModels(ctx context.Context, request ListModelsRequest) (response ListModelsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listModels, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListModelsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListModelsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListModelsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListModelsResponse") + } + return +} + +// listModels implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listModels(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/models", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListModelsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListModels", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListWorkRequestErrors Lists the errors for a work request. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequestErrors.go.html to see an example of how to use ListWorkRequestErrors API. +// A default retry strategy applies to this operation ListWorkRequestErrors() +func (client GenerativeAiClient) ListWorkRequestErrors(ctx context.Context, request ListWorkRequestErrorsRequest) (response ListWorkRequestErrorsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listWorkRequestErrors, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListWorkRequestErrorsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListWorkRequestErrorsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListWorkRequestErrorsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListWorkRequestErrorsResponse") + } + return +} + +// listWorkRequestErrors implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listWorkRequestErrors(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests/{workRequestId}/errors", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListWorkRequestErrorsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListWorkRequestErrors", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListWorkRequestLogs Lists the logs for a work request. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequestLogs.go.html to see an example of how to use ListWorkRequestLogs API. +// A default retry strategy applies to this operation ListWorkRequestLogs() +func (client GenerativeAiClient) ListWorkRequestLogs(ctx context.Context, request ListWorkRequestLogsRequest) (response ListWorkRequestLogsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listWorkRequestLogs, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListWorkRequestLogsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListWorkRequestLogsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListWorkRequestLogsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListWorkRequestLogsResponse") + } + return +} + +// listWorkRequestLogs implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listWorkRequestLogs(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests/{workRequestId}/logs", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListWorkRequestLogsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListWorkRequestLogs", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// ListWorkRequests Lists the work requests in a compartment. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequests.go.html to see an example of how to use ListWorkRequests API. +// A default retry strategy applies to this operation ListWorkRequests() +func (client GenerativeAiClient) ListWorkRequests(ctx context.Context, request ListWorkRequestsRequest) (response ListWorkRequestsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listWorkRequests, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListWorkRequestsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListWorkRequestsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListWorkRequestsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListWorkRequestsResponse") + } + return +} + +// listWorkRequests implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) listWorkRequests(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/workRequests", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListWorkRequestsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "ListWorkRequests", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// UpdateDedicatedAiCluster Updates a dedicated AI cluster. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateDedicatedAiCluster.go.html to see an example of how to use UpdateDedicatedAiCluster API. +// A default retry strategy applies to this operation UpdateDedicatedAiCluster() +func (client GenerativeAiClient) UpdateDedicatedAiCluster(ctx context.Context, request UpdateDedicatedAiClusterRequest) (response UpdateDedicatedAiClusterResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateDedicatedAiCluster, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateDedicatedAiClusterResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateDedicatedAiClusterResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateDedicatedAiClusterResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateDedicatedAiClusterResponse") + } + return +} + +// updateDedicatedAiCluster implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) updateDedicatedAiCluster(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/dedicatedAiClusters/{dedicatedAiClusterId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateDedicatedAiClusterResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "UpdateDedicatedAiCluster", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// UpdateEndpoint Updates the properties of an endpoint. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateEndpoint.go.html to see an example of how to use UpdateEndpoint API. +// A default retry strategy applies to this operation UpdateEndpoint() +func (client GenerativeAiClient) UpdateEndpoint(ctx context.Context, request UpdateEndpointRequest) (response UpdateEndpointResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateEndpoint, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateEndpointResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateEndpointResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateEndpointResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateEndpointResponse") + } + return +} + +// updateEndpoint implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) updateEndpoint(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/endpoints/{endpointId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateEndpointResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "UpdateEndpoint", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// UpdateModel Updates the properties of a custom model such as name, description, version, freeform tags, and defined tags. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateModel.go.html to see an example of how to use UpdateModel API. +// A default retry strategy applies to this operation UpdateModel() +func (client GenerativeAiClient) UpdateModel(ctx context.Context, request UpdateModelRequest) (response UpdateModelResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateModel, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateModelResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateModelResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateModelResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateModelResponse") + } + return +} + +// updateModel implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiClient) updateModel(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/models/{modelId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateModelResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAi", "UpdateModel", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} diff --git a/generativeai/get_dedicated_ai_cluster_request_response.go b/generativeai/get_dedicated_ai_cluster_request_response.go new file mode 100644 index 0000000000..8abaf2c6d8 --- /dev/null +++ b/generativeai/get_dedicated_ai_cluster_request_response.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetDedicatedAiClusterRequest wrapper for the GetDedicatedAiCluster operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetDedicatedAiCluster.go.html to see an example of how to use GetDedicatedAiClusterRequest. +type GetDedicatedAiClusterRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + DedicatedAiClusterId *string `mandatory:"true" contributesTo:"path" name:"dedicatedAiClusterId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetDedicatedAiClusterRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetDedicatedAiClusterRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetDedicatedAiClusterRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetDedicatedAiClusterRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetDedicatedAiClusterRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetDedicatedAiClusterResponse wrapper for the GetDedicatedAiCluster operation +type GetDedicatedAiClusterResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DedicatedAiCluster instance + DedicatedAiCluster `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetDedicatedAiClusterResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetDedicatedAiClusterResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/get_endpoint_request_response.go b/generativeai/get_endpoint_request_response.go new file mode 100644 index 0000000000..a7e6105815 --- /dev/null +++ b/generativeai/get_endpoint_request_response.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetEndpointRequest wrapper for the GetEndpoint operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetEndpoint.go.html to see an example of how to use GetEndpointRequest. +type GetEndpointRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the endpoint. + EndpointId *string `mandatory:"true" contributesTo:"path" name:"endpointId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetEndpointRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetEndpointRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetEndpointRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetEndpointRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetEndpointRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetEndpointResponse wrapper for the GetEndpoint operation +type GetEndpointResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Endpoint instance + Endpoint `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetEndpointResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetEndpointResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/get_model_request_response.go b/generativeai/get_model_request_response.go new file mode 100644 index 0000000000..ecbf71133b --- /dev/null +++ b/generativeai/get_model_request_response.go @@ -0,0 +1,96 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetModelRequest wrapper for the GetModel operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetModel.go.html to see an example of how to use GetModelRequest. +type GetModelRequest struct { + + // The model OCID + ModelId *string `mandatory:"true" contributesTo:"path" name:"modelId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetModelRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetModelRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetModelRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetModelRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetModelRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetModelResponse wrapper for the GetModel operation +type GetModelResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Model instance + Model `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetModelResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetModelResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/get_work_request_request_response.go b/generativeai/get_work_request_request_response.go new file mode 100644 index 0000000000..c80491b7e5 --- /dev/null +++ b/generativeai/get_work_request_request_response.go @@ -0,0 +1,99 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetWorkRequestRequest wrapper for the GetWorkRequest operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/GetWorkRequest.go.html to see an example of how to use GetWorkRequestRequest. +type GetWorkRequestRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + WorkRequestId *string `mandatory:"true" contributesTo:"path" name:"workRequestId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetWorkRequestRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetWorkRequestRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetWorkRequestRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetWorkRequestRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetWorkRequestRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetWorkRequestResponse wrapper for the GetWorkRequest operation +type GetWorkRequestResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The WorkRequest instance + WorkRequest `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // A decimal number representing the number of seconds the client should wait before polling this endpoint again. + RetryAfter *int `presentIn:"header" name:"retry-after"` +} + +func (response GetWorkRequestResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetWorkRequestResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/list_dedicated_ai_clusters_request_response.go b/generativeai/list_dedicated_ai_clusters_request_response.go new file mode 100644 index 0000000000..24f75940c2 --- /dev/null +++ b/generativeai/list_dedicated_ai_clusters_request_response.go @@ -0,0 +1,220 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListDedicatedAiClustersRequest wrapper for the ListDedicatedAiClusters operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListDedicatedAiClusters.go.html to see an example of how to use ListDedicatedAiClustersRequest. +type ListDedicatedAiClustersRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // A filter to return only the dedicated AI clusters that their lifecycle state matches the given lifecycle state. + LifecycleState DedicatedAiClusterLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + Id *string `mandatory:"false" contributesTo:"query" name:"id"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListDedicatedAiClustersSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. You can provide only one sort order. Default order for `timeCreated` + // is descending. Default order for `displayName` is ascending. + SortBy ListDedicatedAiClustersSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListDedicatedAiClustersRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListDedicatedAiClustersRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListDedicatedAiClustersRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListDedicatedAiClustersRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListDedicatedAiClustersRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingDedicatedAiClusterLifecycleStateEnum(string(request.LifecycleState)); !ok && request.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", request.LifecycleState, strings.Join(GetDedicatedAiClusterLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingListDedicatedAiClustersSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListDedicatedAiClustersSortOrderEnumStringValues(), ","))) + } + if _, ok := GetMappingListDedicatedAiClustersSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListDedicatedAiClustersSortByEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListDedicatedAiClustersResponse wrapper for the ListDedicatedAiClusters operation +type ListDedicatedAiClustersResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of DedicatedAiClusterCollection instances + DedicatedAiClusterCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListDedicatedAiClustersResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListDedicatedAiClustersResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListDedicatedAiClustersSortOrderEnum Enum with underlying type: string +type ListDedicatedAiClustersSortOrderEnum string + +// Set of constants representing the allowable values for ListDedicatedAiClustersSortOrderEnum +const ( + ListDedicatedAiClustersSortOrderAsc ListDedicatedAiClustersSortOrderEnum = "ASC" + ListDedicatedAiClustersSortOrderDesc ListDedicatedAiClustersSortOrderEnum = "DESC" +) + +var mappingListDedicatedAiClustersSortOrderEnum = map[string]ListDedicatedAiClustersSortOrderEnum{ + "ASC": ListDedicatedAiClustersSortOrderAsc, + "DESC": ListDedicatedAiClustersSortOrderDesc, +} + +var mappingListDedicatedAiClustersSortOrderEnumLowerCase = map[string]ListDedicatedAiClustersSortOrderEnum{ + "asc": ListDedicatedAiClustersSortOrderAsc, + "desc": ListDedicatedAiClustersSortOrderDesc, +} + +// GetListDedicatedAiClustersSortOrderEnumValues Enumerates the set of values for ListDedicatedAiClustersSortOrderEnum +func GetListDedicatedAiClustersSortOrderEnumValues() []ListDedicatedAiClustersSortOrderEnum { + values := make([]ListDedicatedAiClustersSortOrderEnum, 0) + for _, v := range mappingListDedicatedAiClustersSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListDedicatedAiClustersSortOrderEnumStringValues Enumerates the set of values in String for ListDedicatedAiClustersSortOrderEnum +func GetListDedicatedAiClustersSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListDedicatedAiClustersSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListDedicatedAiClustersSortOrderEnum(val string) (ListDedicatedAiClustersSortOrderEnum, bool) { + enum, ok := mappingListDedicatedAiClustersSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListDedicatedAiClustersSortByEnum Enum with underlying type: string +type ListDedicatedAiClustersSortByEnum string + +// Set of constants representing the allowable values for ListDedicatedAiClustersSortByEnum +const ( + ListDedicatedAiClustersSortByTimecreated ListDedicatedAiClustersSortByEnum = "timeCreated" + ListDedicatedAiClustersSortByDisplayname ListDedicatedAiClustersSortByEnum = "displayName" + ListDedicatedAiClustersSortByLifecyclestate ListDedicatedAiClustersSortByEnum = "lifecycleState" +) + +var mappingListDedicatedAiClustersSortByEnum = map[string]ListDedicatedAiClustersSortByEnum{ + "timeCreated": ListDedicatedAiClustersSortByTimecreated, + "displayName": ListDedicatedAiClustersSortByDisplayname, + "lifecycleState": ListDedicatedAiClustersSortByLifecyclestate, +} + +var mappingListDedicatedAiClustersSortByEnumLowerCase = map[string]ListDedicatedAiClustersSortByEnum{ + "timecreated": ListDedicatedAiClustersSortByTimecreated, + "displayname": ListDedicatedAiClustersSortByDisplayname, + "lifecyclestate": ListDedicatedAiClustersSortByLifecyclestate, +} + +// GetListDedicatedAiClustersSortByEnumValues Enumerates the set of values for ListDedicatedAiClustersSortByEnum +func GetListDedicatedAiClustersSortByEnumValues() []ListDedicatedAiClustersSortByEnum { + values := make([]ListDedicatedAiClustersSortByEnum, 0) + for _, v := range mappingListDedicatedAiClustersSortByEnum { + values = append(values, v) + } + return values +} + +// GetListDedicatedAiClustersSortByEnumStringValues Enumerates the set of values in String for ListDedicatedAiClustersSortByEnum +func GetListDedicatedAiClustersSortByEnumStringValues() []string { + return []string{ + "timeCreated", + "displayName", + "lifecycleState", + } +} + +// GetMappingListDedicatedAiClustersSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListDedicatedAiClustersSortByEnum(val string) (ListDedicatedAiClustersSortByEnum, bool) { + enum, ok := mappingListDedicatedAiClustersSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/list_endpoints_request_response.go b/generativeai/list_endpoints_request_response.go new file mode 100644 index 0000000000..bf16f8cc0d --- /dev/null +++ b/generativeai/list_endpoints_request_response.go @@ -0,0 +1,216 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListEndpointsRequest wrapper for the ListEndpoints operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListEndpoints.go.html to see an example of how to use ListEndpointsRequest. +type ListEndpointsRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // A filter to return only resources that their lifecycle state matches the given lifecycle state. + LifecycleState EndpointLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the endpoint. + Id *string `mandatory:"false" contributesTo:"query" name:"id"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListEndpointsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. You can provide only one sort order. Default order for `timeCreated` + // is descending. Default order for `displayName` is ascending. + SortBy ListEndpointsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListEndpointsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListEndpointsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListEndpointsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListEndpointsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListEndpointsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingEndpointLifecycleStateEnum(string(request.LifecycleState)); !ok && request.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", request.LifecycleState, strings.Join(GetEndpointLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingListEndpointsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListEndpointsSortOrderEnumStringValues(), ","))) + } + if _, ok := GetMappingListEndpointsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListEndpointsSortByEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListEndpointsResponse wrapper for the ListEndpoints operation +type ListEndpointsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of EndpointCollection instances + EndpointCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListEndpointsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListEndpointsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListEndpointsSortOrderEnum Enum with underlying type: string +type ListEndpointsSortOrderEnum string + +// Set of constants representing the allowable values for ListEndpointsSortOrderEnum +const ( + ListEndpointsSortOrderAsc ListEndpointsSortOrderEnum = "ASC" + ListEndpointsSortOrderDesc ListEndpointsSortOrderEnum = "DESC" +) + +var mappingListEndpointsSortOrderEnum = map[string]ListEndpointsSortOrderEnum{ + "ASC": ListEndpointsSortOrderAsc, + "DESC": ListEndpointsSortOrderDesc, +} + +var mappingListEndpointsSortOrderEnumLowerCase = map[string]ListEndpointsSortOrderEnum{ + "asc": ListEndpointsSortOrderAsc, + "desc": ListEndpointsSortOrderDesc, +} + +// GetListEndpointsSortOrderEnumValues Enumerates the set of values for ListEndpointsSortOrderEnum +func GetListEndpointsSortOrderEnumValues() []ListEndpointsSortOrderEnum { + values := make([]ListEndpointsSortOrderEnum, 0) + for _, v := range mappingListEndpointsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListEndpointsSortOrderEnumStringValues Enumerates the set of values in String for ListEndpointsSortOrderEnum +func GetListEndpointsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListEndpointsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListEndpointsSortOrderEnum(val string) (ListEndpointsSortOrderEnum, bool) { + enum, ok := mappingListEndpointsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListEndpointsSortByEnum Enum with underlying type: string +type ListEndpointsSortByEnum string + +// Set of constants representing the allowable values for ListEndpointsSortByEnum +const ( + ListEndpointsSortByDisplayname ListEndpointsSortByEnum = "displayName" + ListEndpointsSortByTimecreated ListEndpointsSortByEnum = "timeCreated" +) + +var mappingListEndpointsSortByEnum = map[string]ListEndpointsSortByEnum{ + "displayName": ListEndpointsSortByDisplayname, + "timeCreated": ListEndpointsSortByTimecreated, +} + +var mappingListEndpointsSortByEnumLowerCase = map[string]ListEndpointsSortByEnum{ + "displayname": ListEndpointsSortByDisplayname, + "timecreated": ListEndpointsSortByTimecreated, +} + +// GetListEndpointsSortByEnumValues Enumerates the set of values for ListEndpointsSortByEnum +func GetListEndpointsSortByEnumValues() []ListEndpointsSortByEnum { + values := make([]ListEndpointsSortByEnum, 0) + for _, v := range mappingListEndpointsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListEndpointsSortByEnumStringValues Enumerates the set of values in String for ListEndpointsSortByEnum +func GetListEndpointsSortByEnumStringValues() []string { + return []string{ + "displayName", + "timeCreated", + } +} + +// GetMappingListEndpointsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListEndpointsSortByEnum(val string) (ListEndpointsSortByEnum, bool) { + enum, ok := mappingListEndpointsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/list_models_request_response.go b/generativeai/list_models_request_response.go new file mode 100644 index 0000000000..47c6ed5c24 --- /dev/null +++ b/generativeai/list_models_request_response.go @@ -0,0 +1,231 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListModelsRequest wrapper for the ListModels operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListModels.go.html to see an example of how to use ListModelsRequest. +type ListModelsRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A filter to return only resources that match the entire vendor given. + Vendor *string `mandatory:"false" contributesTo:"query" name:"vendor"` + + // A filter to return only resources their capability matches the given capability. + Capability []ModelCapabilityEnum `contributesTo:"query" name:"capability" omitEmpty:"true" collectionFormat:"multi"` + + // A filter to return only resources their lifecycleState matches the given lifecycleState. + LifecycleState ModelLifecycleStateEnum `mandatory:"false" contributesTo:"query" name:"lifecycleState" omitEmpty:"true"` + + // A filter to return only resources that match the given display name exactly. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // The ID of the model. + Id *string `mandatory:"false" contributesTo:"query" name:"id"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListModelsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. You can provide only one sort order. Default order for `timeCreated` is descending. + SortBy ListModelsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListModelsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListModelsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListModelsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListModelsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListModelsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range request.Capability { + if _, ok := GetMappingModelCapabilityEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Capability: %s. Supported values are: %s.", val, strings.Join(GetModelCapabilityEnumStringValues(), ","))) + } + } + + if _, ok := GetMappingModelLifecycleStateEnum(string(request.LifecycleState)); !ok && request.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", request.LifecycleState, strings.Join(GetModelLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingListModelsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListModelsSortOrderEnumStringValues(), ","))) + } + if _, ok := GetMappingListModelsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListModelsSortByEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListModelsResponse wrapper for the ListModels operation +type ListModelsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of ModelCollection instances + ModelCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListModelsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListModelsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListModelsSortOrderEnum Enum with underlying type: string +type ListModelsSortOrderEnum string + +// Set of constants representing the allowable values for ListModelsSortOrderEnum +const ( + ListModelsSortOrderAsc ListModelsSortOrderEnum = "ASC" + ListModelsSortOrderDesc ListModelsSortOrderEnum = "DESC" +) + +var mappingListModelsSortOrderEnum = map[string]ListModelsSortOrderEnum{ + "ASC": ListModelsSortOrderAsc, + "DESC": ListModelsSortOrderDesc, +} + +var mappingListModelsSortOrderEnumLowerCase = map[string]ListModelsSortOrderEnum{ + "asc": ListModelsSortOrderAsc, + "desc": ListModelsSortOrderDesc, +} + +// GetListModelsSortOrderEnumValues Enumerates the set of values for ListModelsSortOrderEnum +func GetListModelsSortOrderEnumValues() []ListModelsSortOrderEnum { + values := make([]ListModelsSortOrderEnum, 0) + for _, v := range mappingListModelsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListModelsSortOrderEnumStringValues Enumerates the set of values in String for ListModelsSortOrderEnum +func GetListModelsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListModelsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListModelsSortOrderEnum(val string) (ListModelsSortOrderEnum, bool) { + enum, ok := mappingListModelsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListModelsSortByEnum Enum with underlying type: string +type ListModelsSortByEnum string + +// Set of constants representing the allowable values for ListModelsSortByEnum +const ( + ListModelsSortByDisplayname ListModelsSortByEnum = "displayName" + ListModelsSortByLifecyclestate ListModelsSortByEnum = "lifecycleState" + ListModelsSortByTimecreated ListModelsSortByEnum = "timeCreated" +) + +var mappingListModelsSortByEnum = map[string]ListModelsSortByEnum{ + "displayName": ListModelsSortByDisplayname, + "lifecycleState": ListModelsSortByLifecyclestate, + "timeCreated": ListModelsSortByTimecreated, +} + +var mappingListModelsSortByEnumLowerCase = map[string]ListModelsSortByEnum{ + "displayname": ListModelsSortByDisplayname, + "lifecyclestate": ListModelsSortByLifecyclestate, + "timecreated": ListModelsSortByTimecreated, +} + +// GetListModelsSortByEnumValues Enumerates the set of values for ListModelsSortByEnum +func GetListModelsSortByEnumValues() []ListModelsSortByEnum { + values := make([]ListModelsSortByEnum, 0) + for _, v := range mappingListModelsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListModelsSortByEnumStringValues Enumerates the set of values in String for ListModelsSortByEnum +func GetListModelsSortByEnumStringValues() []string { + return []string{ + "displayName", + "lifecycleState", + "timeCreated", + } +} + +// GetMappingListModelsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListModelsSortByEnum(val string) (ListModelsSortByEnum, bool) { + enum, ok := mappingListModelsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/list_work_request_errors_request_response.go b/generativeai/list_work_request_errors_request_response.go new file mode 100644 index 0000000000..6dae5b7267 --- /dev/null +++ b/generativeai/list_work_request_errors_request_response.go @@ -0,0 +1,199 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListWorkRequestErrorsRequest wrapper for the ListWorkRequestErrors operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequestErrors.go.html to see an example of how to use ListWorkRequestErrorsRequest. +type ListWorkRequestErrorsRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + WorkRequestId *string `mandatory:"true" contributesTo:"path" name:"workRequestId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The field to sort by. Only one sort order may be provided. Default order for `timestamp` is descending. + SortBy ListWorkRequestErrorsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListWorkRequestErrorsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListWorkRequestErrorsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListWorkRequestErrorsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListWorkRequestErrorsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListWorkRequestErrorsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListWorkRequestErrorsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListWorkRequestErrorsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListWorkRequestErrorsSortByEnumStringValues(), ","))) + } + if _, ok := GetMappingListWorkRequestErrorsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListWorkRequestErrorsSortOrderEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListWorkRequestErrorsResponse wrapper for the ListWorkRequestErrors operation +type ListWorkRequestErrorsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of WorkRequestErrorCollection instances + WorkRequestErrorCollection `presentIn:"body"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListWorkRequestErrorsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListWorkRequestErrorsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListWorkRequestErrorsSortByEnum Enum with underlying type: string +type ListWorkRequestErrorsSortByEnum string + +// Set of constants representing the allowable values for ListWorkRequestErrorsSortByEnum +const ( + ListWorkRequestErrorsSortByTimestamp ListWorkRequestErrorsSortByEnum = "timestamp" +) + +var mappingListWorkRequestErrorsSortByEnum = map[string]ListWorkRequestErrorsSortByEnum{ + "timestamp": ListWorkRequestErrorsSortByTimestamp, +} + +var mappingListWorkRequestErrorsSortByEnumLowerCase = map[string]ListWorkRequestErrorsSortByEnum{ + "timestamp": ListWorkRequestErrorsSortByTimestamp, +} + +// GetListWorkRequestErrorsSortByEnumValues Enumerates the set of values for ListWorkRequestErrorsSortByEnum +func GetListWorkRequestErrorsSortByEnumValues() []ListWorkRequestErrorsSortByEnum { + values := make([]ListWorkRequestErrorsSortByEnum, 0) + for _, v := range mappingListWorkRequestErrorsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestErrorsSortByEnumStringValues Enumerates the set of values in String for ListWorkRequestErrorsSortByEnum +func GetListWorkRequestErrorsSortByEnumStringValues() []string { + return []string{ + "timestamp", + } +} + +// GetMappingListWorkRequestErrorsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestErrorsSortByEnum(val string) (ListWorkRequestErrorsSortByEnum, bool) { + enum, ok := mappingListWorkRequestErrorsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListWorkRequestErrorsSortOrderEnum Enum with underlying type: string +type ListWorkRequestErrorsSortOrderEnum string + +// Set of constants representing the allowable values for ListWorkRequestErrorsSortOrderEnum +const ( + ListWorkRequestErrorsSortOrderAsc ListWorkRequestErrorsSortOrderEnum = "ASC" + ListWorkRequestErrorsSortOrderDesc ListWorkRequestErrorsSortOrderEnum = "DESC" +) + +var mappingListWorkRequestErrorsSortOrderEnum = map[string]ListWorkRequestErrorsSortOrderEnum{ + "ASC": ListWorkRequestErrorsSortOrderAsc, + "DESC": ListWorkRequestErrorsSortOrderDesc, +} + +var mappingListWorkRequestErrorsSortOrderEnumLowerCase = map[string]ListWorkRequestErrorsSortOrderEnum{ + "asc": ListWorkRequestErrorsSortOrderAsc, + "desc": ListWorkRequestErrorsSortOrderDesc, +} + +// GetListWorkRequestErrorsSortOrderEnumValues Enumerates the set of values for ListWorkRequestErrorsSortOrderEnum +func GetListWorkRequestErrorsSortOrderEnumValues() []ListWorkRequestErrorsSortOrderEnum { + values := make([]ListWorkRequestErrorsSortOrderEnum, 0) + for _, v := range mappingListWorkRequestErrorsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestErrorsSortOrderEnumStringValues Enumerates the set of values in String for ListWorkRequestErrorsSortOrderEnum +func GetListWorkRequestErrorsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListWorkRequestErrorsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestErrorsSortOrderEnum(val string) (ListWorkRequestErrorsSortOrderEnum, bool) { + enum, ok := mappingListWorkRequestErrorsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/list_work_request_logs_request_response.go b/generativeai/list_work_request_logs_request_response.go new file mode 100644 index 0000000000..27243c1998 --- /dev/null +++ b/generativeai/list_work_request_logs_request_response.go @@ -0,0 +1,199 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListWorkRequestLogsRequest wrapper for the ListWorkRequestLogs operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequestLogs.go.html to see an example of how to use ListWorkRequestLogsRequest. +type ListWorkRequestLogsRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + WorkRequestId *string `mandatory:"true" contributesTo:"path" name:"workRequestId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The field to sort by. Only one sort order may be provided. Default order for `timestamp` is descending. + SortBy ListWorkRequestLogsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListWorkRequestLogsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListWorkRequestLogsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListWorkRequestLogsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListWorkRequestLogsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListWorkRequestLogsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListWorkRequestLogsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListWorkRequestLogsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListWorkRequestLogsSortByEnumStringValues(), ","))) + } + if _, ok := GetMappingListWorkRequestLogsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListWorkRequestLogsSortOrderEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListWorkRequestLogsResponse wrapper for the ListWorkRequestLogs operation +type ListWorkRequestLogsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of WorkRequestLogEntryCollection instances + WorkRequestLogEntryCollection `presentIn:"body"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListWorkRequestLogsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListWorkRequestLogsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListWorkRequestLogsSortByEnum Enum with underlying type: string +type ListWorkRequestLogsSortByEnum string + +// Set of constants representing the allowable values for ListWorkRequestLogsSortByEnum +const ( + ListWorkRequestLogsSortByTimestamp ListWorkRequestLogsSortByEnum = "timestamp" +) + +var mappingListWorkRequestLogsSortByEnum = map[string]ListWorkRequestLogsSortByEnum{ + "timestamp": ListWorkRequestLogsSortByTimestamp, +} + +var mappingListWorkRequestLogsSortByEnumLowerCase = map[string]ListWorkRequestLogsSortByEnum{ + "timestamp": ListWorkRequestLogsSortByTimestamp, +} + +// GetListWorkRequestLogsSortByEnumValues Enumerates the set of values for ListWorkRequestLogsSortByEnum +func GetListWorkRequestLogsSortByEnumValues() []ListWorkRequestLogsSortByEnum { + values := make([]ListWorkRequestLogsSortByEnum, 0) + for _, v := range mappingListWorkRequestLogsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestLogsSortByEnumStringValues Enumerates the set of values in String for ListWorkRequestLogsSortByEnum +func GetListWorkRequestLogsSortByEnumStringValues() []string { + return []string{ + "timestamp", + } +} + +// GetMappingListWorkRequestLogsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestLogsSortByEnum(val string) (ListWorkRequestLogsSortByEnum, bool) { + enum, ok := mappingListWorkRequestLogsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListWorkRequestLogsSortOrderEnum Enum with underlying type: string +type ListWorkRequestLogsSortOrderEnum string + +// Set of constants representing the allowable values for ListWorkRequestLogsSortOrderEnum +const ( + ListWorkRequestLogsSortOrderAsc ListWorkRequestLogsSortOrderEnum = "ASC" + ListWorkRequestLogsSortOrderDesc ListWorkRequestLogsSortOrderEnum = "DESC" +) + +var mappingListWorkRequestLogsSortOrderEnum = map[string]ListWorkRequestLogsSortOrderEnum{ + "ASC": ListWorkRequestLogsSortOrderAsc, + "DESC": ListWorkRequestLogsSortOrderDesc, +} + +var mappingListWorkRequestLogsSortOrderEnumLowerCase = map[string]ListWorkRequestLogsSortOrderEnum{ + "asc": ListWorkRequestLogsSortOrderAsc, + "desc": ListWorkRequestLogsSortOrderDesc, +} + +// GetListWorkRequestLogsSortOrderEnumValues Enumerates the set of values for ListWorkRequestLogsSortOrderEnum +func GetListWorkRequestLogsSortOrderEnumValues() []ListWorkRequestLogsSortOrderEnum { + values := make([]ListWorkRequestLogsSortOrderEnum, 0) + for _, v := range mappingListWorkRequestLogsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestLogsSortOrderEnumStringValues Enumerates the set of values in String for ListWorkRequestLogsSortOrderEnum +func GetListWorkRequestLogsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListWorkRequestLogsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestLogsSortOrderEnum(val string) (ListWorkRequestLogsSortOrderEnum, bool) { + enum, ok := mappingListWorkRequestLogsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/list_work_requests_request_response.go b/generativeai/list_work_requests_request_response.go new file mode 100644 index 0000000000..7bf845462c --- /dev/null +++ b/generativeai/list_work_requests_request_response.go @@ -0,0 +1,273 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListWorkRequestsRequest wrapper for the ListWorkRequests operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/ListWorkRequests.go.html to see an example of how to use ListWorkRequestsRequest. +type ListWorkRequestsRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment in which to list resources. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + WorkRequestId *string `mandatory:"false" contributesTo:"query" name:"workRequestId"` + + // A filter to return only the resources that match the given lifecycle state. + Status ListWorkRequestsStatusEnum `mandatory:"false" contributesTo:"query" name:"status" omitEmpty:"true"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the resource affected by the work request. + ResourceId *string `mandatory:"false" contributesTo:"query" name:"resourceId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For list pagination. The value of the opc-next-page response header from the previous + // "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // The sort order to use, either 'ASC' or 'DESC'. + SortOrder ListWorkRequestsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // The field to sort by. Only one sort order may be provided. Default order for `timeAccepted` is descending. + SortBy ListWorkRequestsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListWorkRequestsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListWorkRequestsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListWorkRequestsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListWorkRequestsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListWorkRequestsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListWorkRequestsStatusEnum(string(request.Status)); !ok && request.Status != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Status: %s. Supported values are: %s.", request.Status, strings.Join(GetListWorkRequestsStatusEnumStringValues(), ","))) + } + if _, ok := GetMappingListWorkRequestsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListWorkRequestsSortOrderEnumStringValues(), ","))) + } + if _, ok := GetMappingListWorkRequestsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListWorkRequestsSortByEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListWorkRequestsResponse wrapper for the ListWorkRequests operation +type ListWorkRequestsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of WorkRequestSummaryCollection instances + WorkRequestSummaryCollection `presentIn:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For list pagination. When this header appears in the response, additional pages of results remain. For + // important details about how pagination works, see List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` +} + +func (response ListWorkRequestsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListWorkRequestsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListWorkRequestsStatusEnum Enum with underlying type: string +type ListWorkRequestsStatusEnum string + +// Set of constants representing the allowable values for ListWorkRequestsStatusEnum +const ( + ListWorkRequestsStatusAccepted ListWorkRequestsStatusEnum = "ACCEPTED" + ListWorkRequestsStatusInProgress ListWorkRequestsStatusEnum = "IN_PROGRESS" + ListWorkRequestsStatusWaiting ListWorkRequestsStatusEnum = "WAITING" + ListWorkRequestsStatusFailed ListWorkRequestsStatusEnum = "FAILED" + ListWorkRequestsStatusSucceeded ListWorkRequestsStatusEnum = "SUCCEEDED" + ListWorkRequestsStatusCanceling ListWorkRequestsStatusEnum = "CANCELING" + ListWorkRequestsStatusCanceled ListWorkRequestsStatusEnum = "CANCELED" +) + +var mappingListWorkRequestsStatusEnum = map[string]ListWorkRequestsStatusEnum{ + "ACCEPTED": ListWorkRequestsStatusAccepted, + "IN_PROGRESS": ListWorkRequestsStatusInProgress, + "WAITING": ListWorkRequestsStatusWaiting, + "FAILED": ListWorkRequestsStatusFailed, + "SUCCEEDED": ListWorkRequestsStatusSucceeded, + "CANCELING": ListWorkRequestsStatusCanceling, + "CANCELED": ListWorkRequestsStatusCanceled, +} + +var mappingListWorkRequestsStatusEnumLowerCase = map[string]ListWorkRequestsStatusEnum{ + "accepted": ListWorkRequestsStatusAccepted, + "in_progress": ListWorkRequestsStatusInProgress, + "waiting": ListWorkRequestsStatusWaiting, + "failed": ListWorkRequestsStatusFailed, + "succeeded": ListWorkRequestsStatusSucceeded, + "canceling": ListWorkRequestsStatusCanceling, + "canceled": ListWorkRequestsStatusCanceled, +} + +// GetListWorkRequestsStatusEnumValues Enumerates the set of values for ListWorkRequestsStatusEnum +func GetListWorkRequestsStatusEnumValues() []ListWorkRequestsStatusEnum { + values := make([]ListWorkRequestsStatusEnum, 0) + for _, v := range mappingListWorkRequestsStatusEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestsStatusEnumStringValues Enumerates the set of values in String for ListWorkRequestsStatusEnum +func GetListWorkRequestsStatusEnumStringValues() []string { + return []string{ + "ACCEPTED", + "IN_PROGRESS", + "WAITING", + "FAILED", + "SUCCEEDED", + "CANCELING", + "CANCELED", + } +} + +// GetMappingListWorkRequestsStatusEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestsStatusEnum(val string) (ListWorkRequestsStatusEnum, bool) { + enum, ok := mappingListWorkRequestsStatusEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListWorkRequestsSortOrderEnum Enum with underlying type: string +type ListWorkRequestsSortOrderEnum string + +// Set of constants representing the allowable values for ListWorkRequestsSortOrderEnum +const ( + ListWorkRequestsSortOrderAsc ListWorkRequestsSortOrderEnum = "ASC" + ListWorkRequestsSortOrderDesc ListWorkRequestsSortOrderEnum = "DESC" +) + +var mappingListWorkRequestsSortOrderEnum = map[string]ListWorkRequestsSortOrderEnum{ + "ASC": ListWorkRequestsSortOrderAsc, + "DESC": ListWorkRequestsSortOrderDesc, +} + +var mappingListWorkRequestsSortOrderEnumLowerCase = map[string]ListWorkRequestsSortOrderEnum{ + "asc": ListWorkRequestsSortOrderAsc, + "desc": ListWorkRequestsSortOrderDesc, +} + +// GetListWorkRequestsSortOrderEnumValues Enumerates the set of values for ListWorkRequestsSortOrderEnum +func GetListWorkRequestsSortOrderEnumValues() []ListWorkRequestsSortOrderEnum { + values := make([]ListWorkRequestsSortOrderEnum, 0) + for _, v := range mappingListWorkRequestsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestsSortOrderEnumStringValues Enumerates the set of values in String for ListWorkRequestsSortOrderEnum +func GetListWorkRequestsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListWorkRequestsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestsSortOrderEnum(val string) (ListWorkRequestsSortOrderEnum, bool) { + enum, ok := mappingListWorkRequestsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListWorkRequestsSortByEnum Enum with underlying type: string +type ListWorkRequestsSortByEnum string + +// Set of constants representing the allowable values for ListWorkRequestsSortByEnum +const ( + ListWorkRequestsSortByTimeaccepted ListWorkRequestsSortByEnum = "timeAccepted" +) + +var mappingListWorkRequestsSortByEnum = map[string]ListWorkRequestsSortByEnum{ + "timeAccepted": ListWorkRequestsSortByTimeaccepted, +} + +var mappingListWorkRequestsSortByEnumLowerCase = map[string]ListWorkRequestsSortByEnum{ + "timeaccepted": ListWorkRequestsSortByTimeaccepted, +} + +// GetListWorkRequestsSortByEnumValues Enumerates the set of values for ListWorkRequestsSortByEnum +func GetListWorkRequestsSortByEnumValues() []ListWorkRequestsSortByEnum { + values := make([]ListWorkRequestsSortByEnum, 0) + for _, v := range mappingListWorkRequestsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListWorkRequestsSortByEnumStringValues Enumerates the set of values in String for ListWorkRequestsSortByEnum +func GetListWorkRequestsSortByEnumStringValues() []string { + return []string{ + "timeAccepted", + } +} + +// GetMappingListWorkRequestsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListWorkRequestsSortByEnum(val string) (ListWorkRequestsSortByEnum, bool) { + enum, ok := mappingListWorkRequestsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/model.go b/generativeai/model.go new file mode 100644 index 0000000000..b42752a655 --- /dev/null +++ b/generativeai/model.go @@ -0,0 +1,294 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Model You can create a custom model by using your dataset to fine-tune an out-of-the-box text generation base model. Have your dataset ready before you create a custom model. See Training Data Requirements (https://docs.cloud.oracle.com/iaas/Content/generative-ai/training-data-requirements.htm). +// To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator who gives OCI resource access to users. See +// Getting Started with Policies (https://docs.cloud.oracle.com/iaas/Content/Identity/policiesgs/get-started-with-policies.htm) and Getting Access to Generative AI Resouces (https://docs.cloud.oracle.com/iaas/Content/generative-ai/iam-policies.htm). +type Model struct { + + // An ID that uniquely identifies a pretrained or fine-tuned model. + Id *string `mandatory:"true" json:"id"` + + // The compartment OCID for fine-tuned models. For pretrained models, this value is null. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Describes what this model can be used for. + Capabilities []ModelCapabilityEnum `mandatory:"true" json:"capabilities"` + + // The lifecycle state of the model. + LifecycleState ModelLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time that the model was created in the format of an RFC3339 datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The model type indicating whether this is a pretrained/base model or a custom/fine-tuned model. + Type ModelTypeEnum `mandatory:"true" json:"type"` + + // An optional description of the model. + Description *string `mandatory:"false" json:"description"` + + // A message describing the current state of the model in more detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // The provider of the base model. + Vendor *string `mandatory:"false" json:"vendor"` + + // The version of the model. + Version *string `mandatory:"false" json:"version"` + + // A user-friendly name. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The date and time that the model was updated in the format of an RFC3339 datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // The OCID of the base model that's used for fine-tuning. For pretrained models, the value is null. + BaseModelId *string `mandatory:"false" json:"baseModelId"` + + FineTuneDetails *FineTuneDetails `mandatory:"false" json:"fineTuneDetails"` + + ModelMetrics ModelMetrics `mandatory:"false" json:"modelMetrics"` + + // Whether a model is supported long-term. Only applicable to base models. + IsLongTermSupported *bool `mandatory:"false" json:"isLongTermSupported"` + + // Corresponds to the time when the custom model and its associated foundation model will be deprecated. + TimeDeprecated *common.SDKTime `mandatory:"false" json:"timeDeprecated"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m Model) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m Model) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Capabilities { + if _, ok := GetMappingModelCapabilityEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Capabilities: %s. Supported values are: %s.", val, strings.Join(GetModelCapabilityEnumStringValues(), ","))) + } + } + + if _, ok := GetMappingModelLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetModelLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingModelTypeEnum(string(m.Type)); !ok && m.Type != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Type: %s. Supported values are: %s.", m.Type, strings.Join(GetModelTypeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *Model) UnmarshalJSON(data []byte) (e error) { + model := struct { + Description *string `json:"description"` + LifecycleDetails *string `json:"lifecycleDetails"` + Vendor *string `json:"vendor"` + Version *string `json:"version"` + DisplayName *string `json:"displayName"` + TimeUpdated *common.SDKTime `json:"timeUpdated"` + BaseModelId *string `json:"baseModelId"` + FineTuneDetails *FineTuneDetails `json:"fineTuneDetails"` + ModelMetrics modelmetrics `json:"modelMetrics"` + IsLongTermSupported *bool `json:"isLongTermSupported"` + TimeDeprecated *common.SDKTime `json:"timeDeprecated"` + FreeformTags map[string]string `json:"freeformTags"` + DefinedTags map[string]map[string]interface{} `json:"definedTags"` + SystemTags map[string]map[string]interface{} `json:"systemTags"` + Id *string `json:"id"` + CompartmentId *string `json:"compartmentId"` + Capabilities []ModelCapabilityEnum `json:"capabilities"` + LifecycleState ModelLifecycleStateEnum `json:"lifecycleState"` + TimeCreated *common.SDKTime `json:"timeCreated"` + Type ModelTypeEnum `json:"type"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.Description = model.Description + + m.LifecycleDetails = model.LifecycleDetails + + m.Vendor = model.Vendor + + m.Version = model.Version + + m.DisplayName = model.DisplayName + + m.TimeUpdated = model.TimeUpdated + + m.BaseModelId = model.BaseModelId + + m.FineTuneDetails = model.FineTuneDetails + + nn, e = model.ModelMetrics.UnmarshalPolymorphicJSON(model.ModelMetrics.JsonData) + if e != nil { + return + } + if nn != nil { + m.ModelMetrics = nn.(ModelMetrics) + } else { + m.ModelMetrics = nil + } + + m.IsLongTermSupported = model.IsLongTermSupported + + m.TimeDeprecated = model.TimeDeprecated + + m.FreeformTags = model.FreeformTags + + m.DefinedTags = model.DefinedTags + + m.SystemTags = model.SystemTags + + m.Id = model.Id + + m.CompartmentId = model.CompartmentId + + m.Capabilities = make([]ModelCapabilityEnum, len(model.Capabilities)) + copy(m.Capabilities, model.Capabilities) + m.LifecycleState = model.LifecycleState + + m.TimeCreated = model.TimeCreated + + m.Type = model.Type + + return +} + +// ModelLifecycleStateEnum Enum with underlying type: string +type ModelLifecycleStateEnum string + +// Set of constants representing the allowable values for ModelLifecycleStateEnum +const ( + ModelLifecycleStateActive ModelLifecycleStateEnum = "ACTIVE" + ModelLifecycleStateCreating ModelLifecycleStateEnum = "CREATING" + ModelLifecycleStateDeleting ModelLifecycleStateEnum = "DELETING" + ModelLifecycleStateDeleted ModelLifecycleStateEnum = "DELETED" + ModelLifecycleStateFailed ModelLifecycleStateEnum = "FAILED" +) + +var mappingModelLifecycleStateEnum = map[string]ModelLifecycleStateEnum{ + "ACTIVE": ModelLifecycleStateActive, + "CREATING": ModelLifecycleStateCreating, + "DELETING": ModelLifecycleStateDeleting, + "DELETED": ModelLifecycleStateDeleted, + "FAILED": ModelLifecycleStateFailed, +} + +var mappingModelLifecycleStateEnumLowerCase = map[string]ModelLifecycleStateEnum{ + "active": ModelLifecycleStateActive, + "creating": ModelLifecycleStateCreating, + "deleting": ModelLifecycleStateDeleting, + "deleted": ModelLifecycleStateDeleted, + "failed": ModelLifecycleStateFailed, +} + +// GetModelLifecycleStateEnumValues Enumerates the set of values for ModelLifecycleStateEnum +func GetModelLifecycleStateEnumValues() []ModelLifecycleStateEnum { + values := make([]ModelLifecycleStateEnum, 0) + for _, v := range mappingModelLifecycleStateEnum { + values = append(values, v) + } + return values +} + +// GetModelLifecycleStateEnumStringValues Enumerates the set of values in String for ModelLifecycleStateEnum +func GetModelLifecycleStateEnumStringValues() []string { + return []string{ + "ACTIVE", + "CREATING", + "DELETING", + "DELETED", + "FAILED", + } +} + +// GetMappingModelLifecycleStateEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelLifecycleStateEnum(val string) (ModelLifecycleStateEnum, bool) { + enum, ok := mappingModelLifecycleStateEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ModelTypeEnum Enum with underlying type: string +type ModelTypeEnum string + +// Set of constants representing the allowable values for ModelTypeEnum +const ( + ModelTypeBase ModelTypeEnum = "BASE" + ModelTypeCustom ModelTypeEnum = "CUSTOM" +) + +var mappingModelTypeEnum = map[string]ModelTypeEnum{ + "BASE": ModelTypeBase, + "CUSTOM": ModelTypeCustom, +} + +var mappingModelTypeEnumLowerCase = map[string]ModelTypeEnum{ + "base": ModelTypeBase, + "custom": ModelTypeCustom, +} + +// GetModelTypeEnumValues Enumerates the set of values for ModelTypeEnum +func GetModelTypeEnumValues() []ModelTypeEnum { + values := make([]ModelTypeEnum, 0) + for _, v := range mappingModelTypeEnum { + values = append(values, v) + } + return values +} + +// GetModelTypeEnumStringValues Enumerates the set of values in String for ModelTypeEnum +func GetModelTypeEnumStringValues() []string { + return []string{ + "BASE", + "CUSTOM", + } +} + +// GetMappingModelTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelTypeEnum(val string) (ModelTypeEnum, bool) { + enum, ok := mappingModelTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/model_capability.go b/generativeai/model_capability.go new file mode 100644 index 0000000000..8b92219be4 --- /dev/null +++ b/generativeai/model_capability.go @@ -0,0 +1,67 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// ModelCapabilityEnum Enum with underlying type: string +type ModelCapabilityEnum string + +// Set of constants representing the allowable values for ModelCapabilityEnum +const ( + ModelCapabilityTextGeneration ModelCapabilityEnum = "TEXT_GENERATION" + ModelCapabilityTextSummarization ModelCapabilityEnum = "TEXT_SUMMARIZATION" + ModelCapabilityTextEmbeddings ModelCapabilityEnum = "TEXT_EMBEDDINGS" + ModelCapabilityFineTune ModelCapabilityEnum = "FINE_TUNE" +) + +var mappingModelCapabilityEnum = map[string]ModelCapabilityEnum{ + "TEXT_GENERATION": ModelCapabilityTextGeneration, + "TEXT_SUMMARIZATION": ModelCapabilityTextSummarization, + "TEXT_EMBEDDINGS": ModelCapabilityTextEmbeddings, + "FINE_TUNE": ModelCapabilityFineTune, +} + +var mappingModelCapabilityEnumLowerCase = map[string]ModelCapabilityEnum{ + "text_generation": ModelCapabilityTextGeneration, + "text_summarization": ModelCapabilityTextSummarization, + "text_embeddings": ModelCapabilityTextEmbeddings, + "fine_tune": ModelCapabilityFineTune, +} + +// GetModelCapabilityEnumValues Enumerates the set of values for ModelCapabilityEnum +func GetModelCapabilityEnumValues() []ModelCapabilityEnum { + values := make([]ModelCapabilityEnum, 0) + for _, v := range mappingModelCapabilityEnum { + values = append(values, v) + } + return values +} + +// GetModelCapabilityEnumStringValues Enumerates the set of values in String for ModelCapabilityEnum +func GetModelCapabilityEnumStringValues() []string { + return []string{ + "TEXT_GENERATION", + "TEXT_SUMMARIZATION", + "TEXT_EMBEDDINGS", + "FINE_TUNE", + } +} + +// GetMappingModelCapabilityEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelCapabilityEnum(val string) (ModelCapabilityEnum, bool) { + enum, ok := mappingModelCapabilityEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/model_collection.go b/generativeai/model_collection.go new file mode 100644 index 0000000000..b94a77fd7f --- /dev/null +++ b/generativeai/model_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ModelCollection Results of a model search. Contains ModelSummary items and other information such as metadata. +type ModelCollection struct { + + // The results of a model search. + Items []ModelSummary `mandatory:"true" json:"items"` +} + +func (m ModelCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ModelCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/model_metrics.go b/generativeai/model_metrics.go new file mode 100644 index 0000000000..c93cd0b377 --- /dev/null +++ b/generativeai/model_metrics.go @@ -0,0 +1,118 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ModelMetrics Model metrics during the creation of a new model. +type ModelMetrics interface { +} + +type modelmetrics struct { + JsonData []byte + ModelMetricsType string `json:"modelMetricsType"` +} + +// UnmarshalJSON unmarshals json +func (m *modelmetrics) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalermodelmetrics modelmetrics + s := struct { + Model Unmarshalermodelmetrics + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.ModelMetricsType = s.Model.ModelMetricsType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *modelmetrics) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.ModelMetricsType { + case "TEXT_GENERATION_MODEL_METRICS": + mm := TextGenerationModelMetrics{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for ModelMetrics: %s.", m.ModelMetricsType) + return *m, nil + } +} + +func (m modelmetrics) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m modelmetrics) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ModelMetricsModelMetricsTypeEnum Enum with underlying type: string +type ModelMetricsModelMetricsTypeEnum string + +// Set of constants representing the allowable values for ModelMetricsModelMetricsTypeEnum +const ( + ModelMetricsModelMetricsTypeTextGenerationModelMetrics ModelMetricsModelMetricsTypeEnum = "TEXT_GENERATION_MODEL_METRICS" +) + +var mappingModelMetricsModelMetricsTypeEnum = map[string]ModelMetricsModelMetricsTypeEnum{ + "TEXT_GENERATION_MODEL_METRICS": ModelMetricsModelMetricsTypeTextGenerationModelMetrics, +} + +var mappingModelMetricsModelMetricsTypeEnumLowerCase = map[string]ModelMetricsModelMetricsTypeEnum{ + "text_generation_model_metrics": ModelMetricsModelMetricsTypeTextGenerationModelMetrics, +} + +// GetModelMetricsModelMetricsTypeEnumValues Enumerates the set of values for ModelMetricsModelMetricsTypeEnum +func GetModelMetricsModelMetricsTypeEnumValues() []ModelMetricsModelMetricsTypeEnum { + values := make([]ModelMetricsModelMetricsTypeEnum, 0) + for _, v := range mappingModelMetricsModelMetricsTypeEnum { + values = append(values, v) + } + return values +} + +// GetModelMetricsModelMetricsTypeEnumStringValues Enumerates the set of values in String for ModelMetricsModelMetricsTypeEnum +func GetModelMetricsModelMetricsTypeEnumStringValues() []string { + return []string{ + "TEXT_GENERATION_MODEL_METRICS", + } +} + +// GetMappingModelMetricsModelMetricsTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingModelMetricsModelMetricsTypeEnum(val string) (ModelMetricsModelMetricsTypeEnum, bool) { + enum, ok := mappingModelMetricsModelMetricsTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/model_summary.go b/generativeai/model_summary.go new file mode 100644 index 0000000000..159c512001 --- /dev/null +++ b/generativeai/model_summary.go @@ -0,0 +1,193 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ModelSummary Summary of the model. +type ModelSummary struct { + + // An ID that uniquely identifies a pretrained or a fine-tuned model. + Id *string `mandatory:"true" json:"id"` + + // The compartment OCID for fine-tuned models. For pretrained models, this value is null. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Describes what this model can be used for. + Capabilities []ModelCapabilityEnum `mandatory:"true" json:"capabilities"` + + // The lifecycle state of the model. + // Allowed values are: + // - ACTIVE + // - CREATING + // - DELETING + // - DELETED + // - FAILED + LifecycleState ModelLifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // The date and time that the model was created in the format of an RFC3339 datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The model type indicating whether this is a pretrained/base model or a custom/fine-tuned model. + // Allowed values are: + // - BASE + // - CUSTOM + Type ModelTypeEnum `mandatory:"true" json:"type"` + + // A message describing the current state of the model with detail that can provide actionable information. + LifecycleDetails *string `mandatory:"false" json:"lifecycleDetails"` + + // A user-friendly name. + DisplayName *string `mandatory:"false" json:"displayName"` + + // The provider of the model. + Vendor *string `mandatory:"false" json:"vendor"` + + // The version of the model. + Version *string `mandatory:"false" json:"version"` + + // The OCID of the base model that's used for fine-tuning. For pretrained models, the value is null. + BaseModelId *string `mandatory:"false" json:"baseModelId"` + + FineTuneDetails *FineTuneDetails `mandatory:"false" json:"fineTuneDetails"` + + ModelMetrics ModelMetrics `mandatory:"false" json:"modelMetrics"` + + // Whether a model is supported long-term. Applies only to base models. + IsLongTermSupported *bool `mandatory:"false" json:"isLongTermSupported"` + + // Corresponds to the time when the custom model and its associated foundation model will be deprecated. + TimeDeprecated *common.SDKTime `mandatory:"false" json:"timeDeprecated"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // System tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m ModelSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ModelSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + for _, val := range m.Capabilities { + if _, ok := GetMappingModelCapabilityEnum(string(val)); !ok && val != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Capabilities: %s. Supported values are: %s.", val, strings.Join(GetModelCapabilityEnumStringValues(), ","))) + } + } + + if _, ok := GetMappingModelLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetModelLifecycleStateEnumStringValues(), ","))) + } + if _, ok := GetMappingModelTypeEnum(string(m.Type)); !ok && m.Type != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Type: %s. Supported values are: %s.", m.Type, strings.Join(GetModelTypeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *ModelSummary) UnmarshalJSON(data []byte) (e error) { + model := struct { + LifecycleDetails *string `json:"lifecycleDetails"` + DisplayName *string `json:"displayName"` + Vendor *string `json:"vendor"` + Version *string `json:"version"` + BaseModelId *string `json:"baseModelId"` + FineTuneDetails *FineTuneDetails `json:"fineTuneDetails"` + ModelMetrics modelmetrics `json:"modelMetrics"` + IsLongTermSupported *bool `json:"isLongTermSupported"` + TimeDeprecated *common.SDKTime `json:"timeDeprecated"` + FreeformTags map[string]string `json:"freeformTags"` + DefinedTags map[string]map[string]interface{} `json:"definedTags"` + SystemTags map[string]map[string]interface{} `json:"systemTags"` + Id *string `json:"id"` + CompartmentId *string `json:"compartmentId"` + Capabilities []ModelCapabilityEnum `json:"capabilities"` + LifecycleState ModelLifecycleStateEnum `json:"lifecycleState"` + TimeCreated *common.SDKTime `json:"timeCreated"` + Type ModelTypeEnum `json:"type"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.LifecycleDetails = model.LifecycleDetails + + m.DisplayName = model.DisplayName + + m.Vendor = model.Vendor + + m.Version = model.Version + + m.BaseModelId = model.BaseModelId + + m.FineTuneDetails = model.FineTuneDetails + + nn, e = model.ModelMetrics.UnmarshalPolymorphicJSON(model.ModelMetrics.JsonData) + if e != nil { + return + } + if nn != nil { + m.ModelMetrics = nn.(ModelMetrics) + } else { + m.ModelMetrics = nil + } + + m.IsLongTermSupported = model.IsLongTermSupported + + m.TimeDeprecated = model.TimeDeprecated + + m.FreeformTags = model.FreeformTags + + m.DefinedTags = model.DefinedTags + + m.SystemTags = model.SystemTags + + m.Id = model.Id + + m.CompartmentId = model.CompartmentId + + m.Capabilities = make([]ModelCapabilityEnum, len(model.Capabilities)) + copy(m.Capabilities, model.Capabilities) + m.LifecycleState = model.LifecycleState + + m.TimeCreated = model.TimeCreated + + m.Type = model.Type + + return +} diff --git a/generativeai/object_storage_dataset.go b/generativeai/object_storage_dataset.go new file mode 100644 index 0000000000..fbdfcd0e91 --- /dev/null +++ b/generativeai/object_storage_dataset.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ObjectStorageDataset The dataset is stored in an OCI Object Storage bucket. +type ObjectStorageDataset struct { + + // The Object Storage namespace. + NamespaceName *string `mandatory:"true" json:"namespaceName"` + + // The Object Storage bucket name. + BucketName *string `mandatory:"true" json:"bucketName"` + + // The Object Storage object name. + ObjectName *string `mandatory:"true" json:"objectName"` +} + +func (m ObjectStorageDataset) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ObjectStorageDataset) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m ObjectStorageDataset) MarshalJSON() (buff []byte, e error) { + type MarshalTypeObjectStorageDataset ObjectStorageDataset + s := struct { + DiscriminatorParam string `json:"datasetType"` + MarshalTypeObjectStorageDataset + }{ + "OBJECT_STORAGE", + (MarshalTypeObjectStorageDataset)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeai/operation_status.go b/generativeai/operation_status.go new file mode 100644 index 0000000000..da15951371 --- /dev/null +++ b/generativeai/operation_status.go @@ -0,0 +1,79 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// OperationStatusEnum Enum with underlying type: string +type OperationStatusEnum string + +// Set of constants representing the allowable values for OperationStatusEnum +const ( + OperationStatusAccepted OperationStatusEnum = "ACCEPTED" + OperationStatusInProgress OperationStatusEnum = "IN_PROGRESS" + OperationStatusWaiting OperationStatusEnum = "WAITING" + OperationStatusFailed OperationStatusEnum = "FAILED" + OperationStatusSucceeded OperationStatusEnum = "SUCCEEDED" + OperationStatusCanceling OperationStatusEnum = "CANCELING" + OperationStatusCanceled OperationStatusEnum = "CANCELED" +) + +var mappingOperationStatusEnum = map[string]OperationStatusEnum{ + "ACCEPTED": OperationStatusAccepted, + "IN_PROGRESS": OperationStatusInProgress, + "WAITING": OperationStatusWaiting, + "FAILED": OperationStatusFailed, + "SUCCEEDED": OperationStatusSucceeded, + "CANCELING": OperationStatusCanceling, + "CANCELED": OperationStatusCanceled, +} + +var mappingOperationStatusEnumLowerCase = map[string]OperationStatusEnum{ + "accepted": OperationStatusAccepted, + "in_progress": OperationStatusInProgress, + "waiting": OperationStatusWaiting, + "failed": OperationStatusFailed, + "succeeded": OperationStatusSucceeded, + "canceling": OperationStatusCanceling, + "canceled": OperationStatusCanceled, +} + +// GetOperationStatusEnumValues Enumerates the set of values for OperationStatusEnum +func GetOperationStatusEnumValues() []OperationStatusEnum { + values := make([]OperationStatusEnum, 0) + for _, v := range mappingOperationStatusEnum { + values = append(values, v) + } + return values +} + +// GetOperationStatusEnumStringValues Enumerates the set of values in String for OperationStatusEnum +func GetOperationStatusEnumStringValues() []string { + return []string{ + "ACCEPTED", + "IN_PROGRESS", + "WAITING", + "FAILED", + "SUCCEEDED", + "CANCELING", + "CANCELED", + } +} + +// GetMappingOperationStatusEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingOperationStatusEnum(val string) (OperationStatusEnum, bool) { + enum, ok := mappingOperationStatusEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/operation_type.go b/generativeai/operation_type.go new file mode 100644 index 0000000000..7d1313c1cc --- /dev/null +++ b/generativeai/operation_type.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// OperationTypeEnum Enum with underlying type: string +type OperationTypeEnum string + +// Set of constants representing the allowable values for OperationTypeEnum +const ( + OperationTypeCreateModel OperationTypeEnum = "CREATE_MODEL" + OperationTypeDeleteModel OperationTypeEnum = "DELETE_MODEL" + OperationTypeMoveModel OperationTypeEnum = "MOVE_MODEL" + OperationTypeCreateDedicatedAiCluster OperationTypeEnum = "CREATE_DEDICATED_AI_CLUSTER" + OperationTypeDeleteDedicatedAiCluster OperationTypeEnum = "DELETE_DEDICATED_AI_CLUSTER" + OperationTypeUpdateDedicatedAiCluster OperationTypeEnum = "UPDATE_DEDICATED_AI_CLUSTER" + OperationTypeMoveDedicatedAiCluster OperationTypeEnum = "MOVE_DEDICATED_AI_CLUSTER" + OperationTypeCreateEndpoint OperationTypeEnum = "CREATE_ENDPOINT" + OperationTypeDeleteEndpoint OperationTypeEnum = "DELETE_ENDPOINT" + OperationTypeUpdateEndpoint OperationTypeEnum = "UPDATE_ENDPOINT" + OperationTypeMoveEndpoint OperationTypeEnum = "MOVE_ENDPOINT" +) + +var mappingOperationTypeEnum = map[string]OperationTypeEnum{ + "CREATE_MODEL": OperationTypeCreateModel, + "DELETE_MODEL": OperationTypeDeleteModel, + "MOVE_MODEL": OperationTypeMoveModel, + "CREATE_DEDICATED_AI_CLUSTER": OperationTypeCreateDedicatedAiCluster, + "DELETE_DEDICATED_AI_CLUSTER": OperationTypeDeleteDedicatedAiCluster, + "UPDATE_DEDICATED_AI_CLUSTER": OperationTypeUpdateDedicatedAiCluster, + "MOVE_DEDICATED_AI_CLUSTER": OperationTypeMoveDedicatedAiCluster, + "CREATE_ENDPOINT": OperationTypeCreateEndpoint, + "DELETE_ENDPOINT": OperationTypeDeleteEndpoint, + "UPDATE_ENDPOINT": OperationTypeUpdateEndpoint, + "MOVE_ENDPOINT": OperationTypeMoveEndpoint, +} + +var mappingOperationTypeEnumLowerCase = map[string]OperationTypeEnum{ + "create_model": OperationTypeCreateModel, + "delete_model": OperationTypeDeleteModel, + "move_model": OperationTypeMoveModel, + "create_dedicated_ai_cluster": OperationTypeCreateDedicatedAiCluster, + "delete_dedicated_ai_cluster": OperationTypeDeleteDedicatedAiCluster, + "update_dedicated_ai_cluster": OperationTypeUpdateDedicatedAiCluster, + "move_dedicated_ai_cluster": OperationTypeMoveDedicatedAiCluster, + "create_endpoint": OperationTypeCreateEndpoint, + "delete_endpoint": OperationTypeDeleteEndpoint, + "update_endpoint": OperationTypeUpdateEndpoint, + "move_endpoint": OperationTypeMoveEndpoint, +} + +// GetOperationTypeEnumValues Enumerates the set of values for OperationTypeEnum +func GetOperationTypeEnumValues() []OperationTypeEnum { + values := make([]OperationTypeEnum, 0) + for _, v := range mappingOperationTypeEnum { + values = append(values, v) + } + return values +} + +// GetOperationTypeEnumStringValues Enumerates the set of values in String for OperationTypeEnum +func GetOperationTypeEnumStringValues() []string { + return []string{ + "CREATE_MODEL", + "DELETE_MODEL", + "MOVE_MODEL", + "CREATE_DEDICATED_AI_CLUSTER", + "DELETE_DEDICATED_AI_CLUSTER", + "UPDATE_DEDICATED_AI_CLUSTER", + "MOVE_DEDICATED_AI_CLUSTER", + "CREATE_ENDPOINT", + "DELETE_ENDPOINT", + "UPDATE_ENDPOINT", + "MOVE_ENDPOINT", + } +} + +// GetMappingOperationTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingOperationTypeEnum(val string) (OperationTypeEnum, bool) { + enum, ok := mappingOperationTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/sort_order.go b/generativeai/sort_order.go new file mode 100644 index 0000000000..9bc05e0926 --- /dev/null +++ b/generativeai/sort_order.go @@ -0,0 +1,59 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// SortOrderEnum Enum with underlying type: string +type SortOrderEnum string + +// Set of constants representing the allowable values for SortOrderEnum +const ( + SortOrderAsc SortOrderEnum = "ASC" + SortOrderDesc SortOrderEnum = "DESC" +) + +var mappingSortOrderEnum = map[string]SortOrderEnum{ + "ASC": SortOrderAsc, + "DESC": SortOrderDesc, +} + +var mappingSortOrderEnumLowerCase = map[string]SortOrderEnum{ + "asc": SortOrderAsc, + "desc": SortOrderDesc, +} + +// GetSortOrderEnumValues Enumerates the set of values for SortOrderEnum +func GetSortOrderEnumValues() []SortOrderEnum { + values := make([]SortOrderEnum, 0) + for _, v := range mappingSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetSortOrderEnumStringValues Enumerates the set of values in String for SortOrderEnum +func GetSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingSortOrderEnum(val string) (SortOrderEnum, bool) { + enum, ok := mappingSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/t_few_training_config.go b/generativeai/t_few_training_config.go new file mode 100644 index 0000000000..4764c13f72 --- /dev/null +++ b/generativeai/t_few_training_config.go @@ -0,0 +1,103 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// TFewTrainingConfig The TFEW training method hyperparameters. +type TFewTrainingConfig struct { + + // The maximum number of training epochs to run for. + TotalTrainingEpochs *int `mandatory:"false" json:"totalTrainingEpochs"` + + // The initial learning rate to be used during training + LearningRate *float64 `mandatory:"false" json:"learningRate"` + + // The batch size used during training. + TrainingBatchSize *int `mandatory:"false" json:"trainingBatchSize"` + + // Stop training if the loss metric does not improve beyond 'early_stopping_threshold' for this many times of evaluation. + EarlyStoppingPatience *int `mandatory:"false" json:"earlyStoppingPatience"` + + // How much the loss must improve to prevent early stopping. + EarlyStoppingThreshold *float64 `mandatory:"false" json:"earlyStoppingThreshold"` + + // Determines how frequently to log model metrics. + // Every step is logged for the first 20 steps and then follows this parameter for log frequency. Set to 0 to disable logging the model metrics. + LogModelMetricsIntervalInSteps *int `mandatory:"false" json:"logModelMetricsIntervalInSteps"` +} + +// GetTotalTrainingEpochs returns TotalTrainingEpochs +func (m TFewTrainingConfig) GetTotalTrainingEpochs() *int { + return m.TotalTrainingEpochs +} + +// GetLearningRate returns LearningRate +func (m TFewTrainingConfig) GetLearningRate() *float64 { + return m.LearningRate +} + +// GetTrainingBatchSize returns TrainingBatchSize +func (m TFewTrainingConfig) GetTrainingBatchSize() *int { + return m.TrainingBatchSize +} + +// GetEarlyStoppingPatience returns EarlyStoppingPatience +func (m TFewTrainingConfig) GetEarlyStoppingPatience() *int { + return m.EarlyStoppingPatience +} + +// GetEarlyStoppingThreshold returns EarlyStoppingThreshold +func (m TFewTrainingConfig) GetEarlyStoppingThreshold() *float64 { + return m.EarlyStoppingThreshold +} + +// GetLogModelMetricsIntervalInSteps returns LogModelMetricsIntervalInSteps +func (m TFewTrainingConfig) GetLogModelMetricsIntervalInSteps() *int { + return m.LogModelMetricsIntervalInSteps +} + +func (m TFewTrainingConfig) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m TFewTrainingConfig) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m TFewTrainingConfig) MarshalJSON() (buff []byte, e error) { + type MarshalTypeTFewTrainingConfig TFewTrainingConfig + s := struct { + DiscriminatorParam string `json:"trainingConfigType"` + MarshalTypeTFewTrainingConfig + }{ + "TFEW_TRAINING_CONFIG", + (MarshalTypeTFewTrainingConfig)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeai/text_generation_model_metrics.go b/generativeai/text_generation_model_metrics.go new file mode 100644 index 0000000000..6922eea8b0 --- /dev/null +++ b/generativeai/text_generation_model_metrics.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// TextGenerationModelMetrics The text generation model metrics of the fine-tuning process. +type TextGenerationModelMetrics struct { + + // Fine-tuned model accuracy. + FinalAccuracy *float64 `mandatory:"false" json:"finalAccuracy"` + + // Fine-tuned model loss. + FinalLoss *float64 `mandatory:"false" json:"finalLoss"` +} + +func (m TextGenerationModelMetrics) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m TextGenerationModelMetrics) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m TextGenerationModelMetrics) MarshalJSON() (buff []byte, e error) { + type MarshalTypeTextGenerationModelMetrics TextGenerationModelMetrics + s := struct { + DiscriminatorParam string `json:"modelMetricsType"` + MarshalTypeTextGenerationModelMetrics + }{ + "TEXT_GENERATION_MODEL_METRICS", + (MarshalTypeTextGenerationModelMetrics)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeai/training_config.go b/generativeai/training_config.go new file mode 100644 index 0000000000..c8fb64762b --- /dev/null +++ b/generativeai/training_config.go @@ -0,0 +1,187 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// TrainingConfig The fine-tuning method and hyperparameters used for fine-tuning a custom model. +type TrainingConfig interface { + + // The maximum number of training epochs to run for. + GetTotalTrainingEpochs() *int + + // The initial learning rate to be used during training + GetLearningRate() *float64 + + // The batch size used during training. + GetTrainingBatchSize() *int + + // Stop training if the loss metric does not improve beyond 'early_stopping_threshold' for this many times of evaluation. + GetEarlyStoppingPatience() *int + + // How much the loss must improve to prevent early stopping. + GetEarlyStoppingThreshold() *float64 + + // Determines how frequently to log model metrics. + // Every step is logged for the first 20 steps and then follows this parameter for log frequency. Set to 0 to disable logging the model metrics. + GetLogModelMetricsIntervalInSteps() *int +} + +type trainingconfig struct { + JsonData []byte + TotalTrainingEpochs *int `mandatory:"false" json:"totalTrainingEpochs"` + LearningRate *float64 `mandatory:"false" json:"learningRate"` + TrainingBatchSize *int `mandatory:"false" json:"trainingBatchSize"` + EarlyStoppingPatience *int `mandatory:"false" json:"earlyStoppingPatience"` + EarlyStoppingThreshold *float64 `mandatory:"false" json:"earlyStoppingThreshold"` + LogModelMetricsIntervalInSteps *int `mandatory:"false" json:"logModelMetricsIntervalInSteps"` + TrainingConfigType string `json:"trainingConfigType"` +} + +// UnmarshalJSON unmarshals json +func (m *trainingconfig) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalertrainingconfig trainingconfig + s := struct { + Model Unmarshalertrainingconfig + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.TotalTrainingEpochs = s.Model.TotalTrainingEpochs + m.LearningRate = s.Model.LearningRate + m.TrainingBatchSize = s.Model.TrainingBatchSize + m.EarlyStoppingPatience = s.Model.EarlyStoppingPatience + m.EarlyStoppingThreshold = s.Model.EarlyStoppingThreshold + m.LogModelMetricsIntervalInSteps = s.Model.LogModelMetricsIntervalInSteps + m.TrainingConfigType = s.Model.TrainingConfigType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *trainingconfig) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.TrainingConfigType { + case "VANILLA_TRAINING_CONFIG": + mm := VanillaTrainingConfig{} + err = json.Unmarshal(data, &mm) + return mm, err + case "TFEW_TRAINING_CONFIG": + mm := TFewTrainingConfig{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for TrainingConfig: %s.", m.TrainingConfigType) + return *m, nil + } +} + +// GetTotalTrainingEpochs returns TotalTrainingEpochs +func (m trainingconfig) GetTotalTrainingEpochs() *int { + return m.TotalTrainingEpochs +} + +// GetLearningRate returns LearningRate +func (m trainingconfig) GetLearningRate() *float64 { + return m.LearningRate +} + +// GetTrainingBatchSize returns TrainingBatchSize +func (m trainingconfig) GetTrainingBatchSize() *int { + return m.TrainingBatchSize +} + +// GetEarlyStoppingPatience returns EarlyStoppingPatience +func (m trainingconfig) GetEarlyStoppingPatience() *int { + return m.EarlyStoppingPatience +} + +// GetEarlyStoppingThreshold returns EarlyStoppingThreshold +func (m trainingconfig) GetEarlyStoppingThreshold() *float64 { + return m.EarlyStoppingThreshold +} + +// GetLogModelMetricsIntervalInSteps returns LogModelMetricsIntervalInSteps +func (m trainingconfig) GetLogModelMetricsIntervalInSteps() *int { + return m.LogModelMetricsIntervalInSteps +} + +func (m trainingconfig) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m trainingconfig) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// TrainingConfigTrainingConfigTypeEnum Enum with underlying type: string +type TrainingConfigTrainingConfigTypeEnum string + +// Set of constants representing the allowable values for TrainingConfigTrainingConfigTypeEnum +const ( + TrainingConfigTrainingConfigTypeTfewTrainingConfig TrainingConfigTrainingConfigTypeEnum = "TFEW_TRAINING_CONFIG" + TrainingConfigTrainingConfigTypeVanillaTrainingConfig TrainingConfigTrainingConfigTypeEnum = "VANILLA_TRAINING_CONFIG" +) + +var mappingTrainingConfigTrainingConfigTypeEnum = map[string]TrainingConfigTrainingConfigTypeEnum{ + "TFEW_TRAINING_CONFIG": TrainingConfigTrainingConfigTypeTfewTrainingConfig, + "VANILLA_TRAINING_CONFIG": TrainingConfigTrainingConfigTypeVanillaTrainingConfig, +} + +var mappingTrainingConfigTrainingConfigTypeEnumLowerCase = map[string]TrainingConfigTrainingConfigTypeEnum{ + "tfew_training_config": TrainingConfigTrainingConfigTypeTfewTrainingConfig, + "vanilla_training_config": TrainingConfigTrainingConfigTypeVanillaTrainingConfig, +} + +// GetTrainingConfigTrainingConfigTypeEnumValues Enumerates the set of values for TrainingConfigTrainingConfigTypeEnum +func GetTrainingConfigTrainingConfigTypeEnumValues() []TrainingConfigTrainingConfigTypeEnum { + values := make([]TrainingConfigTrainingConfigTypeEnum, 0) + for _, v := range mappingTrainingConfigTrainingConfigTypeEnum { + values = append(values, v) + } + return values +} + +// GetTrainingConfigTrainingConfigTypeEnumStringValues Enumerates the set of values in String for TrainingConfigTrainingConfigTypeEnum +func GetTrainingConfigTrainingConfigTypeEnumStringValues() []string { + return []string{ + "TFEW_TRAINING_CONFIG", + "VANILLA_TRAINING_CONFIG", + } +} + +// GetMappingTrainingConfigTrainingConfigTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingTrainingConfigTrainingConfigTypeEnum(val string) (TrainingConfigTrainingConfigTypeEnum, bool) { + enum, ok := mappingTrainingConfigTrainingConfigTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/update_dedicated_ai_cluster_details.go b/generativeai/update_dedicated_ai_cluster_details.go new file mode 100644 index 0000000000..3c3204c9e3 --- /dev/null +++ b/generativeai/update_dedicated_ai_cluster_details.go @@ -0,0 +1,58 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// UpdateDedicatedAiClusterDetails The data to update a dedicated AI cluster. +type UpdateDedicatedAiClusterDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the dedicated AI cluster. + Description *string `mandatory:"false" json:"description"` + + // The number of dedicated units in this AI cluster. + UnitCount *int `mandatory:"false" json:"unitCount"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m UpdateDedicatedAiClusterDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m UpdateDedicatedAiClusterDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/update_dedicated_ai_cluster_request_response.go b/generativeai/update_dedicated_ai_cluster_request_response.go new file mode 100644 index 0000000000..1d2b544691 --- /dev/null +++ b/generativeai/update_dedicated_ai_cluster_request_response.go @@ -0,0 +1,109 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// UpdateDedicatedAiClusterRequest wrapper for the UpdateDedicatedAiCluster operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateDedicatedAiCluster.go.html to see an example of how to use UpdateDedicatedAiClusterRequest. +type UpdateDedicatedAiClusterRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the dedicated AI cluster. + DedicatedAiClusterId *string `mandatory:"true" contributesTo:"path" name:"dedicatedAiClusterId"` + + // The information to be updated. + UpdateDedicatedAiClusterDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateDedicatedAiClusterRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateDedicatedAiClusterRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateDedicatedAiClusterRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateDedicatedAiClusterRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request UpdateDedicatedAiClusterRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UpdateDedicatedAiClusterResponse wrapper for the UpdateDedicatedAiCluster operation +type UpdateDedicatedAiClusterResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The DedicatedAiCluster instance + DedicatedAiCluster `presentIn:"body"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateDedicatedAiClusterResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateDedicatedAiClusterResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/update_endpoint_details.go b/generativeai/update_endpoint_details.go new file mode 100644 index 0000000000..e6e504ac32 --- /dev/null +++ b/generativeai/update_endpoint_details.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// UpdateEndpointDetails The data to update an endpoint. +type UpdateEndpointDetails struct { + + // A user-friendly name. Does not have to be unique, and it's changeable. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the endpoint. + Description *string `mandatory:"false" json:"description"` + + ContentModerationConfig *ContentModerationConfig `mandatory:"false" json:"contentModerationConfig"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m UpdateEndpointDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m UpdateEndpointDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/update_endpoint_request_response.go b/generativeai/update_endpoint_request_response.go new file mode 100644 index 0000000000..4ffd54a823 --- /dev/null +++ b/generativeai/update_endpoint_request_response.go @@ -0,0 +1,109 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// UpdateEndpointRequest wrapper for the UpdateEndpoint operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateEndpoint.go.html to see an example of how to use UpdateEndpointRequest. +type UpdateEndpointRequest struct { + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the endpoint. + EndpointId *string `mandatory:"true" contributesTo:"path" name:"endpointId"` + + // The information to be updated. + UpdateEndpointDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateEndpointRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateEndpointRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateEndpointRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateEndpointRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request UpdateEndpointRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UpdateEndpointResponse wrapper for the UpdateEndpoint operation +type UpdateEndpointResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Endpoint instance + Endpoint `presentIn:"body"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the asynchronous work request. + // Use GetWorkRequest with this ID to track the status of the request. + OpcWorkRequestId *string `presentIn:"header" name:"opc-work-request-id"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` +} + +func (response UpdateEndpointResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateEndpointResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/update_model_details.go b/generativeai/update_model_details.go new file mode 100644 index 0000000000..0aa5bbfab5 --- /dev/null +++ b/generativeai/update_model_details.go @@ -0,0 +1,61 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// UpdateModelDetails The data to update a custom model. +type UpdateModelDetails struct { + + // A user-friendly name. + DisplayName *string `mandatory:"false" json:"displayName"` + + // An optional description of the model. + Description *string `mandatory:"false" json:"description"` + + // The provider of the base model. + Vendor *string `mandatory:"false" json:"vendor"` + + // The version of the model. + Version *string `mandatory:"false" json:"version"` + + // Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m UpdateModelDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m UpdateModelDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/update_model_request_response.go b/generativeai/update_model_request_response.go new file mode 100644 index 0000000000..7beb44ad91 --- /dev/null +++ b/generativeai/update_model_request_response.go @@ -0,0 +1,105 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// UpdateModelRequest wrapper for the UpdateModel operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeai/UpdateModel.go.html to see an example of how to use UpdateModelRequest. +type UpdateModelRequest struct { + + // The model OCID + ModelId *string `mandatory:"true" contributesTo:"path" name:"modelId"` + + // The model information to be updated. + UpdateModelDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call for a resource, set the + // `if-match` parameter to the value of the etag from a previous GET or POST response for + // that resource. The resource will be updated or deleted only if the etag you provide + // matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + // The only valid characters for request IDs are letters, numbers, + // underscore, and dash. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateModelRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateModelRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateModelRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateModelRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request UpdateModelRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UpdateModelResponse wrapper for the UpdateModel operation +type UpdateModelResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The Model instance + Model `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateModelResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateModelResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeai/vanilla_training_config.go b/generativeai/vanilla_training_config.go new file mode 100644 index 0000000000..988873c40f --- /dev/null +++ b/generativeai/vanilla_training_config.go @@ -0,0 +1,106 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// VanillaTrainingConfig The Vanilla training method hyperparameters. +type VanillaTrainingConfig struct { + + // The maximum number of training epochs to run for. + TotalTrainingEpochs *int `mandatory:"false" json:"totalTrainingEpochs"` + + // The initial learning rate to be used during training + LearningRate *float64 `mandatory:"false" json:"learningRate"` + + // The batch size used during training. + TrainingBatchSize *int `mandatory:"false" json:"trainingBatchSize"` + + // Stop training if the loss metric does not improve beyond 'early_stopping_threshold' for this many times of evaluation. + EarlyStoppingPatience *int `mandatory:"false" json:"earlyStoppingPatience"` + + // How much the loss must improve to prevent early stopping. + EarlyStoppingThreshold *float64 `mandatory:"false" json:"earlyStoppingThreshold"` + + // Determines how frequently to log model metrics. + // Every step is logged for the first 20 steps and then follows this parameter for log frequency. Set to 0 to disable logging the model metrics. + LogModelMetricsIntervalInSteps *int `mandatory:"false" json:"logModelMetricsIntervalInSteps"` + + // The number of last layers to be fine-tuned. + NumOfLastLayers *int `mandatory:"false" json:"numOfLastLayers"` +} + +// GetTotalTrainingEpochs returns TotalTrainingEpochs +func (m VanillaTrainingConfig) GetTotalTrainingEpochs() *int { + return m.TotalTrainingEpochs +} + +// GetLearningRate returns LearningRate +func (m VanillaTrainingConfig) GetLearningRate() *float64 { + return m.LearningRate +} + +// GetTrainingBatchSize returns TrainingBatchSize +func (m VanillaTrainingConfig) GetTrainingBatchSize() *int { + return m.TrainingBatchSize +} + +// GetEarlyStoppingPatience returns EarlyStoppingPatience +func (m VanillaTrainingConfig) GetEarlyStoppingPatience() *int { + return m.EarlyStoppingPatience +} + +// GetEarlyStoppingThreshold returns EarlyStoppingThreshold +func (m VanillaTrainingConfig) GetEarlyStoppingThreshold() *float64 { + return m.EarlyStoppingThreshold +} + +// GetLogModelMetricsIntervalInSteps returns LogModelMetricsIntervalInSteps +func (m VanillaTrainingConfig) GetLogModelMetricsIntervalInSteps() *int { + return m.LogModelMetricsIntervalInSteps +} + +func (m VanillaTrainingConfig) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m VanillaTrainingConfig) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m VanillaTrainingConfig) MarshalJSON() (buff []byte, e error) { + type MarshalTypeVanillaTrainingConfig VanillaTrainingConfig + s := struct { + DiscriminatorParam string `json:"trainingConfigType"` + MarshalTypeVanillaTrainingConfig + }{ + "VANILLA_TRAINING_CONFIG", + (MarshalTypeVanillaTrainingConfig)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeai/work_request.go b/generativeai/work_request.go new file mode 100644 index 0000000000..44dabdb367 --- /dev/null +++ b/generativeai/work_request.go @@ -0,0 +1,77 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequest An asynchronous work request. When you start a long-running operation, the service creates a work request. Work requests help you monitor long-running operations. +// A work request is an activity log that lets you track each step in the operation's progress. Each work request has an OCID that lets you interact with it programmatically and use it for automation. +type WorkRequest struct { + + // The asynchronous operation tracked by this work request. + OperationType OperationTypeEnum `mandatory:"true" json:"operationType"` + + // The status of the work request. + Status OperationStatusEnum `mandatory:"true" json:"status"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the work request. + Id *string `mandatory:"true" json:"id"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment that contains the work request. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The resources that are affected by the work request. + Resources []WorkRequestResource `mandatory:"true" json:"resources"` + + // Shows the progress of the operation tracked by the work request, as a percentage of the total work + // that must be performed. + PercentComplete *float32 `mandatory:"true" json:"percentComplete"` + + // The date and time the work request was created, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + TimeAccepted *common.SDKTime `mandatory:"true" json:"timeAccepted"` + + // The date and time the work request was started, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + TimeStarted *common.SDKTime `mandatory:"false" json:"timeStarted"` + + // The date and time the work request was finished, in the format defined by + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339). + TimeFinished *common.SDKTime `mandatory:"false" json:"timeFinished"` +} + +func (m WorkRequest) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingOperationTypeEnum(string(m.OperationType)); !ok && m.OperationType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for OperationType: %s. Supported values are: %s.", m.OperationType, strings.Join(GetOperationTypeEnumStringValues(), ","))) + } + if _, ok := GetMappingOperationStatusEnum(string(m.Status)); !ok && m.Status != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Status: %s. Supported values are: %s.", m.Status, strings.Join(GetOperationStatusEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_error.go b/generativeai/work_request_error.go new file mode 100644 index 0000000000..ff52a0736c --- /dev/null +++ b/generativeai/work_request_error.go @@ -0,0 +1,50 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestError An error encountered while performing an operation that is tracked by this work request. +type WorkRequestError struct { + + // A machine-usable code for the error that occurred. For a list of error codes, see + // API Errors (https://docs.cloud.oracle.com/iaas/Content/API/References/apierrors.htm). + Code *string `mandatory:"true" json:"code"` + + // A human-readable error message. + Message *string `mandatory:"true" json:"message"` + + // The date and time that the error occurred, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + Timestamp *common.SDKTime `mandatory:"true" json:"timestamp"` +} + +func (m WorkRequestError) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestError) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_error_collection.go b/generativeai/work_request_error_collection.go new file mode 100644 index 0000000000..d05fa7bebc --- /dev/null +++ b/generativeai/work_request_error_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestErrorCollection A list of work request errors. Can contain errors and other information such as metadata. +type WorkRequestErrorCollection struct { + + // A list of work request errors. + Items []WorkRequestError `mandatory:"true" json:"items"` +} + +func (m WorkRequestErrorCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestErrorCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_log_entry.go b/generativeai/work_request_log_entry.go new file mode 100644 index 0000000000..3fd3dd5cf3 --- /dev/null +++ b/generativeai/work_request_log_entry.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestLogEntry The log message from performing an operation that is tracked by this work request. +type WorkRequestLogEntry struct { + + // A human-readable log message. + Message *string `mandatory:"true" json:"message"` + + // The date and time the log message was written, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + Timestamp *common.SDKTime `mandatory:"true" json:"timestamp"` +} + +func (m WorkRequestLogEntry) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestLogEntry) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_log_entry_collection.go b/generativeai/work_request_log_entry_collection.go new file mode 100644 index 0000000000..9b6616f2f1 --- /dev/null +++ b/generativeai/work_request_log_entry_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestLogEntryCollection A list of work request logs. Can contain logs and other information such as metadata. +type WorkRequestLogEntryCollection struct { + + // A list of work request log entries. + Items []WorkRequestLogEntry `mandatory:"true" json:"items"` +} + +func (m WorkRequestLogEntryCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestLogEntryCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_resource.go b/generativeai/work_request_resource.go new file mode 100644 index 0000000000..380304e309 --- /dev/null +++ b/generativeai/work_request_resource.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestResource The resource created or operated on by a work request. +type WorkRequestResource struct { + + // The resource type that the work request affects. + EntityType *string `mandatory:"true" json:"entityType"` + + // The way in which this resource is affected by the operation tracked in the work request. + // A resource being created, updated, or deleted remains in the IN_PROGRESS state until + // work is complete for that resource, at which point it transitions to CREATED, UPDATED, + // or DELETED, respectively. + ActionType ActionTypeEnum `mandatory:"true" json:"actionType"` + + // An OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) or other unique identifier for the resource. + Identifier *string `mandatory:"true" json:"identifier"` + + // The URI path that you can use for a GET request to access the resource metadata. + EntityUri *string `mandatory:"false" json:"entityUri"` + + // Additional information that helps to explain the resource. + Metadata map[string]string `mandatory:"false" json:"metadata"` +} + +func (m WorkRequestResource) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestResource) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingActionTypeEnum(string(m.ActionType)); !ok && m.ActionType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ActionType: %s. Supported values are: %s.", m.ActionType, strings.Join(GetActionTypeEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_resource_metadata_key.go b/generativeai/work_request_resource_metadata_key.go new file mode 100644 index 0000000000..c94b736d55 --- /dev/null +++ b/generativeai/work_request_resource_metadata_key.go @@ -0,0 +1,55 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "strings" +) + +// WorkRequestResourceMetadataKeyEnum Enum with underlying type: string +type WorkRequestResourceMetadataKeyEnum string + +// Set of constants representing the allowable values for WorkRequestResourceMetadataKeyEnum +const ( + WorkRequestResourceMetadataKeyIsDryRun WorkRequestResourceMetadataKeyEnum = "IS_DRY_RUN" +) + +var mappingWorkRequestResourceMetadataKeyEnum = map[string]WorkRequestResourceMetadataKeyEnum{ + "IS_DRY_RUN": WorkRequestResourceMetadataKeyIsDryRun, +} + +var mappingWorkRequestResourceMetadataKeyEnumLowerCase = map[string]WorkRequestResourceMetadataKeyEnum{ + "is_dry_run": WorkRequestResourceMetadataKeyIsDryRun, +} + +// GetWorkRequestResourceMetadataKeyEnumValues Enumerates the set of values for WorkRequestResourceMetadataKeyEnum +func GetWorkRequestResourceMetadataKeyEnumValues() []WorkRequestResourceMetadataKeyEnum { + values := make([]WorkRequestResourceMetadataKeyEnum, 0) + for _, v := range mappingWorkRequestResourceMetadataKeyEnum { + values = append(values, v) + } + return values +} + +// GetWorkRequestResourceMetadataKeyEnumStringValues Enumerates the set of values in String for WorkRequestResourceMetadataKeyEnum +func GetWorkRequestResourceMetadataKeyEnumStringValues() []string { + return []string{ + "IS_DRY_RUN", + } +} + +// GetMappingWorkRequestResourceMetadataKeyEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingWorkRequestResourceMetadataKeyEnum(val string) (WorkRequestResourceMetadataKeyEnum, bool) { + enum, ok := mappingWorkRequestResourceMetadataKeyEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeai/work_request_summary.go b/generativeai/work_request_summary.go new file mode 100644 index 0000000000..fbaf440e60 --- /dev/null +++ b/generativeai/work_request_summary.go @@ -0,0 +1,76 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestSummary Summary information about an asynchronous work request. +type WorkRequestSummary struct { + + // The asynchronous operation tracked by this work request. + OperationType OperationTypeEnum `mandatory:"true" json:"operationType"` + + // The status of the work request. + Status OperationStatusEnum `mandatory:"true" json:"status"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the work request. + Id *string `mandatory:"true" json:"id"` + + // The OCID (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment that contains the work request. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The resources that are affected by this work request. + Resources []WorkRequestResource `mandatory:"true" json:"resources"` + + // Shows the progress of the operation tracked by the work request, as a percentage of the total work + // that must be performed. + PercentComplete *float32 `mandatory:"true" json:"percentComplete"` + + // The date and time the work request was created, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + TimeAccepted *common.SDKTime `mandatory:"true" json:"timeAccepted"` + + // The date and time the work request was started, in the format defined by + // RFC 3339 (https://tools.ietf.org/html/rfc3339). + TimeStarted *common.SDKTime `mandatory:"false" json:"timeStarted"` + + // The date and time the work request was finished, in the format defined by + // RFC 3339 (https://tools.ietf.org/rfc/rfc3339). + TimeFinished *common.SDKTime `mandatory:"false" json:"timeFinished"` +} + +func (m WorkRequestSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingOperationTypeEnum(string(m.OperationType)); !ok && m.OperationType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for OperationType: %s. Supported values are: %s.", m.OperationType, strings.Join(GetOperationTypeEnumStringValues(), ","))) + } + if _, ok := GetMappingOperationStatusEnum(string(m.Status)); !ok && m.Status != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Status: %s. Supported values are: %s.", m.Status, strings.Join(GetOperationStatusEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeai/work_request_summary_collection.go b/generativeai/work_request_summary_collection.go new file mode 100644 index 0000000000..fe77e2049d --- /dev/null +++ b/generativeai/work_request_summary_collection.go @@ -0,0 +1,42 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Management API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service management API to create and manage DedicatedAiCluster, Endpoint, Model, and WorkRequest in the Generative AI service. For example, create a custom model by fine-tuning an out-of-the-box model using your own data, on a fine-tuning dedicated AI cluster. Then, create a hosting dedicated AI cluster with an endpoint to host your custom model. +// To access your custom model endpoints, or to try the out-of-the-box models to generate text, summarize, and create text embeddings see the Generative AI Inference API (https://docs.cloud.oracle.com/#/en/generative-ai-inference/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeai + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// WorkRequestSummaryCollection A list of work requests. Can contain work requests and other information such as metadata. +type WorkRequestSummaryCollection struct { + + // A list of work requests. + Items []WorkRequestSummary `mandatory:"true" json:"items"` +} + +func (m WorkRequestSummaryCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m WorkRequestSummaryCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/choice.go b/generativeaiinference/choice.go new file mode 100644 index 0000000000..04ff8663df --- /dev/null +++ b/generativeaiinference/choice.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Choice Represents a single instance of generated text. +type Choice struct { + + // The index of the generated text. + Index *int `mandatory:"true" json:"index"` + + // The generated text. + Text *string `mandatory:"true" json:"text"` + + // The reason why the model stopped generating tokens. + // Stops if the model hits a natural stop point or a provided stop sequence. Returns the length if the tokens reach the specified maximum number of tokens. + FinishReason *string `mandatory:"true" json:"finishReason"` + + Logprobs *Logprobs `mandatory:"false" json:"logprobs"` +} + +func (m Choice) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m Choice) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/cohere_llm_inference_request.go b/generativeaiinference/cohere_llm_inference_request.go new file mode 100644 index 0000000000..e85175fff6 --- /dev/null +++ b/generativeaiinference/cohere_llm_inference_request.go @@ -0,0 +1,195 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CohereLlmInferenceRequest Details for the text generation request for Cohere models. +type CohereLlmInferenceRequest struct { + + // Represents the prompt to be completed. The trailing white spaces are trimmed before completion. + Prompt *string `mandatory:"true" json:"prompt"` + + // Whether to stream back partial progress. If set, tokens are sent as data-only server-sent events as they become available. + IsStream *bool `mandatory:"false" json:"isStream"` + + // The number of generated texts that will be returned. + NumGenerations *int `mandatory:"false" json:"numGenerations"` + + // Whether or not to return the user prompt in the response. This option only applies to non-stream results. + IsEcho *bool `mandatory:"false" json:"isEcho"` + + // The maximum number of tokens to predict for each response. Includes input plus output tokens. + MaxTokens *int `mandatory:"false" json:"maxTokens"` + + // A number that sets the randomness of the generated output. A lower temperature means a less random generations. + // Use lower numbers for tasks with a correct answer such as question answering or summarizing. High temperatures can generate hallucinations or factually incorrect information. Start with temperatures lower than 1.0 and increase the temperature for more creative outputs, as you regenerate the prompts to refine the outputs. + Temperature *float64 `mandatory:"false" json:"temperature"` + + // An integer that sets up the model to use only the top k most likely tokens in the generated output. A higher k introduces more randomness into the output making the output text sound more natural. Default value is 0 which disables this method and considers all tokens. To set a number for the likely tokens, choose an integer between 1 and 500. + // If also using top p, then the model considers only the top tokens whose probabilities add up to p percent and ignores the rest of the k tokens. For example, if k is 20, but the probabilities of the top 10 add up to .75, then only the top 10 tokens are chosen. + TopK *int `mandatory:"false" json:"topK"` + + // If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. + // To eliminate tokens with low likelihood, assign p a minimum percentage for the next token's likelihood. For example, when p is set to 0.75, the model eliminates the bottom 25 percent for the next token. Set to 1.0 to consider all tokens and set to 0 to disable. If both k and p are enabled, p acts after k. + TopP *float64 `mandatory:"false" json:"topP"` + + // To reduce repetitiveness of generated tokens, this number penalizes new tokens based on their frequency in the generated text so far. Greater numbers encourage the model to use new tokens, while lower numbers encourage the model to repeat the tokens. Set to 0 to disable. + FrequencyPenalty *float64 `mandatory:"false" json:"frequencyPenalty"` + + // To reduce repetitiveness of generated tokens, this number penalizes new tokens based on whether they've appeared in the generated text so far. Greater numbers encourage the model to use new tokens, while lower numbers encourage the model to repeat the tokens. + // Similar to frequency penalty, a penalty is applied to previously present tokens, except that this penalty is applied equally to all tokens that have already appeared, regardless of how many times they've appeared. Set to 0 to disable. + PresencePenalty *float64 `mandatory:"false" json:"presencePenalty"` + + // The generated text is cut at the end of the earliest occurrence of this stop sequence. The generated text will include this stop sequence. + StopSequences []string `mandatory:"false" json:"stopSequences"` + + // Specifies how and if the token likelihoods are returned with the response. + ReturnLikelihoods CohereLlmInferenceRequestReturnLikelihoodsEnum `mandatory:"false" json:"returnLikelihoods,omitempty"` + + // For an input that's longer than the maximum token length, specifies which part of the input text will be truncated. + Truncate CohereLlmInferenceRequestTruncateEnum `mandatory:"false" json:"truncate,omitempty"` +} + +func (m CohereLlmInferenceRequest) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CohereLlmInferenceRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingCohereLlmInferenceRequestReturnLikelihoodsEnum(string(m.ReturnLikelihoods)); !ok && m.ReturnLikelihoods != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for ReturnLikelihoods: %s. Supported values are: %s.", m.ReturnLikelihoods, strings.Join(GetCohereLlmInferenceRequestReturnLikelihoodsEnumStringValues(), ","))) + } + if _, ok := GetMappingCohereLlmInferenceRequestTruncateEnum(string(m.Truncate)); !ok && m.Truncate != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Truncate: %s. Supported values are: %s.", m.Truncate, strings.Join(GetCohereLlmInferenceRequestTruncateEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CohereLlmInferenceRequest) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCohereLlmInferenceRequest CohereLlmInferenceRequest + s := struct { + DiscriminatorParam string `json:"runtimeType"` + MarshalTypeCohereLlmInferenceRequest + }{ + "COHERE", + (MarshalTypeCohereLlmInferenceRequest)(m), + } + + return json.Marshal(&s) +} + +// CohereLlmInferenceRequestReturnLikelihoodsEnum Enum with underlying type: string +type CohereLlmInferenceRequestReturnLikelihoodsEnum string + +// Set of constants representing the allowable values for CohereLlmInferenceRequestReturnLikelihoodsEnum +const ( + CohereLlmInferenceRequestReturnLikelihoodsNone CohereLlmInferenceRequestReturnLikelihoodsEnum = "NONE" + CohereLlmInferenceRequestReturnLikelihoodsAll CohereLlmInferenceRequestReturnLikelihoodsEnum = "ALL" + CohereLlmInferenceRequestReturnLikelihoodsGeneration CohereLlmInferenceRequestReturnLikelihoodsEnum = "GENERATION" +) + +var mappingCohereLlmInferenceRequestReturnLikelihoodsEnum = map[string]CohereLlmInferenceRequestReturnLikelihoodsEnum{ + "NONE": CohereLlmInferenceRequestReturnLikelihoodsNone, + "ALL": CohereLlmInferenceRequestReturnLikelihoodsAll, + "GENERATION": CohereLlmInferenceRequestReturnLikelihoodsGeneration, +} + +var mappingCohereLlmInferenceRequestReturnLikelihoodsEnumLowerCase = map[string]CohereLlmInferenceRequestReturnLikelihoodsEnum{ + "none": CohereLlmInferenceRequestReturnLikelihoodsNone, + "all": CohereLlmInferenceRequestReturnLikelihoodsAll, + "generation": CohereLlmInferenceRequestReturnLikelihoodsGeneration, +} + +// GetCohereLlmInferenceRequestReturnLikelihoodsEnumValues Enumerates the set of values for CohereLlmInferenceRequestReturnLikelihoodsEnum +func GetCohereLlmInferenceRequestReturnLikelihoodsEnumValues() []CohereLlmInferenceRequestReturnLikelihoodsEnum { + values := make([]CohereLlmInferenceRequestReturnLikelihoodsEnum, 0) + for _, v := range mappingCohereLlmInferenceRequestReturnLikelihoodsEnum { + values = append(values, v) + } + return values +} + +// GetCohereLlmInferenceRequestReturnLikelihoodsEnumStringValues Enumerates the set of values in String for CohereLlmInferenceRequestReturnLikelihoodsEnum +func GetCohereLlmInferenceRequestReturnLikelihoodsEnumStringValues() []string { + return []string{ + "NONE", + "ALL", + "GENERATION", + } +} + +// GetMappingCohereLlmInferenceRequestReturnLikelihoodsEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingCohereLlmInferenceRequestReturnLikelihoodsEnum(val string) (CohereLlmInferenceRequestReturnLikelihoodsEnum, bool) { + enum, ok := mappingCohereLlmInferenceRequestReturnLikelihoodsEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// CohereLlmInferenceRequestTruncateEnum Enum with underlying type: string +type CohereLlmInferenceRequestTruncateEnum string + +// Set of constants representing the allowable values for CohereLlmInferenceRequestTruncateEnum +const ( + CohereLlmInferenceRequestTruncateNone CohereLlmInferenceRequestTruncateEnum = "NONE" + CohereLlmInferenceRequestTruncateStart CohereLlmInferenceRequestTruncateEnum = "START" + CohereLlmInferenceRequestTruncateEnd CohereLlmInferenceRequestTruncateEnum = "END" +) + +var mappingCohereLlmInferenceRequestTruncateEnum = map[string]CohereLlmInferenceRequestTruncateEnum{ + "NONE": CohereLlmInferenceRequestTruncateNone, + "START": CohereLlmInferenceRequestTruncateStart, + "END": CohereLlmInferenceRequestTruncateEnd, +} + +var mappingCohereLlmInferenceRequestTruncateEnumLowerCase = map[string]CohereLlmInferenceRequestTruncateEnum{ + "none": CohereLlmInferenceRequestTruncateNone, + "start": CohereLlmInferenceRequestTruncateStart, + "end": CohereLlmInferenceRequestTruncateEnd, +} + +// GetCohereLlmInferenceRequestTruncateEnumValues Enumerates the set of values for CohereLlmInferenceRequestTruncateEnum +func GetCohereLlmInferenceRequestTruncateEnumValues() []CohereLlmInferenceRequestTruncateEnum { + values := make([]CohereLlmInferenceRequestTruncateEnum, 0) + for _, v := range mappingCohereLlmInferenceRequestTruncateEnum { + values = append(values, v) + } + return values +} + +// GetCohereLlmInferenceRequestTruncateEnumStringValues Enumerates the set of values in String for CohereLlmInferenceRequestTruncateEnum +func GetCohereLlmInferenceRequestTruncateEnumStringValues() []string { + return []string{ + "NONE", + "START", + "END", + } +} + +// GetMappingCohereLlmInferenceRequestTruncateEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingCohereLlmInferenceRequestTruncateEnum(val string) (CohereLlmInferenceRequestTruncateEnum, bool) { + enum, ok := mappingCohereLlmInferenceRequestTruncateEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/cohere_llm_inference_response.go b/generativeaiinference/cohere_llm_inference_response.go new file mode 100644 index 0000000000..fdeefba7a5 --- /dev/null +++ b/generativeaiinference/cohere_llm_inference_response.go @@ -0,0 +1,63 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CohereLlmInferenceResponse The generated text result to return. +type CohereLlmInferenceResponse struct { + + // Each prompt in the input array has an array of GeneratedText, controlled by numGenerations parameter in the request. + GeneratedTexts []GeneratedText `mandatory:"true" json:"generatedTexts"` + + // The date and time that the model was created in an RFC3339 formatted datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // Represents the original prompt. Applies only to non-stream responses. + Prompt *string `mandatory:"false" json:"prompt"` +} + +func (m CohereLlmInferenceResponse) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CohereLlmInferenceResponse) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m CohereLlmInferenceResponse) MarshalJSON() (buff []byte, e error) { + type MarshalTypeCohereLlmInferenceResponse CohereLlmInferenceResponse + s := struct { + DiscriminatorParam string `json:"runtimeType"` + MarshalTypeCohereLlmInferenceResponse + }{ + "COHERE", + (MarshalTypeCohereLlmInferenceResponse)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeaiinference/dedicated_serving_mode.go b/generativeaiinference/dedicated_serving_mode.go new file mode 100644 index 0000000000..a7a26cea78 --- /dev/null +++ b/generativeaiinference/dedicated_serving_mode.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// DedicatedServingMode The model's serving mode is dedicated serving and has an endpoint on a dedicated AI cluster. +type DedicatedServingMode struct { + + // The OCID of the endpoint to use. + EndpointId *string `mandatory:"true" json:"endpointId"` +} + +func (m DedicatedServingMode) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m DedicatedServingMode) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m DedicatedServingMode) MarshalJSON() (buff []byte, e error) { + type MarshalTypeDedicatedServingMode DedicatedServingMode + s := struct { + DiscriminatorParam string `json:"servingType"` + MarshalTypeDedicatedServingMode + }{ + "DEDICATED", + (MarshalTypeDedicatedServingMode)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeaiinference/embed_text_details.go b/generativeaiinference/embed_text_details.go new file mode 100644 index 0000000000..2e0d15cf4d --- /dev/null +++ b/generativeaiinference/embed_text_details.go @@ -0,0 +1,198 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// EmbedTextDetails Details for the request to embed texts. +type EmbedTextDetails struct { + + // The list of strings for embeddings. + Inputs []string `mandatory:"true" json:"inputs"` + + ServingMode ServingMode `mandatory:"true" json:"servingMode"` + + // The OCID of compartment that the user is authorized to use to call into the Generative AI service. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Whether or not to include the original inputs in the response. Results are index-based. + IsEcho *bool `mandatory:"false" json:"isEcho"` + + // For an input that's longer than the maximum token length, specifies which part of the input text will be truncated. + Truncate EmbedTextDetailsTruncateEnum `mandatory:"false" json:"truncate,omitempty"` + + // Specifies the input type. + InputType EmbedTextDetailsInputTypeEnum `mandatory:"false" json:"inputType,omitempty"` +} + +func (m EmbedTextDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m EmbedTextDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if _, ok := GetMappingEmbedTextDetailsTruncateEnum(string(m.Truncate)); !ok && m.Truncate != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Truncate: %s. Supported values are: %s.", m.Truncate, strings.Join(GetEmbedTextDetailsTruncateEnumStringValues(), ","))) + } + if _, ok := GetMappingEmbedTextDetailsInputTypeEnum(string(m.InputType)); !ok && m.InputType != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for InputType: %s. Supported values are: %s.", m.InputType, strings.Join(GetEmbedTextDetailsInputTypeEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *EmbedTextDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + IsEcho *bool `json:"isEcho"` + Truncate EmbedTextDetailsTruncateEnum `json:"truncate"` + InputType EmbedTextDetailsInputTypeEnum `json:"inputType"` + Inputs []string `json:"inputs"` + ServingMode servingmode `json:"servingMode"` + CompartmentId *string `json:"compartmentId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.IsEcho = model.IsEcho + + m.Truncate = model.Truncate + + m.InputType = model.InputType + + m.Inputs = make([]string, len(model.Inputs)) + copy(m.Inputs, model.Inputs) + nn, e = model.ServingMode.UnmarshalPolymorphicJSON(model.ServingMode.JsonData) + if e != nil { + return + } + if nn != nil { + m.ServingMode = nn.(ServingMode) + } else { + m.ServingMode = nil + } + + m.CompartmentId = model.CompartmentId + + return +} + +// EmbedTextDetailsTruncateEnum Enum with underlying type: string +type EmbedTextDetailsTruncateEnum string + +// Set of constants representing the allowable values for EmbedTextDetailsTruncateEnum +const ( + EmbedTextDetailsTruncateNone EmbedTextDetailsTruncateEnum = "NONE" + EmbedTextDetailsTruncateStart EmbedTextDetailsTruncateEnum = "START" + EmbedTextDetailsTruncateEnd EmbedTextDetailsTruncateEnum = "END" +) + +var mappingEmbedTextDetailsTruncateEnum = map[string]EmbedTextDetailsTruncateEnum{ + "NONE": EmbedTextDetailsTruncateNone, + "START": EmbedTextDetailsTruncateStart, + "END": EmbedTextDetailsTruncateEnd, +} + +var mappingEmbedTextDetailsTruncateEnumLowerCase = map[string]EmbedTextDetailsTruncateEnum{ + "none": EmbedTextDetailsTruncateNone, + "start": EmbedTextDetailsTruncateStart, + "end": EmbedTextDetailsTruncateEnd, +} + +// GetEmbedTextDetailsTruncateEnumValues Enumerates the set of values for EmbedTextDetailsTruncateEnum +func GetEmbedTextDetailsTruncateEnumValues() []EmbedTextDetailsTruncateEnum { + values := make([]EmbedTextDetailsTruncateEnum, 0) + for _, v := range mappingEmbedTextDetailsTruncateEnum { + values = append(values, v) + } + return values +} + +// GetEmbedTextDetailsTruncateEnumStringValues Enumerates the set of values in String for EmbedTextDetailsTruncateEnum +func GetEmbedTextDetailsTruncateEnumStringValues() []string { + return []string{ + "NONE", + "START", + "END", + } +} + +// GetMappingEmbedTextDetailsTruncateEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingEmbedTextDetailsTruncateEnum(val string) (EmbedTextDetailsTruncateEnum, bool) { + enum, ok := mappingEmbedTextDetailsTruncateEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// EmbedTextDetailsInputTypeEnum Enum with underlying type: string +type EmbedTextDetailsInputTypeEnum string + +// Set of constants representing the allowable values for EmbedTextDetailsInputTypeEnum +const ( + EmbedTextDetailsInputTypeSearchDocument EmbedTextDetailsInputTypeEnum = "SEARCH_DOCUMENT" + EmbedTextDetailsInputTypeSearchQuery EmbedTextDetailsInputTypeEnum = "SEARCH_QUERY" + EmbedTextDetailsInputTypeClassification EmbedTextDetailsInputTypeEnum = "CLASSIFICATION" + EmbedTextDetailsInputTypeClustering EmbedTextDetailsInputTypeEnum = "CLUSTERING" +) + +var mappingEmbedTextDetailsInputTypeEnum = map[string]EmbedTextDetailsInputTypeEnum{ + "SEARCH_DOCUMENT": EmbedTextDetailsInputTypeSearchDocument, + "SEARCH_QUERY": EmbedTextDetailsInputTypeSearchQuery, + "CLASSIFICATION": EmbedTextDetailsInputTypeClassification, + "CLUSTERING": EmbedTextDetailsInputTypeClustering, +} + +var mappingEmbedTextDetailsInputTypeEnumLowerCase = map[string]EmbedTextDetailsInputTypeEnum{ + "search_document": EmbedTextDetailsInputTypeSearchDocument, + "search_query": EmbedTextDetailsInputTypeSearchQuery, + "classification": EmbedTextDetailsInputTypeClassification, + "clustering": EmbedTextDetailsInputTypeClustering, +} + +// GetEmbedTextDetailsInputTypeEnumValues Enumerates the set of values for EmbedTextDetailsInputTypeEnum +func GetEmbedTextDetailsInputTypeEnumValues() []EmbedTextDetailsInputTypeEnum { + values := make([]EmbedTextDetailsInputTypeEnum, 0) + for _, v := range mappingEmbedTextDetailsInputTypeEnum { + values = append(values, v) + } + return values +} + +// GetEmbedTextDetailsInputTypeEnumStringValues Enumerates the set of values in String for EmbedTextDetailsInputTypeEnum +func GetEmbedTextDetailsInputTypeEnumStringValues() []string { + return []string{ + "SEARCH_DOCUMENT", + "SEARCH_QUERY", + "CLASSIFICATION", + "CLUSTERING", + } +} + +// GetMappingEmbedTextDetailsInputTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingEmbedTextDetailsInputTypeEnum(val string) (EmbedTextDetailsInputTypeEnum, bool) { + enum, ok := mappingEmbedTextDetailsInputTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/embed_text_request_response.go b/generativeaiinference/embed_text_request_response.go new file mode 100644 index 0000000000..53eae41e3a --- /dev/null +++ b/generativeaiinference/embed_text_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// EmbedTextRequest wrapper for the EmbedText operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/EmbedText.go.html to see an example of how to use EmbedTextRequest. +type EmbedTextRequest struct { + + // Details for generating the embed response. + EmbedTextDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request EmbedTextRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request EmbedTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request EmbedTextRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request EmbedTextRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request EmbedTextRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// EmbedTextResponse wrapper for the EmbedText operation +type EmbedTextResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The EmbedTextResult instance + EmbedTextResult `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response EmbedTextResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response EmbedTextResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeaiinference/embed_text_result.go b/generativeaiinference/embed_text_result.go new file mode 100644 index 0000000000..60ec1890e0 --- /dev/null +++ b/generativeaiinference/embed_text_result.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// EmbedTextResult The generated embedded result to return. +type EmbedTextResult struct { + + // A unique identifier for the generated result. + Id *string `mandatory:"true" json:"id"` + + // The embeddings corresponding to inputs. + Embeddings [][]float32 `mandatory:"true" json:"embeddings"` + + // The original inputs. Only present if "isEcho" is set to true. + Inputs []string `mandatory:"false" json:"inputs"` + + // The OCID of the model used in this inference request. + ModelId *string `mandatory:"false" json:"modelId"` + + // The version of the model. + ModelVersion *string `mandatory:"false" json:"modelVersion"` +} + +func (m EmbedTextResult) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m EmbedTextResult) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/generate_text_details.go b/generativeaiinference/generate_text_details.go new file mode 100644 index 0000000000..788b0f8d42 --- /dev/null +++ b/generativeaiinference/generate_text_details.go @@ -0,0 +1,85 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// GenerateTextDetails Details for the request to generate text. +type GenerateTextDetails struct { + + // The OCID of compartment that the user is authorized to use to call into the Generative AI service. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + ServingMode ServingMode `mandatory:"true" json:"servingMode"` + + InferenceRequest LlmInferenceRequest `mandatory:"true" json:"inferenceRequest"` +} + +func (m GenerateTextDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m GenerateTextDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *GenerateTextDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + CompartmentId *string `json:"compartmentId"` + ServingMode servingmode `json:"servingMode"` + InferenceRequest llminferencerequest `json:"inferenceRequest"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.CompartmentId = model.CompartmentId + + nn, e = model.ServingMode.UnmarshalPolymorphicJSON(model.ServingMode.JsonData) + if e != nil { + return + } + if nn != nil { + m.ServingMode = nn.(ServingMode) + } else { + m.ServingMode = nil + } + + nn, e = model.InferenceRequest.UnmarshalPolymorphicJSON(model.InferenceRequest.JsonData) + if e != nil { + return + } + if nn != nil { + m.InferenceRequest = nn.(LlmInferenceRequest) + } else { + m.InferenceRequest = nil + } + + return +} diff --git a/generativeaiinference/generate_text_request_response.go b/generativeaiinference/generate_text_request_response.go new file mode 100644 index 0000000000..34b483381f --- /dev/null +++ b/generativeaiinference/generate_text_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GenerateTextRequest wrapper for the GenerateText operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/GenerateText.go.html to see an example of how to use GenerateTextRequest. +type GenerateTextRequest struct { + + // Details for generating the text response. + GenerateTextDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GenerateTextRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GenerateTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GenerateTextRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GenerateTextRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GenerateTextRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GenerateTextResponse wrapper for the GenerateText operation +type GenerateTextResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The GenerateTextResult instance + GenerateTextResult `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GenerateTextResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GenerateTextResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeaiinference/generate_text_result.go b/generativeaiinference/generate_text_result.go new file mode 100644 index 0000000000..876e807d64 --- /dev/null +++ b/generativeaiinference/generate_text_result.go @@ -0,0 +1,78 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// GenerateTextResult The generated text result to return. +type GenerateTextResult struct { + + // The OCID of the model used in this inference request. + ModelId *string `mandatory:"true" json:"modelId"` + + // The version of the model. + ModelVersion *string `mandatory:"true" json:"modelVersion"` + + InferenceResponse LlmInferenceResponse `mandatory:"true" json:"inferenceResponse"` +} + +func (m GenerateTextResult) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m GenerateTextResult) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *GenerateTextResult) UnmarshalJSON(data []byte) (e error) { + model := struct { + ModelId *string `json:"modelId"` + ModelVersion *string `json:"modelVersion"` + InferenceResponse llminferenceresponse `json:"inferenceResponse"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.ModelId = model.ModelId + + m.ModelVersion = model.ModelVersion + + nn, e = model.InferenceResponse.UnmarshalPolymorphicJSON(model.InferenceResponse.JsonData) + if e != nil { + return + } + if nn != nil { + m.InferenceResponse = nn.(LlmInferenceResponse) + } else { + m.InferenceResponse = nil + } + + return +} diff --git a/generativeaiinference/generated_text.go b/generativeaiinference/generated_text.go new file mode 100644 index 0000000000..4a58905054 --- /dev/null +++ b/generativeaiinference/generated_text.go @@ -0,0 +1,56 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// GeneratedText The text generated during each run. +type GeneratedText struct { + + // A unique identifier for this text generation. + Id *string `mandatory:"true" json:"id"` + + // The generated text. + Text *string `mandatory:"true" json:"text"` + + // The overall likelihood of the generated text. + // When a large language model generates a new token for the output text, a likelihood is assigned to all tokens, where tokens with higher likelihoods are more likely to follow the current token. For example, it's more likely that the word favorite is followed by the word food or book rather than the word zebra. A lower likelihood means that it's less likely that token follows the current token. + Likelihood *float64 `mandatory:"true" json:"likelihood"` + + // The reason why the model stopped generating tokens. + // A model stops generating tokens if the model hits a natural stop point or reaches a provided stop sequence. + FinishReason *string `mandatory:"false" json:"finishReason"` + + // A collection of generated tokens and their corresponding likelihoods. + TokenLikelihoods []TokenLikelihood `mandatory:"false" json:"tokenLikelihoods"` +} + +func (m GeneratedText) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m GeneratedText) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/generativeaiinference_client.go b/generativeaiinference/generativeaiinference_client.go new file mode 100644 index 0000000000..33d5e4784f --- /dev/null +++ b/generativeaiinference/generativeaiinference_client.go @@ -0,0 +1,285 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "context" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "github.com/oracle/oci-go-sdk/v65/common/auth" + "net/http" +) + +// GenerativeAiInferenceClient a client for GenerativeAiInference +type GenerativeAiInferenceClient struct { + common.BaseClient + config *common.ConfigurationProvider +} + +// NewGenerativeAiInferenceClientWithConfigurationProvider Creates a new default GenerativeAiInference client with the given configuration provider. +// the configuration provider will be used for the default signer as well as reading the region +func NewGenerativeAiInferenceClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client GenerativeAiInferenceClient, err error) { + if enabled := common.CheckForEnabledServices("generativeaiinference"); !enabled { + return client, fmt.Errorf("the Developer Tool configuration disabled this service, this behavior is controlled by OciSdkEnabledServicesMap variables. Please check if your local developer-tool-configuration.json file configured the service you're targeting or contact the cloud provider on the availability of this service") + } + provider, err := auth.GetGenericConfigurationProvider(configProvider) + if err != nil { + return client, err + } + baseClient, e := common.NewClientWithConfig(provider) + if e != nil { + return client, e + } + return newGenerativeAiInferenceClientFromBaseClient(baseClient, provider) +} + +// NewGenerativeAiInferenceClientWithOboToken Creates a new default GenerativeAiInference client with the given configuration provider. +// The obotoken will be added to default headers and signed; the configuration provider will be used for the signer +// +// as well as reading the region +func NewGenerativeAiInferenceClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client GenerativeAiInferenceClient, err error) { + baseClient, err := common.NewClientWithOboToken(configProvider, oboToken) + if err != nil { + return client, err + } + + return newGenerativeAiInferenceClientFromBaseClient(baseClient, configProvider) +} + +func newGenerativeAiInferenceClientFromBaseClient(baseClient common.BaseClient, configProvider common.ConfigurationProvider) (client GenerativeAiInferenceClient, err error) { + // GenerativeAiInference service default circuit breaker is enabled + baseClient.Configuration.CircuitBreaker = common.NewCircuitBreaker(common.DefaultCircuitBreakerSettingWithServiceName("GenerativeAiInference")) + common.ConfigCircuitBreakerFromEnvVar(&baseClient) + common.ConfigCircuitBreakerFromGlobalVar(&baseClient) + + client = GenerativeAiInferenceClient{BaseClient: baseClient} + client.BasePath = "20231130" + err = client.setConfigurationProvider(configProvider) + return +} + +// SetRegion overrides the region of this client. +func (client *GenerativeAiInferenceClient) SetRegion(region string) { + client.Host = common.StringToRegion(region).EndpointForTemplate("generativeaiinference", "https://inference.generativeai.{region}.oci.{secondLevelDomain}") +} + +// SetConfigurationProvider sets the configuration provider including the region, returns an error if is not valid +func (client *GenerativeAiInferenceClient) setConfigurationProvider(configProvider common.ConfigurationProvider) error { + if ok, err := common.IsConfigurationProviderValid(configProvider); !ok { + return err + } + + // Error has been checked already + region, _ := configProvider.Region() + client.SetRegion(region) + if client.Host == "" { + return fmt.Errorf("invalid region or Host. Endpoint cannot be constructed without endpointServiceName or serviceEndpointTemplate for a dotted region") + } + client.config = &configProvider + return nil +} + +// ConfigurationProvider the ConfigurationProvider used in this client, or null if none set +func (client *GenerativeAiInferenceClient) ConfigurationProvider() *common.ConfigurationProvider { + return client.config +} + +// EmbedText Produces embeddings for the inputs. +// An embedding is numeric representation of a piece of text. This text can be a phrase, a sentence, or one or more paragraphs. The Generative AI embedding model transforms each phrase, sentence, or paragraph that you input, into an array with 1024 numbers. You can use these embeddings for finding similarity in your input text such as finding phrases that are similar in context or category. Embeddings are mostly used for semantic searches where the search function focuses on the meaning of the text that it's searching through rather than finding results based on keywords. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/EmbedText.go.html to see an example of how to use EmbedText API. +// A default retry strategy applies to this operation EmbedText() +func (client GenerativeAiInferenceClient) EmbedText(ctx context.Context, request EmbedTextRequest) (response EmbedTextResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.embedText, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = EmbedTextResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = EmbedTextResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(EmbedTextResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into EmbedTextResponse") + } + return +} + +// embedText implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiInferenceClient) embedText(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/actions/embedText", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response EmbedTextResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAiInference", "EmbedText", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// GenerateText Generates a text response based on the user prompt. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/GenerateText.go.html to see an example of how to use GenerateText API. +// A default retry strategy applies to this operation GenerateText() +func (client GenerativeAiInferenceClient) GenerateText(ctx context.Context, request GenerateTextRequest) (response GenerateTextResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.generateText, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GenerateTextResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GenerateTextResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GenerateTextResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GenerateTextResponse") + } + return +} + +// generateText implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiInferenceClient) generateText(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/actions/generateText", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GenerateTextResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAiInference", "GenerateText", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + +// SummarizeText Summarizes the input text. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/SummarizeText.go.html to see an example of how to use SummarizeText API. +// A default retry strategy applies to this operation SummarizeText() +func (client GenerativeAiInferenceClient) SummarizeText(ctx context.Context, request SummarizeTextRequest) (response SummarizeTextResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.summarizeText, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = SummarizeTextResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = SummarizeTextResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(SummarizeTextResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into SummarizeTextResponse") + } + return +} + +// summarizeText implements the OCIOperation interface (enables retrying operations) +func (client GenerativeAiInferenceClient) summarizeText(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/actions/summarizeText", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response SummarizeTextResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "" + err = common.PostProcessServiceError(err, "GenerativeAiInference", "SummarizeText", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} diff --git a/generativeaiinference/llama_llm_inference_request.go b/generativeaiinference/llama_llm_inference_request.go new file mode 100644 index 0000000000..44d1fc7cec --- /dev/null +++ b/generativeaiinference/llama_llm_inference_request.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// LlamaLlmInferenceRequest Details for the text generation request for Llama models. +type LlamaLlmInferenceRequest struct { + + // Represents the prompt to be completed. The trailing white spaces are trimmed before completion. + Prompt *string `mandatory:"false" json:"prompt"` + + // Whether to stream back partial progress. If set, tokens are sent as data-only server-sent events as they become available. + IsStream *bool `mandatory:"false" json:"isStream"` + + // The number of of generated texts that will be returned. + NumGenerations *int `mandatory:"false" json:"numGenerations"` + + // Whether or not to return the user prompt in the response. Applies only to non-stream results. + IsEcho *bool `mandatory:"false" json:"isEcho"` + + // An integer that sets up the model to use only the top k most likely tokens in the generated output. A higher k introduces more randomness into the output making the output text sound more natural. Default value is -1 which means to consider all tokens. Setting to 0 disables this method and considers all tokens. + // If also using top p, then the model considers only the top tokens whose probabilities add up to p percent and ignores the rest of the k tokens. For example, if k is 20, but the probabilities of the top 10 add up to .75, then only the top 10 tokens are chosen. + TopK *int `mandatory:"false" json:"topK"` + + // If set to a probability 0.0 < p < 1.0, it ensures that only the most likely tokens, with total probability mass of p, are considered for generation at each step. + // To eliminate tokens with low likelihood, assign p a minimum percentage for the next token's likelihood. For example, when p is set to 0.75, the model eliminates the bottom 25 percent for the next token. Set to 1 to consider all tokens and set to 0 to disable. If both k and p are enabled, p acts after k. + TopP *float64 `mandatory:"false" json:"topP"` + + // A number that sets the randomness of the generated output. A lower temperature means a less random generations. + // Use lower numbers for tasks with a correct answer such as question answering or summarizing. High temperatures can generate hallucinations or factually incorrect information. Start with temperatures lower than 1.0 and increase the temperature for more creative outputs, as you regenerate the prompts to refine the outputs. + Temperature *float64 `mandatory:"false" json:"temperature"` + + // To reduce repetitiveness of generated tokens, this number penalizes new tokens based on their frequency in the generated text so far. Values > 0 encourage the model to use new tokens and values < 0 encourage the model to repeat tokens. Set to 0 to disable. + FrequencyPenalty *float64 `mandatory:"false" json:"frequencyPenalty"` + + // To reduce repetitiveness of generated tokens, this number penalizes new tokens based on whether they've appeared in the generated text so far. Values > 0 encourage the model to use new tokens and values < 0 encourage the model to repeat tokens. + // Similar to frequency penalty, a penalty is applied to previously present tokens, except that this penalty is applied equally to all tokens that have already appeared, regardless of how many times they've appeared. Set to 0 to disable. + PresencePenalty *float64 `mandatory:"false" json:"presencePenalty"` + + // List of strings that stop the generation if they are generated for the response text. The returned output will not contain the stop strings. + Stop []string `mandatory:"false" json:"stop"` + + // Includes the logarithmic probabilities for the most likely output tokens and the chosen tokens. + // For example, if the log probability is 5, the API returns a list of the 5 most likely tokens. The API returns the log probability of the sampled token, so there might be up to logprobs+1 elements in the response. + LogProbs *int `mandatory:"false" json:"logProbs"` + + // The maximum number of tokens to predict for each response. Includes input plus output tokens. + MaxTokens *int `mandatory:"false" json:"maxTokens"` +} + +func (m LlamaLlmInferenceRequest) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m LlamaLlmInferenceRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m LlamaLlmInferenceRequest) MarshalJSON() (buff []byte, e error) { + type MarshalTypeLlamaLlmInferenceRequest LlamaLlmInferenceRequest + s := struct { + DiscriminatorParam string `json:"runtimeType"` + MarshalTypeLlamaLlmInferenceRequest + }{ + "LLAMA", + (MarshalTypeLlamaLlmInferenceRequest)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeaiinference/llama_llm_inference_response.go b/generativeaiinference/llama_llm_inference_response.go new file mode 100644 index 0000000000..8bbe61bf23 --- /dev/null +++ b/generativeaiinference/llama_llm_inference_response.go @@ -0,0 +1,60 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// LlamaLlmInferenceResponse The generated text result to return. +type LlamaLlmInferenceResponse struct { + + // The Unix timestamp (in seconds) of when the generation was created. + Created *common.SDKTime `mandatory:"true" json:"created"` + + // A list of generated texts. Can be more than one if n is greater than 1. + Choices []Choice `mandatory:"true" json:"choices"` +} + +func (m LlamaLlmInferenceResponse) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m LlamaLlmInferenceResponse) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m LlamaLlmInferenceResponse) MarshalJSON() (buff []byte, e error) { + type MarshalTypeLlamaLlmInferenceResponse LlamaLlmInferenceResponse + s := struct { + DiscriminatorParam string `json:"runtimeType"` + MarshalTypeLlamaLlmInferenceResponse + }{ + "LLAMA", + (MarshalTypeLlamaLlmInferenceResponse)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeaiinference/llm_inference_request.go b/generativeaiinference/llm_inference_request.go new file mode 100644 index 0000000000..622d2deffb --- /dev/null +++ b/generativeaiinference/llm_inference_request.go @@ -0,0 +1,126 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// LlmInferenceRequest The base class for the inference requests. +type LlmInferenceRequest interface { +} + +type llminferencerequest struct { + JsonData []byte + RuntimeType string `json:"runtimeType"` +} + +// UnmarshalJSON unmarshals json +func (m *llminferencerequest) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerllminferencerequest llminferencerequest + s := struct { + Model Unmarshalerllminferencerequest + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.RuntimeType = s.Model.RuntimeType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *llminferencerequest) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.RuntimeType { + case "LLAMA": + mm := LlamaLlmInferenceRequest{} + err = json.Unmarshal(data, &mm) + return mm, err + case "COHERE": + mm := CohereLlmInferenceRequest{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for LlmInferenceRequest: %s.", m.RuntimeType) + return *m, nil + } +} + +func (m llminferencerequest) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m llminferencerequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// LlmInferenceRequestRuntimeTypeEnum Enum with underlying type: string +type LlmInferenceRequestRuntimeTypeEnum string + +// Set of constants representing the allowable values for LlmInferenceRequestRuntimeTypeEnum +const ( + LlmInferenceRequestRuntimeTypeCohere LlmInferenceRequestRuntimeTypeEnum = "COHERE" + LlmInferenceRequestRuntimeTypeLlama LlmInferenceRequestRuntimeTypeEnum = "LLAMA" +) + +var mappingLlmInferenceRequestRuntimeTypeEnum = map[string]LlmInferenceRequestRuntimeTypeEnum{ + "COHERE": LlmInferenceRequestRuntimeTypeCohere, + "LLAMA": LlmInferenceRequestRuntimeTypeLlama, +} + +var mappingLlmInferenceRequestRuntimeTypeEnumLowerCase = map[string]LlmInferenceRequestRuntimeTypeEnum{ + "cohere": LlmInferenceRequestRuntimeTypeCohere, + "llama": LlmInferenceRequestRuntimeTypeLlama, +} + +// GetLlmInferenceRequestRuntimeTypeEnumValues Enumerates the set of values for LlmInferenceRequestRuntimeTypeEnum +func GetLlmInferenceRequestRuntimeTypeEnumValues() []LlmInferenceRequestRuntimeTypeEnum { + values := make([]LlmInferenceRequestRuntimeTypeEnum, 0) + for _, v := range mappingLlmInferenceRequestRuntimeTypeEnum { + values = append(values, v) + } + return values +} + +// GetLlmInferenceRequestRuntimeTypeEnumStringValues Enumerates the set of values in String for LlmInferenceRequestRuntimeTypeEnum +func GetLlmInferenceRequestRuntimeTypeEnumStringValues() []string { + return []string{ + "COHERE", + "LLAMA", + } +} + +// GetMappingLlmInferenceRequestRuntimeTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingLlmInferenceRequestRuntimeTypeEnum(val string) (LlmInferenceRequestRuntimeTypeEnum, bool) { + enum, ok := mappingLlmInferenceRequestRuntimeTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/llm_inference_response.go b/generativeaiinference/llm_inference_response.go new file mode 100644 index 0000000000..a30e646d52 --- /dev/null +++ b/generativeaiinference/llm_inference_response.go @@ -0,0 +1,126 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// LlmInferenceResponse The base class for inference responses. +type LlmInferenceResponse interface { +} + +type llminferenceresponse struct { + JsonData []byte + RuntimeType string `json:"runtimeType"` +} + +// UnmarshalJSON unmarshals json +func (m *llminferenceresponse) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerllminferenceresponse llminferenceresponse + s := struct { + Model Unmarshalerllminferenceresponse + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.RuntimeType = s.Model.RuntimeType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *llminferenceresponse) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.RuntimeType { + case "LLAMA": + mm := LlamaLlmInferenceResponse{} + err = json.Unmarshal(data, &mm) + return mm, err + case "COHERE": + mm := CohereLlmInferenceResponse{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for LlmInferenceResponse: %s.", m.RuntimeType) + return *m, nil + } +} + +func (m llminferenceresponse) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m llminferenceresponse) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// LlmInferenceResponseRuntimeTypeEnum Enum with underlying type: string +type LlmInferenceResponseRuntimeTypeEnum string + +// Set of constants representing the allowable values for LlmInferenceResponseRuntimeTypeEnum +const ( + LlmInferenceResponseRuntimeTypeCohere LlmInferenceResponseRuntimeTypeEnum = "COHERE" + LlmInferenceResponseRuntimeTypeLlama LlmInferenceResponseRuntimeTypeEnum = "LLAMA" +) + +var mappingLlmInferenceResponseRuntimeTypeEnum = map[string]LlmInferenceResponseRuntimeTypeEnum{ + "COHERE": LlmInferenceResponseRuntimeTypeCohere, + "LLAMA": LlmInferenceResponseRuntimeTypeLlama, +} + +var mappingLlmInferenceResponseRuntimeTypeEnumLowerCase = map[string]LlmInferenceResponseRuntimeTypeEnum{ + "cohere": LlmInferenceResponseRuntimeTypeCohere, + "llama": LlmInferenceResponseRuntimeTypeLlama, +} + +// GetLlmInferenceResponseRuntimeTypeEnumValues Enumerates the set of values for LlmInferenceResponseRuntimeTypeEnum +func GetLlmInferenceResponseRuntimeTypeEnumValues() []LlmInferenceResponseRuntimeTypeEnum { + values := make([]LlmInferenceResponseRuntimeTypeEnum, 0) + for _, v := range mappingLlmInferenceResponseRuntimeTypeEnum { + values = append(values, v) + } + return values +} + +// GetLlmInferenceResponseRuntimeTypeEnumStringValues Enumerates the set of values in String for LlmInferenceResponseRuntimeTypeEnum +func GetLlmInferenceResponseRuntimeTypeEnumStringValues() []string { + return []string{ + "COHERE", + "LLAMA", + } +} + +// GetMappingLlmInferenceResponseRuntimeTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingLlmInferenceResponseRuntimeTypeEnum(val string) (LlmInferenceResponseRuntimeTypeEnum, bool) { + enum, ok := mappingLlmInferenceResponseRuntimeTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/logprobs.go b/generativeaiinference/logprobs.go new file mode 100644 index 0000000000..a9da4f8469 --- /dev/null +++ b/generativeaiinference/logprobs.go @@ -0,0 +1,51 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// Logprobs Returns if the logarithmic probabilites is set. +type Logprobs struct { + + // The text offset. + TextOffset []int `mandatory:"false" json:"textOffset"` + + // The logarithmic probabilites of the output token. + TokenLogprobs []float64 `mandatory:"false" json:"tokenLogprobs"` + + // The list of output tokens. + Tokens []string `mandatory:"false" json:"tokens"` + + // The logarithmic probabilities of each of the top k tokens. + TopLogprobs []map[string]string `mandatory:"false" json:"topLogprobs"` +} + +func (m Logprobs) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m Logprobs) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/on_demand_serving_mode.go b/generativeaiinference/on_demand_serving_mode.go new file mode 100644 index 0000000000..59592e377a --- /dev/null +++ b/generativeaiinference/on_demand_serving_mode.go @@ -0,0 +1,57 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// OnDemandServingMode The model's serving mode is on-demand serving on a shared infrastructure. +type OnDemandServingMode struct { + + // The unique ID of a model to use. Can use list Models API to list available models. + ModelId *string `mandatory:"true" json:"modelId"` +} + +func (m OnDemandServingMode) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m OnDemandServingMode) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// MarshalJSON marshals to json representation +func (m OnDemandServingMode) MarshalJSON() (buff []byte, e error) { + type MarshalTypeOnDemandServingMode OnDemandServingMode + s := struct { + DiscriminatorParam string `json:"servingType"` + MarshalTypeOnDemandServingMode + }{ + "ON_DEMAND", + (MarshalTypeOnDemandServingMode)(m), + } + + return json.Marshal(&s) +} diff --git a/generativeaiinference/serving_mode.go b/generativeaiinference/serving_mode.go new file mode 100644 index 0000000000..b33aa1a7bc --- /dev/null +++ b/generativeaiinference/serving_mode.go @@ -0,0 +1,126 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ServingMode The model's serving mode, which could be on-demand serving or dedicated serving. +type ServingMode interface { +} + +type servingmode struct { + JsonData []byte + ServingType string `json:"servingType"` +} + +// UnmarshalJSON unmarshals json +func (m *servingmode) UnmarshalJSON(data []byte) error { + m.JsonData = data + type Unmarshalerservingmode servingmode + s := struct { + Model Unmarshalerservingmode + }{} + err := json.Unmarshal(data, &s.Model) + if err != nil { + return err + } + m.ServingType = s.Model.ServingType + + return err +} + +// UnmarshalPolymorphicJSON unmarshals polymorphic json +func (m *servingmode) UnmarshalPolymorphicJSON(data []byte) (interface{}, error) { + + if data == nil || string(data) == "null" { + return nil, nil + } + + var err error + switch m.ServingType { + case "DEDICATED": + mm := DedicatedServingMode{} + err = json.Unmarshal(data, &mm) + return mm, err + case "ON_DEMAND": + mm := OnDemandServingMode{} + err = json.Unmarshal(data, &mm) + return mm, err + default: + common.Logf("Recieved unsupported enum value for ServingMode: %s.", m.ServingType) + return *m, nil + } +} + +func (m servingmode) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m servingmode) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ServingModeServingTypeEnum Enum with underlying type: string +type ServingModeServingTypeEnum string + +// Set of constants representing the allowable values for ServingModeServingTypeEnum +const ( + ServingModeServingTypeOnDemand ServingModeServingTypeEnum = "ON_DEMAND" + ServingModeServingTypeDedicated ServingModeServingTypeEnum = "DEDICATED" +) + +var mappingServingModeServingTypeEnum = map[string]ServingModeServingTypeEnum{ + "ON_DEMAND": ServingModeServingTypeOnDemand, + "DEDICATED": ServingModeServingTypeDedicated, +} + +var mappingServingModeServingTypeEnumLowerCase = map[string]ServingModeServingTypeEnum{ + "on_demand": ServingModeServingTypeOnDemand, + "dedicated": ServingModeServingTypeDedicated, +} + +// GetServingModeServingTypeEnumValues Enumerates the set of values for ServingModeServingTypeEnum +func GetServingModeServingTypeEnumValues() []ServingModeServingTypeEnum { + values := make([]ServingModeServingTypeEnum, 0) + for _, v := range mappingServingModeServingTypeEnum { + values = append(values, v) + } + return values +} + +// GetServingModeServingTypeEnumStringValues Enumerates the set of values in String for ServingModeServingTypeEnum +func GetServingModeServingTypeEnumStringValues() []string { + return []string{ + "ON_DEMAND", + "DEDICATED", + } +} + +// GetMappingServingModeServingTypeEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingServingModeServingTypeEnum(val string) (ServingModeServingTypeEnum, bool) { + enum, ok := mappingServingModeServingTypeEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/summarize_text_details.go b/generativeaiinference/summarize_text_details.go new file mode 100644 index 0000000000..da5bf16813 --- /dev/null +++ b/generativeaiinference/summarize_text_details.go @@ -0,0 +1,270 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "encoding/json" + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// SummarizeTextDetails Details for the request to summarize text. +type SummarizeTextDetails struct { + + // The input string to be summarized. + Input *string `mandatory:"true" json:"input"` + + ServingMode ServingMode `mandatory:"true" json:"servingMode"` + + // The OCID of compartment that the user is authorized to use to call into the Generative AI service. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Whether or not to include the original inputs in the response. + IsEcho *bool `mandatory:"false" json:"isEcho"` + + // A number that sets the randomness of the generated output. Lower temperatures mean less random generations. + // Use lower numbers for tasks with a correct answer such as question answering or summarizing. High temperatures can generate hallucinations or factually incorrect information. Start with temperatures lower than 1.0, and increase the temperature for more creative outputs, as you regenerate the prompts to refine the outputs. + Temperature *float64 `mandatory:"false" json:"temperature"` + + // A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". For example, "focusing on the next steps" or "written by Yoda". + AdditionalCommand *string `mandatory:"false" json:"additionalCommand"` + + // Indicates the approximate length of the summary. If "AUTO" is selected, the best option will be picked based on the input text. + Length SummarizeTextDetailsLengthEnum `mandatory:"false" json:"length,omitempty"` + + // Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If "AUTO" is selected, the best option will be picked based on the input text. + Format SummarizeTextDetailsFormatEnum `mandatory:"false" json:"format,omitempty"` + + // Controls how close to the original text the summary is. High extractiveness summaries will lean towards reusing sentences verbatim, while low extractiveness summaries will tend to paraphrase more. + Extractiveness SummarizeTextDetailsExtractivenessEnum `mandatory:"false" json:"extractiveness,omitempty"` +} + +func (m SummarizeTextDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m SummarizeTextDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if _, ok := GetMappingSummarizeTextDetailsLengthEnum(string(m.Length)); !ok && m.Length != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Length: %s. Supported values are: %s.", m.Length, strings.Join(GetSummarizeTextDetailsLengthEnumStringValues(), ","))) + } + if _, ok := GetMappingSummarizeTextDetailsFormatEnum(string(m.Format)); !ok && m.Format != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Format: %s. Supported values are: %s.", m.Format, strings.Join(GetSummarizeTextDetailsFormatEnumStringValues(), ","))) + } + if _, ok := GetMappingSummarizeTextDetailsExtractivenessEnum(string(m.Extractiveness)); !ok && m.Extractiveness != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for Extractiveness: %s. Supported values are: %s.", m.Extractiveness, strings.Join(GetSummarizeTextDetailsExtractivenessEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UnmarshalJSON unmarshals from json +func (m *SummarizeTextDetails) UnmarshalJSON(data []byte) (e error) { + model := struct { + IsEcho *bool `json:"isEcho"` + Temperature *float64 `json:"temperature"` + AdditionalCommand *string `json:"additionalCommand"` + Length SummarizeTextDetailsLengthEnum `json:"length"` + Format SummarizeTextDetailsFormatEnum `json:"format"` + Extractiveness SummarizeTextDetailsExtractivenessEnum `json:"extractiveness"` + Input *string `json:"input"` + ServingMode servingmode `json:"servingMode"` + CompartmentId *string `json:"compartmentId"` + }{} + + e = json.Unmarshal(data, &model) + if e != nil { + return + } + var nn interface{} + m.IsEcho = model.IsEcho + + m.Temperature = model.Temperature + + m.AdditionalCommand = model.AdditionalCommand + + m.Length = model.Length + + m.Format = model.Format + + m.Extractiveness = model.Extractiveness + + m.Input = model.Input + + nn, e = model.ServingMode.UnmarshalPolymorphicJSON(model.ServingMode.JsonData) + if e != nil { + return + } + if nn != nil { + m.ServingMode = nn.(ServingMode) + } else { + m.ServingMode = nil + } + + m.CompartmentId = model.CompartmentId + + return +} + +// SummarizeTextDetailsLengthEnum Enum with underlying type: string +type SummarizeTextDetailsLengthEnum string + +// Set of constants representing the allowable values for SummarizeTextDetailsLengthEnum +const ( + SummarizeTextDetailsLengthShort SummarizeTextDetailsLengthEnum = "SHORT" + SummarizeTextDetailsLengthMedium SummarizeTextDetailsLengthEnum = "MEDIUM" + SummarizeTextDetailsLengthLong SummarizeTextDetailsLengthEnum = "LONG" + SummarizeTextDetailsLengthAuto SummarizeTextDetailsLengthEnum = "AUTO" +) + +var mappingSummarizeTextDetailsLengthEnum = map[string]SummarizeTextDetailsLengthEnum{ + "SHORT": SummarizeTextDetailsLengthShort, + "MEDIUM": SummarizeTextDetailsLengthMedium, + "LONG": SummarizeTextDetailsLengthLong, + "AUTO": SummarizeTextDetailsLengthAuto, +} + +var mappingSummarizeTextDetailsLengthEnumLowerCase = map[string]SummarizeTextDetailsLengthEnum{ + "short": SummarizeTextDetailsLengthShort, + "medium": SummarizeTextDetailsLengthMedium, + "long": SummarizeTextDetailsLengthLong, + "auto": SummarizeTextDetailsLengthAuto, +} + +// GetSummarizeTextDetailsLengthEnumValues Enumerates the set of values for SummarizeTextDetailsLengthEnum +func GetSummarizeTextDetailsLengthEnumValues() []SummarizeTextDetailsLengthEnum { + values := make([]SummarizeTextDetailsLengthEnum, 0) + for _, v := range mappingSummarizeTextDetailsLengthEnum { + values = append(values, v) + } + return values +} + +// GetSummarizeTextDetailsLengthEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsLengthEnum +func GetSummarizeTextDetailsLengthEnumStringValues() []string { + return []string{ + "SHORT", + "MEDIUM", + "LONG", + "AUTO", + } +} + +// GetMappingSummarizeTextDetailsLengthEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingSummarizeTextDetailsLengthEnum(val string) (SummarizeTextDetailsLengthEnum, bool) { + enum, ok := mappingSummarizeTextDetailsLengthEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// SummarizeTextDetailsFormatEnum Enum with underlying type: string +type SummarizeTextDetailsFormatEnum string + +// Set of constants representing the allowable values for SummarizeTextDetailsFormatEnum +const ( + SummarizeTextDetailsFormatParagraph SummarizeTextDetailsFormatEnum = "PARAGRAPH" + SummarizeTextDetailsFormatBullets SummarizeTextDetailsFormatEnum = "BULLETS" + SummarizeTextDetailsFormatAuto SummarizeTextDetailsFormatEnum = "AUTO" +) + +var mappingSummarizeTextDetailsFormatEnum = map[string]SummarizeTextDetailsFormatEnum{ + "PARAGRAPH": SummarizeTextDetailsFormatParagraph, + "BULLETS": SummarizeTextDetailsFormatBullets, + "AUTO": SummarizeTextDetailsFormatAuto, +} + +var mappingSummarizeTextDetailsFormatEnumLowerCase = map[string]SummarizeTextDetailsFormatEnum{ + "paragraph": SummarizeTextDetailsFormatParagraph, + "bullets": SummarizeTextDetailsFormatBullets, + "auto": SummarizeTextDetailsFormatAuto, +} + +// GetSummarizeTextDetailsFormatEnumValues Enumerates the set of values for SummarizeTextDetailsFormatEnum +func GetSummarizeTextDetailsFormatEnumValues() []SummarizeTextDetailsFormatEnum { + values := make([]SummarizeTextDetailsFormatEnum, 0) + for _, v := range mappingSummarizeTextDetailsFormatEnum { + values = append(values, v) + } + return values +} + +// GetSummarizeTextDetailsFormatEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsFormatEnum +func GetSummarizeTextDetailsFormatEnumStringValues() []string { + return []string{ + "PARAGRAPH", + "BULLETS", + "AUTO", + } +} + +// GetMappingSummarizeTextDetailsFormatEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingSummarizeTextDetailsFormatEnum(val string) (SummarizeTextDetailsFormatEnum, bool) { + enum, ok := mappingSummarizeTextDetailsFormatEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// SummarizeTextDetailsExtractivenessEnum Enum with underlying type: string +type SummarizeTextDetailsExtractivenessEnum string + +// Set of constants representing the allowable values for SummarizeTextDetailsExtractivenessEnum +const ( + SummarizeTextDetailsExtractivenessLow SummarizeTextDetailsExtractivenessEnum = "LOW" + SummarizeTextDetailsExtractivenessMedium SummarizeTextDetailsExtractivenessEnum = "MEDIUM" + SummarizeTextDetailsExtractivenessHigh SummarizeTextDetailsExtractivenessEnum = "HIGH" + SummarizeTextDetailsExtractivenessAuto SummarizeTextDetailsExtractivenessEnum = "AUTO" +) + +var mappingSummarizeTextDetailsExtractivenessEnum = map[string]SummarizeTextDetailsExtractivenessEnum{ + "LOW": SummarizeTextDetailsExtractivenessLow, + "MEDIUM": SummarizeTextDetailsExtractivenessMedium, + "HIGH": SummarizeTextDetailsExtractivenessHigh, + "AUTO": SummarizeTextDetailsExtractivenessAuto, +} + +var mappingSummarizeTextDetailsExtractivenessEnumLowerCase = map[string]SummarizeTextDetailsExtractivenessEnum{ + "low": SummarizeTextDetailsExtractivenessLow, + "medium": SummarizeTextDetailsExtractivenessMedium, + "high": SummarizeTextDetailsExtractivenessHigh, + "auto": SummarizeTextDetailsExtractivenessAuto, +} + +// GetSummarizeTextDetailsExtractivenessEnumValues Enumerates the set of values for SummarizeTextDetailsExtractivenessEnum +func GetSummarizeTextDetailsExtractivenessEnumValues() []SummarizeTextDetailsExtractivenessEnum { + values := make([]SummarizeTextDetailsExtractivenessEnum, 0) + for _, v := range mappingSummarizeTextDetailsExtractivenessEnum { + values = append(values, v) + } + return values +} + +// GetSummarizeTextDetailsExtractivenessEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsExtractivenessEnum +func GetSummarizeTextDetailsExtractivenessEnumStringValues() []string { + return []string{ + "LOW", + "MEDIUM", + "HIGH", + "AUTO", + } +} + +// GetMappingSummarizeTextDetailsExtractivenessEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingSummarizeTextDetailsExtractivenessEnum(val string) (SummarizeTextDetailsExtractivenessEnum, bool) { + enum, ok := mappingSummarizeTextDetailsExtractivenessEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/generativeaiinference/summarize_text_request_response.go b/generativeaiinference/summarize_text_request_response.go new file mode 100644 index 0000000000..9a5fba3c0d --- /dev/null +++ b/generativeaiinference/summarize_text_request_response.go @@ -0,0 +1,100 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// SummarizeTextRequest wrapper for the SummarizeText operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/generativeaiinference/SummarizeText.go.html to see an example of how to use SummarizeTextRequest. +type SummarizeTextRequest struct { + + // Details for summarizing the text. + SummarizeTextDetails `contributesTo:"body"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // The client request ID for tracing. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request SummarizeTextRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request SummarizeTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request SummarizeTextRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request SummarizeTextRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request SummarizeTextRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// SummarizeTextResponse wrapper for the SummarizeText operation +type SummarizeTextResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The SummarizeTextResult instance + SummarizeTextResult `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response SummarizeTextResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response SummarizeTextResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/generativeaiinference/summarize_text_result.go b/generativeaiinference/summarize_text_result.go new file mode 100644 index 0000000000..07e285832a --- /dev/null +++ b/generativeaiinference/summarize_text_result.go @@ -0,0 +1,54 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// SummarizeTextResult Summarize text result to return to caller. +type SummarizeTextResult struct { + + // A unique identifier for this SummarizeTextResult. + Id *string `mandatory:"true" json:"id"` + + // Summary result corresponding to input. + Summary *string `mandatory:"true" json:"summary"` + + // The original input. Only included if "isEcho" set to true. + Input *string `mandatory:"false" json:"input"` + + // The OCID of the model used in this inference request. + ModelId *string `mandatory:"false" json:"modelId"` + + // The version of the model. + ModelVersion *string `mandatory:"false" json:"modelVersion"` +} + +func (m SummarizeTextResult) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m SummarizeTextResult) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/generativeaiinference/token_likelihood.go b/generativeaiinference/token_likelihood.go new file mode 100644 index 0000000000..2d1daf3ac1 --- /dev/null +++ b/generativeaiinference/token_likelihood.go @@ -0,0 +1,46 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Generative AI Service Inference API +// +// OCI Generative AI is a fully managed service that provides a set of state-of-the-art, customizable large language models (LLMs) that cover a wide range of use cases for text generation, summarization, and text embeddings. +// Use the Generative AI service inference API to access your custom model endpoints, or to try the out-of-the-box models to GenerateText, SummarizeText, and EmbedText. +// To use a Generative AI custom model for inference, you must first create an endpoint for that model. Use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/) to Model by fine-tuning an out-of-the-box model, or a previous version of a custom model, using your own data. Fine-tune the custom model on a DedicatedAiCluster. Then, create a DedicatedAiCluster with an Endpoint to host your custom model. For resource management in the Generative AI service, use the Generative AI service management API (https://docs.cloud.oracle.com/#/en/generative-ai/latest/). +// To learn more about the service, see the Generative AI documentation (https://docs.cloud.oracle.com/iaas/Content/generative-ai/home.htm). +// + +package generativeaiinference + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// TokenLikelihood An object that contains the returned token and its corresponding likelihood. +type TokenLikelihood struct { + + // A word, part of a word, or a punctuation. + // For example, apple is a token and friendship is made up of two tokens, friend and ship. When you run a model, you can set the maximum number of output tokens. Estimate three tokens per word. + Token *string `mandatory:"false" json:"token"` + + // The likelihood of this token during generation. + Likelihood *float64 `mandatory:"false" json:"likelihood"` +} + +func (m TokenLikelihood) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m TokenLikelihood) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/marketplace/pricing_currency_enum.go b/marketplace/pricing_currency_enum.go index f6b4a56407..d9b8f79ab9 100644 --- a/marketplace/pricing_currency_enum.go +++ b/marketplace/pricing_currency_enum.go @@ -29,6 +29,51 @@ const ( PricingCurrencyEnumChf PricingCurrencyEnumEnum = "CHF" PricingCurrencyEnumMxn PricingCurrencyEnumEnum = "MXN" PricingCurrencyEnumClp PricingCurrencyEnumEnum = "CLP" + PricingCurrencyEnumAll PricingCurrencyEnumEnum = "ALL" + PricingCurrencyEnumArs PricingCurrencyEnumEnum = "ARS" + PricingCurrencyEnumAud PricingCurrencyEnumEnum = "AUD" + PricingCurrencyEnumBdt PricingCurrencyEnumEnum = "BDT" + PricingCurrencyEnumBam PricingCurrencyEnumEnum = "BAM" + PricingCurrencyEnumBgn PricingCurrencyEnumEnum = "BGN" + PricingCurrencyEnumCny PricingCurrencyEnumEnum = "CNY" + PricingCurrencyEnumCop PricingCurrencyEnumEnum = "COP" + PricingCurrencyEnumCrc PricingCurrencyEnumEnum = "CRC" + PricingCurrencyEnumHrk PricingCurrencyEnumEnum = "HRK" + PricingCurrencyEnumCzk PricingCurrencyEnumEnum = "CZK" + PricingCurrencyEnumDkk PricingCurrencyEnumEnum = "DKK" + PricingCurrencyEnumEgp PricingCurrencyEnumEnum = "EGP" + PricingCurrencyEnumHkd PricingCurrencyEnumEnum = "HKD" + PricingCurrencyEnumHuf PricingCurrencyEnumEnum = "HUF" + PricingCurrencyEnumIsk PricingCurrencyEnumEnum = "ISK" + PricingCurrencyEnumIdr PricingCurrencyEnumEnum = "IDR" + PricingCurrencyEnumIls PricingCurrencyEnumEnum = "ILS" + PricingCurrencyEnumJmd PricingCurrencyEnumEnum = "JMD" + PricingCurrencyEnumKzt PricingCurrencyEnumEnum = "KZT" + PricingCurrencyEnumKes PricingCurrencyEnumEnum = "KES" + PricingCurrencyEnumKrw PricingCurrencyEnumEnum = "KRW" + PricingCurrencyEnumKwd PricingCurrencyEnumEnum = "KWD" + PricingCurrencyEnumLbp PricingCurrencyEnumEnum = "LBP" + PricingCurrencyEnumMop PricingCurrencyEnumEnum = "MOP" + PricingCurrencyEnumMyr PricingCurrencyEnumEnum = "MYR" + PricingCurrencyEnumMvr PricingCurrencyEnumEnum = "MVR" + PricingCurrencyEnumAed PricingCurrencyEnumEnum = "AED" + PricingCurrencyEnumNzd PricingCurrencyEnumEnum = "NZD" + PricingCurrencyEnumNok PricingCurrencyEnumEnum = "NOK" + PricingCurrencyEnumPkr PricingCurrencyEnumEnum = "PKR" + PricingCurrencyEnumPen PricingCurrencyEnumEnum = "PEN" + PricingCurrencyEnumPhp PricingCurrencyEnumEnum = "PHP" + PricingCurrencyEnumPln PricingCurrencyEnumEnum = "PLN" + PricingCurrencyEnumQar PricingCurrencyEnumEnum = "QAR" + PricingCurrencyEnumRon PricingCurrencyEnumEnum = "RON" + PricingCurrencyEnumSar PricingCurrencyEnumEnum = "SAR" + PricingCurrencyEnumRsd PricingCurrencyEnumEnum = "RSD" + PricingCurrencyEnumSgd PricingCurrencyEnumEnum = "SGD" + PricingCurrencyEnumZar PricingCurrencyEnumEnum = "ZAR" + PricingCurrencyEnumSek PricingCurrencyEnumEnum = "SEK" + PricingCurrencyEnumTwd PricingCurrencyEnumEnum = "TWD" + PricingCurrencyEnumThb PricingCurrencyEnumEnum = "THB" + PricingCurrencyEnumTry PricingCurrencyEnumEnum = "TRY" + PricingCurrencyEnumVnd PricingCurrencyEnumEnum = "VND" ) var mappingPricingCurrencyEnumEnum = map[string]PricingCurrencyEnumEnum{ @@ -43,6 +88,51 @@ var mappingPricingCurrencyEnumEnum = map[string]PricingCurrencyEnumEnum{ "CHF": PricingCurrencyEnumChf, "MXN": PricingCurrencyEnumMxn, "CLP": PricingCurrencyEnumClp, + "ALL": PricingCurrencyEnumAll, + "ARS": PricingCurrencyEnumArs, + "AUD": PricingCurrencyEnumAud, + "BDT": PricingCurrencyEnumBdt, + "BAM": PricingCurrencyEnumBam, + "BGN": PricingCurrencyEnumBgn, + "CNY": PricingCurrencyEnumCny, + "COP": PricingCurrencyEnumCop, + "CRC": PricingCurrencyEnumCrc, + "HRK": PricingCurrencyEnumHrk, + "CZK": PricingCurrencyEnumCzk, + "DKK": PricingCurrencyEnumDkk, + "EGP": PricingCurrencyEnumEgp, + "HKD": PricingCurrencyEnumHkd, + "HUF": PricingCurrencyEnumHuf, + "ISK": PricingCurrencyEnumIsk, + "IDR": PricingCurrencyEnumIdr, + "ILS": PricingCurrencyEnumIls, + "JMD": PricingCurrencyEnumJmd, + "KZT": PricingCurrencyEnumKzt, + "KES": PricingCurrencyEnumKes, + "KRW": PricingCurrencyEnumKrw, + "KWD": PricingCurrencyEnumKwd, + "LBP": PricingCurrencyEnumLbp, + "MOP": PricingCurrencyEnumMop, + "MYR": PricingCurrencyEnumMyr, + "MVR": PricingCurrencyEnumMvr, + "AED": PricingCurrencyEnumAed, + "NZD": PricingCurrencyEnumNzd, + "NOK": PricingCurrencyEnumNok, + "PKR": PricingCurrencyEnumPkr, + "PEN": PricingCurrencyEnumPen, + "PHP": PricingCurrencyEnumPhp, + "PLN": PricingCurrencyEnumPln, + "QAR": PricingCurrencyEnumQar, + "RON": PricingCurrencyEnumRon, + "SAR": PricingCurrencyEnumSar, + "RSD": PricingCurrencyEnumRsd, + "SGD": PricingCurrencyEnumSgd, + "ZAR": PricingCurrencyEnumZar, + "SEK": PricingCurrencyEnumSek, + "TWD": PricingCurrencyEnumTwd, + "THB": PricingCurrencyEnumThb, + "TRY": PricingCurrencyEnumTry, + "VND": PricingCurrencyEnumVnd, } var mappingPricingCurrencyEnumEnumLowerCase = map[string]PricingCurrencyEnumEnum{ @@ -57,6 +147,51 @@ var mappingPricingCurrencyEnumEnumLowerCase = map[string]PricingCurrencyEnumEnum "chf": PricingCurrencyEnumChf, "mxn": PricingCurrencyEnumMxn, "clp": PricingCurrencyEnumClp, + "all": PricingCurrencyEnumAll, + "ars": PricingCurrencyEnumArs, + "aud": PricingCurrencyEnumAud, + "bdt": PricingCurrencyEnumBdt, + "bam": PricingCurrencyEnumBam, + "bgn": PricingCurrencyEnumBgn, + "cny": PricingCurrencyEnumCny, + "cop": PricingCurrencyEnumCop, + "crc": PricingCurrencyEnumCrc, + "hrk": PricingCurrencyEnumHrk, + "czk": PricingCurrencyEnumCzk, + "dkk": PricingCurrencyEnumDkk, + "egp": PricingCurrencyEnumEgp, + "hkd": PricingCurrencyEnumHkd, + "huf": PricingCurrencyEnumHuf, + "isk": PricingCurrencyEnumIsk, + "idr": PricingCurrencyEnumIdr, + "ils": PricingCurrencyEnumIls, + "jmd": PricingCurrencyEnumJmd, + "kzt": PricingCurrencyEnumKzt, + "kes": PricingCurrencyEnumKes, + "krw": PricingCurrencyEnumKrw, + "kwd": PricingCurrencyEnumKwd, + "lbp": PricingCurrencyEnumLbp, + "mop": PricingCurrencyEnumMop, + "myr": PricingCurrencyEnumMyr, + "mvr": PricingCurrencyEnumMvr, + "aed": PricingCurrencyEnumAed, + "nzd": PricingCurrencyEnumNzd, + "nok": PricingCurrencyEnumNok, + "pkr": PricingCurrencyEnumPkr, + "pen": PricingCurrencyEnumPen, + "php": PricingCurrencyEnumPhp, + "pln": PricingCurrencyEnumPln, + "qar": PricingCurrencyEnumQar, + "ron": PricingCurrencyEnumRon, + "sar": PricingCurrencyEnumSar, + "rsd": PricingCurrencyEnumRsd, + "sgd": PricingCurrencyEnumSgd, + "zar": PricingCurrencyEnumZar, + "sek": PricingCurrencyEnumSek, + "twd": PricingCurrencyEnumTwd, + "thb": PricingCurrencyEnumThb, + "try": PricingCurrencyEnumTry, + "vnd": PricingCurrencyEnumVnd, } // GetPricingCurrencyEnumEnumValues Enumerates the set of values for PricingCurrencyEnumEnum @@ -82,6 +217,51 @@ func GetPricingCurrencyEnumEnumStringValues() []string { "CHF", "MXN", "CLP", + "ALL", + "ARS", + "AUD", + "BDT", + "BAM", + "BGN", + "CNY", + "COP", + "CRC", + "HRK", + "CZK", + "DKK", + "EGP", + "HKD", + "HUF", + "ISK", + "IDR", + "ILS", + "JMD", + "KZT", + "KES", + "KRW", + "KWD", + "LBP", + "MOP", + "MYR", + "MVR", + "AED", + "NZD", + "NOK", + "PKR", + "PEN", + "PHP", + "PLN", + "QAR", + "RON", + "SAR", + "RSD", + "SGD", + "ZAR", + "SEK", + "TWD", + "THB", + "TRY", + "VND", } } diff --git a/marketplace/publication.go b/marketplace/publication.go index 37689e66d4..f3c13c2bbf 100644 --- a/marketplace/publication.go +++ b/marketplace/publication.go @@ -64,6 +64,11 @@ type Publication struct { // predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). // Example: `{"Department": "Finance"}` FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // The system tags associated with this resource, if any. The system tags are set by Oracle Cloud Infrastructure services. Each key is predefined and scoped to namespaces. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{orcl-cloud: {free-tier-retain: true}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` } func (m Publication) String() string { diff --git a/marketplace/publication_summary.go b/marketplace/publication_summary.go index de90ed2a13..0c78ecdb28 100644 --- a/marketplace/publication_summary.go +++ b/marketplace/publication_summary.go @@ -48,6 +48,21 @@ type PublicationSummary struct { // timestamp format. // Example: `2016-08-25T21:10:29.600Z` TimeCreated *common.SDKTime `mandatory:"false" json:"timeCreated"` + + // The defined tags associated with this resource, if any. Each key is predefined and scoped to namespaces. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Operations": {"CostCenter": "42"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // The freeform tags associated with this resource, if any. Each tag is a simple key-value pair with no + // predefined name, type, or namespace. For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{"Department": "Finance"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // The system tags associated with this resource, if any. The system tags are set by Oracle Cloud Infrastructure services. Each key is predefined and scoped to namespaces. + // For more information, see Resource Tags (https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). + // Example: `{orcl-cloud: {free-tier-retain: true}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` } func (m PublicationSummary) String() string { diff --git a/stackmonitoring/change_process_set_compartment_details.go b/stackmonitoring/change_process_set_compartment_details.go new file mode 100644 index 0000000000..d1ad4911c8 --- /dev/null +++ b/stackmonitoring/change_process_set_compartment_details.go @@ -0,0 +1,40 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ChangeProcessSetCompartmentDetails Payload describing to which compartment the resource should be moved. +type ChangeProcessSetCompartmentDetails struct { + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment + // into which the resource should be moved. + CompartmentId *string `mandatory:"true" json:"compartmentId"` +} + +func (m ChangeProcessSetCompartmentDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ChangeProcessSetCompartmentDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/change_process_set_compartment_request_response.go b/stackmonitoring/change_process_set_compartment_request_response.go new file mode 100644 index 0000000000..4e58f56c78 --- /dev/null +++ b/stackmonitoring/change_process_set_compartment_request_response.go @@ -0,0 +1,105 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ChangeProcessSetCompartmentRequest wrapper for the ChangeProcessSetCompartment operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/ChangeProcessSetCompartment.go.html to see an example of how to use ChangeProcessSetCompartmentRequest. +type ChangeProcessSetCompartmentRequest struct { + + // The Process Set ID + ProcessSetId *string `mandatory:"true" contributesTo:"path" name:"processSetId"` + + // The information to be updated. + ChangeProcessSetCompartmentDetails `contributesTo:"body"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ChangeProcessSetCompartmentRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ChangeProcessSetCompartmentRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ChangeProcessSetCompartmentRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ChangeProcessSetCompartmentRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ChangeProcessSetCompartmentRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ChangeProcessSetCompartmentResponse wrapper for the ChangeProcessSetCompartment operation +type ChangeProcessSetCompartmentResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ChangeProcessSetCompartmentResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ChangeProcessSetCompartmentResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/stackmonitoring/create_process_set_details.go b/stackmonitoring/create_process_set_details.go new file mode 100644 index 0000000000..06ecfa2ffd --- /dev/null +++ b/stackmonitoring/create_process_set_details.go @@ -0,0 +1,52 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// CreateProcessSetDetails Process Set create payload model. +type CreateProcessSetDetails struct { + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // Name of the Process Set. + DisplayName *string `mandatory:"true" json:"displayName"` + + Specification *ProcessSetSpecification `mandatory:"true" json:"specification"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m CreateProcessSetDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m CreateProcessSetDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/create_process_set_request_response.go b/stackmonitoring/create_process_set_request_response.go new file mode 100644 index 0000000000..294864a093 --- /dev/null +++ b/stackmonitoring/create_process_set_request_response.go @@ -0,0 +1,101 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// CreateProcessSetRequest wrapper for the CreateProcessSet operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/CreateProcessSet.go.html to see an example of how to use CreateProcessSetRequest. +type CreateProcessSetRequest struct { + + // Summary of process set details. + CreateProcessSetDetails `contributesTo:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // A token that uniquely identifies a request so it can be retried in case of a timeout or + // server error without risk of executing that same action again. Retry tokens expire after 24 + // hours, but can be invalidated before then due to conflicting operations. For example, if a resource + // has been deleted and purged from the system, then a retry of the original creation request + // might be rejected. + OpcRetryToken *string `mandatory:"false" contributesTo:"header" name:"opc-retry-token"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request CreateProcessSetRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request CreateProcessSetRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request CreateProcessSetRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request CreateProcessSetRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request CreateProcessSetRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// CreateProcessSetResponse wrapper for the CreateProcessSet operation +type CreateProcessSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ProcessSet instance + ProcessSet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response CreateProcessSetResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response CreateProcessSetResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/stackmonitoring/delete_process_set_request_response.go b/stackmonitoring/delete_process_set_request_response.go new file mode 100644 index 0000000000..b372a6b443 --- /dev/null +++ b/stackmonitoring/delete_process_set_request_response.go @@ -0,0 +1,95 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// DeleteProcessSetRequest wrapper for the DeleteProcessSet operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/DeleteProcessSet.go.html to see an example of how to use DeleteProcessSetRequest. +type DeleteProcessSetRequest struct { + + // The Process Set ID + ProcessSetId *string `mandatory:"true" contributesTo:"path" name:"processSetId"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request DeleteProcessSetRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request DeleteProcessSetRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request DeleteProcessSetRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request DeleteProcessSetRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request DeleteProcessSetRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// DeleteProcessSetResponse wrapper for the DeleteProcessSet operation +type DeleteProcessSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response DeleteProcessSetResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response DeleteProcessSetResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/stackmonitoring/discovery_details.go b/stackmonitoring/discovery_details.go index bcc6b164a5..b6556bd5ab 100644 --- a/stackmonitoring/discovery_details.go +++ b/stackmonitoring/discovery_details.go @@ -77,6 +77,7 @@ const ( DiscoveryDetailsResourceTypeOracleMft DiscoveryDetailsResourceTypeEnum = "ORACLE_MFT" DiscoveryDetailsResourceTypeApacheHttpServer DiscoveryDetailsResourceTypeEnum = "APACHE_HTTP_SERVER" DiscoveryDetailsResourceTypeOracleGoldengate DiscoveryDetailsResourceTypeEnum = "ORACLE_GOLDENGATE" + DiscoveryDetailsResourceTypeCustomResource DiscoveryDetailsResourceTypeEnum = "CUSTOM_RESOURCE" ) var mappingDiscoveryDetailsResourceTypeEnum = map[string]DiscoveryDetailsResourceTypeEnum{ @@ -93,6 +94,7 @@ var mappingDiscoveryDetailsResourceTypeEnum = map[string]DiscoveryDetailsResourc "ORACLE_MFT": DiscoveryDetailsResourceTypeOracleMft, "APACHE_HTTP_SERVER": DiscoveryDetailsResourceTypeApacheHttpServer, "ORACLE_GOLDENGATE": DiscoveryDetailsResourceTypeOracleGoldengate, + "CUSTOM_RESOURCE": DiscoveryDetailsResourceTypeCustomResource, } var mappingDiscoveryDetailsResourceTypeEnumLowerCase = map[string]DiscoveryDetailsResourceTypeEnum{ @@ -109,6 +111,7 @@ var mappingDiscoveryDetailsResourceTypeEnumLowerCase = map[string]DiscoveryDetai "oracle_mft": DiscoveryDetailsResourceTypeOracleMft, "apache_http_server": DiscoveryDetailsResourceTypeApacheHttpServer, "oracle_goldengate": DiscoveryDetailsResourceTypeOracleGoldengate, + "custom_resource": DiscoveryDetailsResourceTypeCustomResource, } // GetDiscoveryDetailsResourceTypeEnumValues Enumerates the set of values for DiscoveryDetailsResourceTypeEnum @@ -136,6 +139,7 @@ func GetDiscoveryDetailsResourceTypeEnumStringValues() []string { "ORACLE_MFT", "APACHE_HTTP_SERVER", "ORACLE_GOLDENGATE", + "CUSTOM_RESOURCE", } } diff --git a/stackmonitoring/discovery_job_summary.go b/stackmonitoring/discovery_job_summary.go index 2c50718f7a..08e627243a 100644 --- a/stackmonitoring/discovery_job_summary.go +++ b/stackmonitoring/discovery_job_summary.go @@ -116,6 +116,7 @@ const ( DiscoveryJobSummaryResourceTypeOracleMft DiscoveryJobSummaryResourceTypeEnum = "ORACLE_MFT" DiscoveryJobSummaryResourceTypeApacheHttpServer DiscoveryJobSummaryResourceTypeEnum = "APACHE_HTTP_SERVER" DiscoveryJobSummaryResourceTypeOracleGoldengate DiscoveryJobSummaryResourceTypeEnum = "ORACLE_GOLDENGATE" + DiscoveryJobSummaryResourceTypeCustomResource DiscoveryJobSummaryResourceTypeEnum = "CUSTOM_RESOURCE" ) var mappingDiscoveryJobSummaryResourceTypeEnum = map[string]DiscoveryJobSummaryResourceTypeEnum{ @@ -132,6 +133,7 @@ var mappingDiscoveryJobSummaryResourceTypeEnum = map[string]DiscoveryJobSummaryR "ORACLE_MFT": DiscoveryJobSummaryResourceTypeOracleMft, "APACHE_HTTP_SERVER": DiscoveryJobSummaryResourceTypeApacheHttpServer, "ORACLE_GOLDENGATE": DiscoveryJobSummaryResourceTypeOracleGoldengate, + "CUSTOM_RESOURCE": DiscoveryJobSummaryResourceTypeCustomResource, } var mappingDiscoveryJobSummaryResourceTypeEnumLowerCase = map[string]DiscoveryJobSummaryResourceTypeEnum{ @@ -148,6 +150,7 @@ var mappingDiscoveryJobSummaryResourceTypeEnumLowerCase = map[string]DiscoveryJo "oracle_mft": DiscoveryJobSummaryResourceTypeOracleMft, "apache_http_server": DiscoveryJobSummaryResourceTypeApacheHttpServer, "oracle_goldengate": DiscoveryJobSummaryResourceTypeOracleGoldengate, + "custom_resource": DiscoveryJobSummaryResourceTypeCustomResource, } // GetDiscoveryJobSummaryResourceTypeEnumValues Enumerates the set of values for DiscoveryJobSummaryResourceTypeEnum @@ -175,6 +178,7 @@ func GetDiscoveryJobSummaryResourceTypeEnumStringValues() []string { "ORACLE_MFT", "APACHE_HTTP_SERVER", "ORACLE_GOLDENGATE", + "CUSTOM_RESOURCE", } } diff --git a/stackmonitoring/get_process_set_request_response.go b/stackmonitoring/get_process_set_request_response.go new file mode 100644 index 0000000000..bbfda3cbe1 --- /dev/null +++ b/stackmonitoring/get_process_set_request_response.go @@ -0,0 +1,94 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// GetProcessSetRequest wrapper for the GetProcessSet operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/GetProcessSet.go.html to see an example of how to use GetProcessSetRequest. +type GetProcessSetRequest struct { + + // The Process Set ID + ProcessSetId *string `mandatory:"true" contributesTo:"path" name:"processSetId"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request GetProcessSetRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request GetProcessSetRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request GetProcessSetRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request GetProcessSetRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request GetProcessSetRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// GetProcessSetResponse wrapper for the GetProcessSet operation +type GetProcessSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ProcessSet instance + ProcessSet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response GetProcessSetResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response GetProcessSetResponse) HTTPResponse() *http.Response { + return response.RawResponse +} diff --git a/stackmonitoring/list_process_sets_request_response.go b/stackmonitoring/list_process_sets_request_response.go new file mode 100644 index 0000000000..588b654e41 --- /dev/null +++ b/stackmonitoring/list_process_sets_request_response.go @@ -0,0 +1,205 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// ListProcessSetsRequest wrapper for the ListProcessSets operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/ListProcessSets.go.html to see an example of how to use ListProcessSetsRequest. +type ListProcessSetsRequest struct { + + // The ID of the compartment in which data is listed. + CompartmentId *string `mandatory:"true" contributesTo:"query" name:"compartmentId"` + + // For list pagination. The maximum number of results per page, or items to return in a + // paginated "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Limit *int `mandatory:"false" contributesTo:"query" name:"limit"` + + // For list pagination. The value of the `opc-next-page` response header from the + // previous "List" call. For important details about how pagination works, see + // List Pagination (https://docs.cloud.oracle.com/iaas/Content/API/Concepts/usingapi.htm#nine). + Page *string `mandatory:"false" contributesTo:"query" name:"page"` + + // The sort order to use, either ascending (`ASC`) or descending (`DESC`). + SortOrder ListProcessSetsSortOrderEnum `mandatory:"false" contributesTo:"query" name:"sortOrder" omitEmpty:"true"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // The field to sort by. Only one sort order may be provided. Default order for timeUpdated is descending. Default order for name is ascending. + SortBy ListProcessSetsSortByEnum `mandatory:"false" contributesTo:"query" name:"sortBy" omitEmpty:"true"` + + // A filter to return only resources that match the entire display name given. + DisplayName *string `mandatory:"false" contributesTo:"query" name:"displayName"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request ListProcessSetsRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request ListProcessSetsRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request ListProcessSetsRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request ListProcessSetsRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request ListProcessSetsRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingListProcessSetsSortOrderEnum(string(request.SortOrder)); !ok && request.SortOrder != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortOrder: %s. Supported values are: %s.", request.SortOrder, strings.Join(GetListProcessSetsSortOrderEnumStringValues(), ","))) + } + if _, ok := GetMappingListProcessSetsSortByEnum(string(request.SortBy)); !ok && request.SortBy != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for SortBy: %s. Supported values are: %s.", request.SortBy, strings.Join(GetListProcessSetsSortByEnumStringValues(), ","))) + } + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// ListProcessSetsResponse wrapper for the ListProcessSets operation +type ListProcessSetsResponse struct { + + // The underlying http response + RawResponse *http.Response + + // A list of ProcessSetCollection instances + ProcessSetCollection `presentIn:"body"` + + // For pagination of a list of items. When paging through a list, if this header appears in the response, + // then a partial list might have been returned. Include this value as the `page` parameter for the + // subsequent GET request to get the next batch of items. + OpcNextPage *string `presentIn:"header" name:"opc-next-page"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response ListProcessSetsResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response ListProcessSetsResponse) HTTPResponse() *http.Response { + return response.RawResponse +} + +// ListProcessSetsSortOrderEnum Enum with underlying type: string +type ListProcessSetsSortOrderEnum string + +// Set of constants representing the allowable values for ListProcessSetsSortOrderEnum +const ( + ListProcessSetsSortOrderAsc ListProcessSetsSortOrderEnum = "ASC" + ListProcessSetsSortOrderDesc ListProcessSetsSortOrderEnum = "DESC" +) + +var mappingListProcessSetsSortOrderEnum = map[string]ListProcessSetsSortOrderEnum{ + "ASC": ListProcessSetsSortOrderAsc, + "DESC": ListProcessSetsSortOrderDesc, +} + +var mappingListProcessSetsSortOrderEnumLowerCase = map[string]ListProcessSetsSortOrderEnum{ + "asc": ListProcessSetsSortOrderAsc, + "desc": ListProcessSetsSortOrderDesc, +} + +// GetListProcessSetsSortOrderEnumValues Enumerates the set of values for ListProcessSetsSortOrderEnum +func GetListProcessSetsSortOrderEnumValues() []ListProcessSetsSortOrderEnum { + values := make([]ListProcessSetsSortOrderEnum, 0) + for _, v := range mappingListProcessSetsSortOrderEnum { + values = append(values, v) + } + return values +} + +// GetListProcessSetsSortOrderEnumStringValues Enumerates the set of values in String for ListProcessSetsSortOrderEnum +func GetListProcessSetsSortOrderEnumStringValues() []string { + return []string{ + "ASC", + "DESC", + } +} + +// GetMappingListProcessSetsSortOrderEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListProcessSetsSortOrderEnum(val string) (ListProcessSetsSortOrderEnum, bool) { + enum, ok := mappingListProcessSetsSortOrderEnumLowerCase[strings.ToLower(val)] + return enum, ok +} + +// ListProcessSetsSortByEnum Enum with underlying type: string +type ListProcessSetsSortByEnum string + +// Set of constants representing the allowable values for ListProcessSetsSortByEnum +const ( + ListProcessSetsSortByTimeupdated ListProcessSetsSortByEnum = "timeUpdated" + ListProcessSetsSortByName ListProcessSetsSortByEnum = "name" +) + +var mappingListProcessSetsSortByEnum = map[string]ListProcessSetsSortByEnum{ + "timeUpdated": ListProcessSetsSortByTimeupdated, + "name": ListProcessSetsSortByName, +} + +var mappingListProcessSetsSortByEnumLowerCase = map[string]ListProcessSetsSortByEnum{ + "timeupdated": ListProcessSetsSortByTimeupdated, + "name": ListProcessSetsSortByName, +} + +// GetListProcessSetsSortByEnumValues Enumerates the set of values for ListProcessSetsSortByEnum +func GetListProcessSetsSortByEnumValues() []ListProcessSetsSortByEnum { + values := make([]ListProcessSetsSortByEnum, 0) + for _, v := range mappingListProcessSetsSortByEnum { + values = append(values, v) + } + return values +} + +// GetListProcessSetsSortByEnumStringValues Enumerates the set of values in String for ListProcessSetsSortByEnum +func GetListProcessSetsSortByEnumStringValues() []string { + return []string{ + "timeUpdated", + "name", + } +} + +// GetMappingListProcessSetsSortByEnum performs case Insensitive comparison on enum value and return the desired enum +func GetMappingListProcessSetsSortByEnum(val string) (ListProcessSetsSortByEnum, bool) { + enum, ok := mappingListProcessSetsSortByEnumLowerCase[strings.ToLower(val)] + return enum, ok +} diff --git a/stackmonitoring/process_set.go b/stackmonitoring/process_set.go new file mode 100644 index 0000000000..57d2ab4985 --- /dev/null +++ b/stackmonitoring/process_set.go @@ -0,0 +1,74 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ProcessSet The Process Set details. +type ProcessSet struct { + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Process Set. + Id *string `mandatory:"true" json:"id"` + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The current state of the Resource. + LifecycleState LifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // Name of the Process Set. + DisplayName *string `mandatory:"true" json:"displayName"` + + Specification *ProcessSetSpecification `mandatory:"true" json:"specification"` + + // The time the process set was created. An RFC3339 formatted datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current revision of the Process Set. + Revision *string `mandatory:"true" json:"revision"` + + // The time the process set was last updated. An RFC3339 formatted datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m ProcessSet) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ProcessSet) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetLifecycleStateEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/process_set_collection.go b/stackmonitoring/process_set_collection.go new file mode 100644 index 0000000000..8e8b04f1ea --- /dev/null +++ b/stackmonitoring/process_set_collection.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ProcessSetCollection Result of the Process Set fetch. +type ProcessSetCollection struct { + + // List of Process Sets. + Items []ProcessSetSummary `mandatory:"true" json:"items"` +} + +func (m ProcessSetCollection) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ProcessSetCollection) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/process_set_specification.go b/stackmonitoring/process_set_specification.go new file mode 100644 index 0000000000..c24827e57f --- /dev/null +++ b/stackmonitoring/process_set_specification.go @@ -0,0 +1,39 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ProcessSetSpecification Collection of regular expression specifications used to identify the processes to be monitored. +type ProcessSetSpecification struct { + + // List of Process Set specification details. + Items []ProcessSetSpecificationDetails `mandatory:"true" json:"items"` +} + +func (m ProcessSetSpecification) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ProcessSetSpecification) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/process_set_specification_details.go b/stackmonitoring/process_set_specification_details.go new file mode 100644 index 0000000000..5f98a4e228 --- /dev/null +++ b/stackmonitoring/process_set_specification_details.go @@ -0,0 +1,48 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ProcessSetSpecificationDetails Details of a single regular expression specification in a Process Set. +type ProcessSetSpecificationDetails struct { + + // Optional label used to identify a single filter. + Label *string `mandatory:"false" json:"label"` + + // String literal used for exact matching on process name. + ProcessCommand *string `mandatory:"false" json:"processCommand"` + + // String literal used for exact matching on process user. + ProcessUser *string `mandatory:"false" json:"processUser"` + + // Regex pattern matching on process arguments. + ProcessLineRegexPattern *string `mandatory:"false" json:"processLineRegexPattern"` +} + +func (m ProcessSetSpecificationDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ProcessSetSpecificationDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/process_set_summary.go b/stackmonitoring/process_set_summary.go new file mode 100644 index 0000000000..11e1fe8b63 --- /dev/null +++ b/stackmonitoring/process_set_summary.go @@ -0,0 +1,74 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// ProcessSetSummary Summary of a Process Set, used to construct a list of Process Sets when fetching all Process Sets in a compartment. +type ProcessSetSummary struct { + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the Process Set. + Id *string `mandatory:"true" json:"id"` + + // The OCID (https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the compartment. + CompartmentId *string `mandatory:"true" json:"compartmentId"` + + // The current state of the Resource. + LifecycleState LifecycleStateEnum `mandatory:"true" json:"lifecycleState"` + + // Name of the Process Set. + DisplayName *string `mandatory:"true" json:"displayName"` + + Specification *ProcessSetSpecification `mandatory:"true" json:"specification"` + + // The time the process set was created. An RFC3339 formatted datetime string. + TimeCreated *common.SDKTime `mandatory:"true" json:"timeCreated"` + + // The current revision of the Process Set. + Revision *string `mandatory:"true" json:"revision"` + + // The time the process set was last updated. An RFC3339 formatted datetime string. + TimeUpdated *common.SDKTime `mandatory:"false" json:"timeUpdated"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` + + // Usage of system tag keys. These predefined keys are scoped to namespaces. + // Example: `{"orcl-cloud": {"free-tier-retained": "true"}}` + SystemTags map[string]map[string]interface{} `mandatory:"false" json:"systemTags"` +} + +func (m ProcessSetSummary) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m ProcessSetSummary) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if _, ok := GetMappingLifecycleStateEnum(string(m.LifecycleState)); !ok && m.LifecycleState != "" { + errMessage = append(errMessage, fmt.Sprintf("unsupported enum value for LifecycleState: %s. Supported values are: %s.", m.LifecycleState, strings.Join(GetLifecycleStateEnumStringValues(), ","))) + } + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/stackmonitoring_client.go b/stackmonitoring/stackmonitoring_client.go index eb0ca9b88c..988eafc514 100644 --- a/stackmonitoring/stackmonitoring_client.go +++ b/stackmonitoring/stackmonitoring_client.go @@ -414,6 +414,69 @@ func (client StackMonitoringClient) changeMonitoredResourceTaskCompartment(ctx c return response, err } +// ChangeProcessSetCompartment Moves a ProcessSet resource from one compartment identifier to another. When provided, If-Match is checked against ETag values of the resource. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/ChangeProcessSetCompartment.go.html to see an example of how to use ChangeProcessSetCompartment API. +// A default retry strategy applies to this operation ChangeProcessSetCompartment() +func (client StackMonitoringClient) ChangeProcessSetCompartment(ctx context.Context, request ChangeProcessSetCompartmentRequest) (response ChangeProcessSetCompartmentResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.changeProcessSetCompartment, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ChangeProcessSetCompartmentResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ChangeProcessSetCompartmentResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ChangeProcessSetCompartmentResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ChangeProcessSetCompartmentResponse") + } + return +} + +// changeProcessSetCompartment implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) changeProcessSetCompartment(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/processSets/{processSetId}/actions/changeCompartment", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ChangeProcessSetCompartmentResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSet/ChangeProcessSetCompartment" + err = common.PostProcessServiceError(err, "StackMonitoring", "ChangeProcessSetCompartment", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // CreateBaselineableMetric Creates the specified Baseline-able metric // // # See also @@ -859,6 +922,69 @@ func (client StackMonitoringClient) createMonitoredResourceType(ctx context.Cont return response, err } +// CreateProcessSet API to create Process Set. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/CreateProcessSet.go.html to see an example of how to use CreateProcessSet API. +// A default retry strategy applies to this operation CreateProcessSet() +func (client StackMonitoringClient) CreateProcessSet(ctx context.Context, request CreateProcessSetRequest) (response CreateProcessSetResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + + if !(request.OpcRetryToken != nil && *request.OpcRetryToken != "") { + request.OpcRetryToken = common.String(common.RetryToken()) + } + + ociResponse, err = common.Retry(ctx, request, client.createProcessSet, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = CreateProcessSetResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = CreateProcessSetResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(CreateProcessSetResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into CreateProcessSetResponse") + } + return +} + +// createProcessSet implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) createProcessSet(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPost, "/processSets", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response CreateProcessSetResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSet/CreateProcessSet" + err = common.PostProcessServiceError(err, "StackMonitoring", "CreateProcessSet", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // DeleteBaselineableMetric Deletes the Baseline-able metric for the given id // // # See also @@ -1207,6 +1333,64 @@ func (client StackMonitoringClient) deleteMonitoredResourceType(ctx context.Cont return response, err } +// DeleteProcessSet Deletes a Process Set +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/DeleteProcessSet.go.html to see an example of how to use DeleteProcessSet API. +// A default retry strategy applies to this operation DeleteProcessSet() +func (client StackMonitoringClient) DeleteProcessSet(ctx context.Context, request DeleteProcessSetRequest) (response DeleteProcessSetResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.deleteProcessSet, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = DeleteProcessSetResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = DeleteProcessSetResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(DeleteProcessSetResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into DeleteProcessSetResponse") + } + return +} + +// deleteProcessSet implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) deleteProcessSet(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodDelete, "/processSets/{processSetId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response DeleteProcessSetResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSet/DeleteProcessSet" + err = common.PostProcessServiceError(err, "StackMonitoring", "DeleteProcessSet", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // DisableExternalDatabase Disable external database resource monitoring. All the references in DBaaS, // DBM and resource service will be deleted as part of this operation. // @@ -1988,6 +2172,64 @@ func (client StackMonitoringClient) getMonitoredResourceType(ctx context.Context return response, err } +// GetProcessSet API to get the details of a Process Set by identifier. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/GetProcessSet.go.html to see an example of how to use GetProcessSet API. +// A default retry strategy applies to this operation GetProcessSet() +func (client StackMonitoringClient) GetProcessSet(ctx context.Context, request GetProcessSetRequest) (response GetProcessSetResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.getProcessSet, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = GetProcessSetResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = GetProcessSetResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(GetProcessSetResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into GetProcessSetResponse") + } + return +} + +// getProcessSet implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) getProcessSet(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/processSets/{processSetId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response GetProcessSetResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSet/GetProcessSet" + err = common.PostProcessServiceError(err, "StackMonitoring", "GetProcessSet", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // GetWorkRequest Gets the status of the work request with the given ID. // // # See also @@ -2515,6 +2757,64 @@ func (client StackMonitoringClient) listMonitoredResources(ctx context.Context, return response, err } +// ListProcessSets API to get the details of all Process Sets. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/ListProcessSets.go.html to see an example of how to use ListProcessSets API. +// A default retry strategy applies to this operation ListProcessSets() +func (client StackMonitoringClient) ListProcessSets(ctx context.Context, request ListProcessSetsRequest) (response ListProcessSetsResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.listProcessSets, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = ListProcessSetsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = ListProcessSetsResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(ListProcessSetsResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into ListProcessSetsResponse") + } + return +} + +// listProcessSets implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) listProcessSets(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodGet, "/processSets", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response ListProcessSetsResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSetCollection/ListProcessSets" + err = common.PostProcessServiceError(err, "StackMonitoring", "ListProcessSets", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} + // ListWorkRequestErrors Return a (paginated) list of errors for a given work request. // // # See also @@ -3602,3 +3902,61 @@ func (client StackMonitoringClient) updateMonitoredResourceType(ctx context.Cont err = common.UnmarshalResponse(httpResponse, &response) return response, err } + +// UpdateProcessSet API to update a Process Set identified by a given ocid. +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/UpdateProcessSet.go.html to see an example of how to use UpdateProcessSet API. +// A default retry strategy applies to this operation UpdateProcessSet() +func (client StackMonitoringClient) UpdateProcessSet(ctx context.Context, request UpdateProcessSetRequest) (response UpdateProcessSetResponse, err error) { + var ociResponse common.OCIResponse + policy := common.DefaultRetryPolicy() + if client.RetryPolicy() != nil { + policy = *client.RetryPolicy() + } + if request.RetryPolicy() != nil { + policy = *request.RetryPolicy() + } + ociResponse, err = common.Retry(ctx, request, client.updateProcessSet, policy) + if err != nil { + if ociResponse != nil { + if httpResponse := ociResponse.HTTPResponse(); httpResponse != nil { + opcRequestId := httpResponse.Header.Get("opc-request-id") + response = UpdateProcessSetResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId} + } else { + response = UpdateProcessSetResponse{} + } + } + return + } + if convertedResponse, ok := ociResponse.(UpdateProcessSetResponse); ok { + response = convertedResponse + } else { + err = fmt.Errorf("failed to convert OCIResponse into UpdateProcessSetResponse") + } + return +} + +// updateProcessSet implements the OCIOperation interface (enables retrying operations) +func (client StackMonitoringClient) updateProcessSet(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) { + + httpRequest, err := request.HTTPRequest(http.MethodPut, "/processSets/{processSetId}", binaryReqBody, extraHeaders) + if err != nil { + return nil, err + } + + var response UpdateProcessSetResponse + var httpResponse *http.Response + httpResponse, err = client.Call(ctx, &httpRequest) + defer common.CloseBodyIfValid(httpResponse) + response.RawResponse = httpResponse + if err != nil { + apiReferenceLink := "https://docs.oracle.com/iaas/api/#/en/stack-monitoring/20210330/ProcessSet/UpdateProcessSet" + err = common.PostProcessServiceError(err, "StackMonitoring", "UpdateProcessSet", apiReferenceLink) + return response, err + } + + err = common.UnmarshalResponse(httpResponse, &response) + return response, err +} diff --git a/stackmonitoring/update_process_set_details.go b/stackmonitoring/update_process_set_details.go new file mode 100644 index 0000000000..56ba268d7f --- /dev/null +++ b/stackmonitoring/update_process_set_details.go @@ -0,0 +1,49 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +// Stack Monitoring API +// +// Stack Monitoring API. +// + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "strings" +) + +// UpdateProcessSetDetails Process Set update payload model. +type UpdateProcessSetDetails struct { + + // Name of the Process Set. + DisplayName *string `mandatory:"false" json:"displayName"` + + Specification *ProcessSetSpecification `mandatory:"false" json:"specification"` + + // Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. + // Example: `{"bar-key": "value"}` + FreeformTags map[string]string `mandatory:"false" json:"freeformTags"` + + // Defined tags for this resource. Each key is predefined and scoped to a namespace. + // Example: `{"foo-namespace": {"bar-key": "value"}}` + DefinedTags map[string]map[string]interface{} `mandatory:"false" json:"definedTags"` +} + +func (m UpdateProcessSetDetails) String() string { + return common.PointerString(m) +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (m UpdateProcessSetDetails) ValidateEnumValue() (bool, error) { + errMessage := []string{} + + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} diff --git a/stackmonitoring/update_process_set_request_response.go b/stackmonitoring/update_process_set_request_response.go new file mode 100644 index 0000000000..e9fdb3e4dd --- /dev/null +++ b/stackmonitoring/update_process_set_request_response.go @@ -0,0 +1,104 @@ +// Copyright (c) 2016, 2018, 2024, Oracle and/or its affiliates. All rights reserved. +// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. +// Code generated. DO NOT EDIT. + +package stackmonitoring + +import ( + "fmt" + "github.com/oracle/oci-go-sdk/v65/common" + "net/http" + "strings" +) + +// UpdateProcessSetRequest wrapper for the UpdateProcessSet operation +// +// # See also +// +// Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/latest/stackmonitoring/UpdateProcessSet.go.html to see an example of how to use UpdateProcessSetRequest. +type UpdateProcessSetRequest struct { + + // The Process Set ID + ProcessSetId *string `mandatory:"true" contributesTo:"path" name:"processSetId"` + + // The updated Process Set details. + UpdateProcessSetDetails `contributesTo:"body"` + + // Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a + // particular request, please provide the request ID. + OpcRequestId *string `mandatory:"false" contributesTo:"header" name:"opc-request-id"` + + // For optimistic concurrency control. In the PUT or DELETE call + // for a resource, set the `if-match` parameter to the value of the + // etag from a previous GET or POST response for that resource. + // The resource will be updated or deleted only if the etag you + // provide matches the resource's current etag value. + IfMatch *string `mandatory:"false" contributesTo:"header" name:"if-match"` + + // Metadata about the request. This information will not be transmitted to the service, but + // represents information that the SDK will consume to drive retry behavior. + RequestMetadata common.RequestMetadata +} + +func (request UpdateProcessSetRequest) String() string { + return common.PointerString(request) +} + +// HTTPRequest implements the OCIRequest interface +func (request UpdateProcessSetRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error) { + + _, err := request.ValidateEnumValue() + if err != nil { + return http.Request{}, err + } + return common.MakeDefaultHTTPRequestWithTaggedStructAndExtraHeaders(method, path, request, extraHeaders) +} + +// BinaryRequestBody implements the OCIRequest interface +func (request UpdateProcessSetRequest) BinaryRequestBody() (*common.OCIReadSeekCloser, bool) { + + return nil, false + +} + +// RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy. +func (request UpdateProcessSetRequest) RetryPolicy() *common.RetryPolicy { + return request.RequestMetadata.RetryPolicy +} + +// ValidateEnumValue returns an error when providing an unsupported enum value +// This function is being called during constructing API request process +// Not recommended for calling this function directly +func (request UpdateProcessSetRequest) ValidateEnumValue() (bool, error) { + errMessage := []string{} + if len(errMessage) > 0 { + return true, fmt.Errorf(strings.Join(errMessage, "\n")) + } + return false, nil +} + +// UpdateProcessSetResponse wrapper for the UpdateProcessSet operation +type UpdateProcessSetResponse struct { + + // The underlying http response + RawResponse *http.Response + + // The ProcessSet instance + ProcessSet `presentIn:"body"` + + // For optimistic concurrency control. See `if-match`. + Etag *string `presentIn:"header" name:"etag"` + + // Unique Oracle-assigned identifier for the request. If you need to contact + // Oracle about a particular request, please provide the request ID. + OpcRequestId *string `presentIn:"header" name:"opc-request-id"` +} + +func (response UpdateProcessSetResponse) String() string { + return common.PointerString(response) +} + +// HTTPResponse implements the OCIResponse interface +func (response UpdateProcessSetResponse) HTTPResponse() *http.Response { + return response.RawResponse +}