ballerinax/azure.openai.deployment Ballerina library

1.0.1

Overview

This is a generated connector from Azure OpenAI Deployments API OpenAPI specification.

The Azure OpenAI Deployments REST API endpoints will deploy OpenAI models in Azure OpenAI resource.

Prerequisites

Quickstart

To use the Azure OpenAI Deployment connector in your Ballerina application, update the .bal file as follows:

Step 1: Import connector

Import the ballerinax/azure.openai.deployment module into the Ballerina project.

Copy
import ballerinax/azure.deployment;

Step 2: Create a new connector instance

Create and initialize a deployment:Client with the obtained apiKey and a serviceUrl from the azure OpenAI resource

Copy
final deployment:Client deploymentClient = check new (
    apiKeyConfig = {auth: {apiKey: apiKey}},
    serviceUrl = serviceUrl
);

Step 3: Invoke connector operation

  1. Now you can use the operations available within the connector.

Note: that they are in the form of remote operations.

Following is an example on deploying text-davinci-002 model:

Copy
model_deployment:Deployment deploymentPayload = {
    model: "text-davinci-002",
    scale_settings: {
        scale_type: "standard"
    }
};

model_deployment:Deployment modelDeployRes = check deploymentClient->/deployments.post("2022-12-01", deploymentPayload);
  1. Use bal run command to compile and run the Ballerina program.

Import

import ballerinax/azure.openai.deployment;Copy

Metadata

Released date: 10 months ago

Version: 1.0.1

License: Apache-2.0


Compatibility

Platform: any

Ballerina version: 2201.4.1

GraalVM compatible: Yes


Pull count

Total: 

Current verison: 0


Weekly downloads


Source repository


Keywords

AI/Deployment
Vendor/Microsoft
Cost/Paid
Model Deployment
Azure OpenAI

Contributors

Other versions

1.0.1

1.0.0