Show / Hide Table of Contents

Class GenerativeAiInferenceClient

Service client instance for GenerativeAiInference.

Inheritance
object
ClientBase
RegionalClientBase
GenerativeAiInferenceClient
Implements
IDisposable
Inherited Members
RegionalClientBase.logger
RegionalClientBase.SetRegion(Region)
RegionalClientBase.SetRegion(string)
RegionalClientBase.UseRealmSpecificEndpointTemplate(bool)
RegionalClientBase.PopulateServiceParametersInEndpointTemplate(RestClient, Dictionary<string, object>)
RegionalClientBase.parseEndpointForParameters(string)
ClientBase.restClient
ClientBase.service
ClientBase.userAgent
ClientBase.Dispose()
ClientBase.Dispose(bool)
ClientBase.SetEndpoint(string)
ClientBase.GetEndpoint()
ClientBase.GetUserAgent()
ClientBase.SetRealmSpecificEndpointTemplate(string)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Oci.GenerativeaiinferenceService
Assembly: OCI.DotNetSDK.Generativeaiinference.dll
Syntax
public class GenerativeAiInferenceClient : RegionalClientBase, IDisposable

Constructors

GenerativeAiInferenceClient(IBasicAuthenticationDetailsProvider, ClientConfiguration, string)

Creates a new service instance using the given authentication provider and/or client configuration and/or endpoint. A client configuration can also be provided optionally to adjust REST client behaviors.

Declaration
public GenerativeAiInferenceClient(IBasicAuthenticationDetailsProvider authenticationDetailsProvider, ClientConfiguration clientConfiguration = null, string endpoint = null)
Parameters
Type Name Description
IBasicAuthenticationDetailsProvider authenticationDetailsProvider

The authentication details provider. Required.

ClientConfiguration clientConfiguration

The client configuration that contains settings to adjust REST client behaviors. Optional.

string endpoint

The endpoint of the service. If not provided and the client is a regional client, the endpoint will be constructed based on region information. Optional.

Methods

ApplyGuardrails(ApplyGuardrailsRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Applies guardrails to the input text, including content moderation, PII detection, and prompt injection protection.

Declaration
public Task<ApplyGuardrailsResponse> ApplyGuardrails(ApplyGuardrailsRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
ApplyGuardrailsRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<ApplyGuardrailsResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use ApplyGuardrails API.

Chat(ChatRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Creates a response for the given conversation.

Declaration
public Task<ChatResponse> Chat(ChatRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
ChatRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<ChatResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use Chat API.

EmbedText(EmbedTextRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Produces embeddings for the inputs. <br/> 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.

Declaration
public Task<EmbedTextResponse> EmbedText(EmbedTextRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
EmbedTextRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<EmbedTextResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use EmbedText API.

GenerateText(GenerateTextRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Generates a text response based on the user prompt.

Declaration
public Task<GenerateTextResponse> GenerateText(GenerateTextRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
GenerateTextRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<GenerateTextResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use GenerateText API.

RerankText(RerankTextRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Reranks the text responses based on the input documents and a prompt. <br/> Rerank assigns an index and a relevance score to each document, indicating which document is most related to the prompt.

Declaration
public Task<RerankTextResponse> RerankText(RerankTextRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
RerankTextRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<RerankTextResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use RerankText API.

SummarizeText(SummarizeTextRequest, RetryConfiguration, CancellationToken, HttpCompletionOption)

Summarizes the input text.

Declaration
public Task<SummarizeTextResponse> SummarizeText(SummarizeTextRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
Parameters
Type Name Description
SummarizeTextRequest request

The request object containing the details to send. Required.

RetryConfiguration retryConfiguration

The retry configuration that will be used by to send this request. Optional.

CancellationToken cancellationToken

The cancellation token to cancel this operation. Optional.

HttpCompletionOption completionOption

The completion option for this operation. Optional.

Returns
Type Description
Task<SummarizeTextResponse>

A response object containing details about the completed operation

Examples

Click here to see an example of how to use SummarizeText API.

Implements

IDisposable
In this article
Back to top