Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GenerativeAiInferenceClient

This service client uses {@link common.CircuitBreaker.DefaultConfiguration} for all the operations by default if no circuit breaker configuration is defined by the user.

Hierarchy

  • GenerativeAiInferenceClient

Constructors

constructor

  • new GenerativeAiInferenceClient(params: common.AuthParams, clientConfiguration?: common.ClientConfiguration): GenerativeAiInferenceClient

Properties

Protected _bodyDuplexMode

_bodyDuplexMode: any = undefined

Protected _circuitBreaker

_circuitBreaker: typeof Breaker | null = null

Protected _clientConfiguration

_clientConfiguration: ClientConfiguration

Protected _defaultHeaders

_defaultHeaders: any

Protected _endpoint

_endpoint: string = ""

Protected _httpClient

_httpClient: HttpClient

Protected _httpOptions

_httpOptions: any = undefined

Protected _lastSetRegionOrRegionId

_lastSetRegionOrRegionId: string = ""

Protected _realmSpecificEndpointTemplateEnabled

_realmSpecificEndpointTemplateEnabled: boolean | undefined = undefined

Protected _region

_region: Region

Protected _regionId

_regionId: string = ""

targetService

targetService: string = "GenerativeAiInference"

Static Protected endpointServiceName

endpointServiceName: string = ""

Static Protected serviceEndpointTemplate

serviceEndpointTemplate: string = "https://inference.generativeai.{region}.oci.{secondLevelDomain}"

Accessors

endpoint

  • get endpoint(): string
  • set endpoint(endpoint: string): void

logger

region

  • set region(region: Region): void
  • Sets the region to call (ex, Region.US_PHOENIX_1). Note, this will call {@link #endpoint(String) endpoint} after resolving the endpoint.

    Parameters

    • region: Region

      The region of the service.

    Returns void

regionId

  • set regionId(regionId: string): void
  • Sets the regionId to call (ex, 'us-phoenix-1').

    Note, this will first try to map the region ID to a known Region and call {@link #region(Region) region}. If no known Region could be determined, it will create an endpoint assuming its in default Realm OC1 and then call {@link #endpoint(String) endpoint}.

    Parameters

    • regionId: string

      The public region ID.

    Returns void

useRealmSpecificEndpointTemplate

  • set useRealmSpecificEndpointTemplate(realmSpecificEndpointTemplateEnabled: boolean): void
  • Determines whether realm specific endpoint should be used or not. Set realmSpecificEndpointTemplateEnabled to "true" if the user wants to enable use of realm specific endpoint template, otherwise set it to "false"

    Parameters

    • realmSpecificEndpointTemplateEnabled: boolean

      flag to enable the use of realm specific endpoint template

    Returns void

Methods

chat

  • Creates a response for the given conversation.

    This operation uses {@link common.OciSdkDefaultRetryConfiguration} by default if no retry configuration is defined by the user.

    throws

    OciError when an error occurs

    example

    Click here to see how to use Chat API.

    Parameters

    Returns Promise<ChatResponse | ReadableStream<Uint8Array> | null>

    ChatResponse

close

  • close(): void

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.

    This operation uses {@link common.OciSdkDefaultRetryConfiguration} by default if no retry configuration is defined by the user.

    throws

    OciError when an error occurs

    example

    Click here to see how to use EmbedText API.

    Parameters

    Returns Promise<EmbedTextResponse>

    EmbedTextResponse

generateText

  • Generates a text response based on the user prompt.

    This operation uses {@link common.OciSdkDefaultRetryConfiguration} by default if no retry configuration is defined by the user.

    throws

    OciError when an error occurs

    example

    Click here to see how to use GenerateText API.

    Parameters

    Returns Promise<GenerateTextResponse | ReadableStream<Uint8Array> | null>

    GenerateTextResponse

shutdownCircuitBreaker

  • shutdownCircuitBreaker(): void

summarizeText