ballerinax/azure.openai.text Ballerina library
This is a generated connector from Azure OpenAI Completions API OpenAPI specification.
The Azure OpenAI Service REST API Completions Endpoint will generate one or more predicted completions based on a provided prompt. The service can also return the probabilities of alternative tokens at each position.
- Create an Azure account
- Create an Azure OpenAI resource
- Deploy an appropriate model within the resource by referring to Deploy a model guide
- Obtain tokens by following Azure OpenAI Authentication guide
To use the Azure OpenAI Text connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
ballerinax/azure.openai.text module into the Ballerina project.
Step 2: Create a new connector instance
Create and initialize a
text:Client with the obtained
apiKey and a
serviceUrl containing the deployed models.
Step 3: Invoke connector operation
Now you can use the operations available within the connector.
Note: These operations are in the form of remote operations.
Following is an example on text completion using an OpenAI
bal runcommand to compile and run the Ballerina program.
Released date: 9 months ago
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Current verison: 2917