func GetCohereLlmInferenceRequestReturnLikelihoodsEnumStringValues() []string
GetCohereLlmInferenceRequestReturnLikelihoodsEnumStringValues Enumerates the set of values in String for CohereLlmInferenceRequestReturnLikelihoodsEnum
func GetCohereLlmInferenceRequestTruncateEnumStringValues() []string
GetCohereLlmInferenceRequestTruncateEnumStringValues Enumerates the set of values in String for CohereLlmInferenceRequestTruncateEnum
func GetEmbedTextDetailsInputTypeEnumStringValues() []string
GetEmbedTextDetailsInputTypeEnumStringValues Enumerates the set of values in String for EmbedTextDetailsInputTypeEnum
func GetEmbedTextDetailsTruncateEnumStringValues() []string
GetEmbedTextDetailsTruncateEnumStringValues Enumerates the set of values in String for EmbedTextDetailsTruncateEnum
func GetLlmInferenceRequestRuntimeTypeEnumStringValues() []string
GetLlmInferenceRequestRuntimeTypeEnumStringValues Enumerates the set of values in String for LlmInferenceRequestRuntimeTypeEnum
func GetLlmInferenceResponseRuntimeTypeEnumStringValues() []string
GetLlmInferenceResponseRuntimeTypeEnumStringValues Enumerates the set of values in String for LlmInferenceResponseRuntimeTypeEnum
func GetServingModeServingTypeEnumStringValues() []string
GetServingModeServingTypeEnumStringValues Enumerates the set of values in String for ServingModeServingTypeEnum
func GetSummarizeTextDetailsExtractivenessEnumStringValues() []string
GetSummarizeTextDetailsExtractivenessEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsExtractivenessEnum
func GetSummarizeTextDetailsFormatEnumStringValues() []string
GetSummarizeTextDetailsFormatEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsFormatEnum
func GetSummarizeTextDetailsLengthEnumStringValues() []string
GetSummarizeTextDetailsLengthEnumStringValues Enumerates the set of values in String for SummarizeTextDetailsLengthEnum
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
func (m Choice) ValidateEnumValue() (bool, error)
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
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m CohereLlmInferenceRequest) String() string
func (m CohereLlmInferenceRequest) ValidateEnumValue() (bool, error)
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
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" )
func GetCohereLlmInferenceRequestReturnLikelihoodsEnumValues() []CohereLlmInferenceRequestReturnLikelihoodsEnum
GetCohereLlmInferenceRequestReturnLikelihoodsEnumValues Enumerates the set of values for CohereLlmInferenceRequestReturnLikelihoodsEnum
func GetMappingCohereLlmInferenceRequestReturnLikelihoodsEnum(val string) (CohereLlmInferenceRequestReturnLikelihoodsEnum, bool)
GetMappingCohereLlmInferenceRequestReturnLikelihoodsEnum performs case Insensitive comparison on enum value and return the desired enum
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" )
func GetCohereLlmInferenceRequestTruncateEnumValues() []CohereLlmInferenceRequestTruncateEnum
GetCohereLlmInferenceRequestTruncateEnumValues Enumerates the set of values for CohereLlmInferenceRequestTruncateEnum
func GetMappingCohereLlmInferenceRequestTruncateEnum(val string) (CohereLlmInferenceRequestTruncateEnum, bool)
GetMappingCohereLlmInferenceRequestTruncateEnum performs case Insensitive comparison on enum value and return the desired enum
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m CohereLlmInferenceResponse) String() string
func (m CohereLlmInferenceResponse) ValidateEnumValue() (bool, error)
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
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m DedicatedServingMode) String() string
func (m DedicatedServingMode) ValidateEnumValue() (bool, error)
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
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
func (m *EmbedTextDetails) UnmarshalJSON(data []byte) (e error)
UnmarshalJSON unmarshals from json
func (m EmbedTextDetails) ValidateEnumValue() (bool, error)
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
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" )
func GetEmbedTextDetailsInputTypeEnumValues() []EmbedTextDetailsInputTypeEnum
GetEmbedTextDetailsInputTypeEnumValues Enumerates the set of values for EmbedTextDetailsInputTypeEnum
func GetMappingEmbedTextDetailsInputTypeEnum(val string) (EmbedTextDetailsInputTypeEnum, bool)
GetMappingEmbedTextDetailsInputTypeEnum performs case Insensitive comparison on enum value and return the desired enum
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" )
func GetEmbedTextDetailsTruncateEnumValues() []EmbedTextDetailsTruncateEnum
GetEmbedTextDetailsTruncateEnumValues Enumerates the set of values for EmbedTextDetailsTruncateEnum
func GetMappingEmbedTextDetailsTruncateEnum(val string) (EmbedTextDetailsTruncateEnum, bool)
GetMappingEmbedTextDetailsTruncateEnum performs case Insensitive comparison on enum value and return the desired enum
EmbedTextRequest wrapper for the EmbedText operation
# See also
Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/65.63.0/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) BinaryRequestBody() (*common.OCIReadSeekCloser, bool)
BinaryRequestBody implements the OCIRequest interface
func (request EmbedTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error)
HTTPRequest implements the OCIRequest interface
func (request EmbedTextRequest) RetryPolicy() *common.RetryPolicy
RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request EmbedTextRequest) String() string
func (request EmbedTextRequest) ValidateEnumValue() (bool, error)
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
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) HTTPResponse() *http.Response
HTTPResponse implements the OCIResponse interface
func (response EmbedTextResponse) String() string
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
func (m EmbedTextResult) ValidateEnumValue() (bool, error)
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
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
func (m *GenerateTextDetails) UnmarshalJSON(data []byte) (e error)
UnmarshalJSON unmarshals from json
func (m GenerateTextDetails) ValidateEnumValue() (bool, error)
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
GenerateTextRequest wrapper for the GenerateText operation
# See also
Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/65.63.0/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) BinaryRequestBody() (*common.OCIReadSeekCloser, bool)
BinaryRequestBody implements the OCIRequest interface
func (request GenerateTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error)
HTTPRequest implements the OCIRequest interface
func (request GenerateTextRequest) RetryPolicy() *common.RetryPolicy
RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request GenerateTextRequest) String() string
func (request GenerateTextRequest) ValidateEnumValue() (bool, error)
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
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) HTTPResponse() *http.Response
HTTPResponse implements the OCIResponse interface
func (response GenerateTextResponse) String() string
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
func (m *GenerateTextResult) UnmarshalJSON(data []byte) (e error)
UnmarshalJSON unmarshals from json
func (m GenerateTextResult) ValidateEnumValue() (bool, error)
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
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
func (m GeneratedText) ValidateEnumValue() (bool, error)
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
GenerativeAiInferenceClient a client for GenerativeAiInference
type GenerativeAiInferenceClient struct { common.BaseClient // contains filtered or unexported fields }
func NewGenerativeAiInferenceClientWithConfigurationProvider(configProvider common.ConfigurationProvider) (client GenerativeAiInferenceClient, err error)
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 NewGenerativeAiInferenceClientWithOboToken(configProvider common.ConfigurationProvider, oboToken string) (client GenerativeAiInferenceClient, err error)
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 (client *GenerativeAiInferenceClient) ConfigurationProvider() *common.ConfigurationProvider
ConfigurationProvider the ConfigurationProvider used in this client, or null if none set
func (client GenerativeAiInferenceClient) EmbedText(ctx context.Context, request EmbedTextRequest) (response EmbedTextResponse, err error)
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/65.63.0/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) GenerateText(ctx context.Context, request GenerateTextRequest) (response GenerateTextResponse, err error)
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/65.63.0/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) SetRegion(region string)
SetRegion overrides the region of this client.
func (client GenerativeAiInferenceClient) SummarizeText(ctx context.Context, request SummarizeTextRequest) (response SummarizeTextResponse, err error)
SummarizeText Summarizes the input text.
# See also
Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/65.63.0/generativeaiinference/SummarizeText.go.html to see an example of how to use SummarizeText API. A default retry strategy applies to this operation SummarizeText()
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m LlamaLlmInferenceRequest) String() string
func (m LlamaLlmInferenceRequest) ValidateEnumValue() (bool, error)
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
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m LlamaLlmInferenceResponse) String() string
func (m LlamaLlmInferenceResponse) ValidateEnumValue() (bool, error)
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
LlmInferenceRequest The base class for the inference requests.
type LlmInferenceRequest interface { }
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" )
func GetLlmInferenceRequestRuntimeTypeEnumValues() []LlmInferenceRequestRuntimeTypeEnum
GetLlmInferenceRequestRuntimeTypeEnumValues Enumerates the set of values for LlmInferenceRequestRuntimeTypeEnum
func GetMappingLlmInferenceRequestRuntimeTypeEnum(val string) (LlmInferenceRequestRuntimeTypeEnum, bool)
GetMappingLlmInferenceRequestRuntimeTypeEnum performs case Insensitive comparison on enum value and return the desired enum
LlmInferenceResponse The base class for inference responses.
type LlmInferenceResponse interface { }
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" )
func GetLlmInferenceResponseRuntimeTypeEnumValues() []LlmInferenceResponseRuntimeTypeEnum
GetLlmInferenceResponseRuntimeTypeEnumValues Enumerates the set of values for LlmInferenceResponseRuntimeTypeEnum
func GetMappingLlmInferenceResponseRuntimeTypeEnum(val string) (LlmInferenceResponseRuntimeTypeEnum, bool)
GetMappingLlmInferenceResponseRuntimeTypeEnum performs case Insensitive comparison on enum value and return the desired enum
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
func (m Logprobs) ValidateEnumValue() (bool, error)
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
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) MarshalJSON() (buff []byte, e error)
MarshalJSON marshals to json representation
func (m OnDemandServingMode) String() string
func (m OnDemandServingMode) ValidateEnumValue() (bool, error)
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
ServingMode The model's serving mode, which could be on-demand serving or dedicated serving.
type ServingMode interface { }
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" )
func GetMappingServingModeServingTypeEnum(val string) (ServingModeServingTypeEnum, bool)
GetMappingServingModeServingTypeEnum performs case Insensitive comparison on enum value and return the desired enum
func GetServingModeServingTypeEnumValues() []ServingModeServingTypeEnum
GetServingModeServingTypeEnumValues Enumerates the set of values for ServingModeServingTypeEnum
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
func (m *SummarizeTextDetails) UnmarshalJSON(data []byte) (e error)
UnmarshalJSON unmarshals from json
func (m SummarizeTextDetails) ValidateEnumValue() (bool, error)
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
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" )
func GetMappingSummarizeTextDetailsExtractivenessEnum(val string) (SummarizeTextDetailsExtractivenessEnum, bool)
GetMappingSummarizeTextDetailsExtractivenessEnum performs case Insensitive comparison on enum value and return the desired enum
func GetSummarizeTextDetailsExtractivenessEnumValues() []SummarizeTextDetailsExtractivenessEnum
GetSummarizeTextDetailsExtractivenessEnumValues Enumerates the set of values for SummarizeTextDetailsExtractivenessEnum
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" )
func GetMappingSummarizeTextDetailsFormatEnum(val string) (SummarizeTextDetailsFormatEnum, bool)
GetMappingSummarizeTextDetailsFormatEnum performs case Insensitive comparison on enum value and return the desired enum
func GetSummarizeTextDetailsFormatEnumValues() []SummarizeTextDetailsFormatEnum
GetSummarizeTextDetailsFormatEnumValues Enumerates the set of values for SummarizeTextDetailsFormatEnum
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" )
func GetMappingSummarizeTextDetailsLengthEnum(val string) (SummarizeTextDetailsLengthEnum, bool)
GetMappingSummarizeTextDetailsLengthEnum performs case Insensitive comparison on enum value and return the desired enum
func GetSummarizeTextDetailsLengthEnumValues() []SummarizeTextDetailsLengthEnum
GetSummarizeTextDetailsLengthEnumValues Enumerates the set of values for SummarizeTextDetailsLengthEnum
SummarizeTextRequest wrapper for the SummarizeText operation
# See also
Click https://docs.cloud.oracle.com/en-us/iaas/tools/go-sdk-examples/65.63.0/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) BinaryRequestBody() (*common.OCIReadSeekCloser, bool)
BinaryRequestBody implements the OCIRequest interface
func (request SummarizeTextRequest) HTTPRequest(method, path string, binaryRequestBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (http.Request, error)
HTTPRequest implements the OCIRequest interface
func (request SummarizeTextRequest) RetryPolicy() *common.RetryPolicy
RetryPolicy implements the OCIRetryableRequest interface. This retrieves the specified retry policy.
func (request SummarizeTextRequest) String() string
func (request SummarizeTextRequest) ValidateEnumValue() (bool, error)
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
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) HTTPResponse() *http.Response
HTTPResponse implements the OCIResponse interface
func (response SummarizeTextResponse) String() string
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
func (m SummarizeTextResult) ValidateEnumValue() (bool, error)
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
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
func (m TokenLikelihood) ValidateEnumValue() (bool, error)
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