Skip to main content

OpenAI

Overview

This connector provides a connection to the OpenAI API. It is a wrapper around the standard OpenAI Python library.

Requirements

All that is required for this connector is an OpenAI API key (of the format SK-*), which can be created via the OpenAI web UI.

Creating

To add an instance of the OpenAI connector, you can use the Web UI or the CLI.

$ sand connectors create openai --name myconnector --api-key sk-XXXXXXXXXXXXX
✅ Connector created successfully!
Connector ID: mod_01jhnp6djxfpc9nhwrf1gwmc3j

Usage

To use this connector, you first must initialize the connector in a step:

openai = sandgarden.connectors['tickets-openai']

Then call the API just as you would the official OpenAI library:

response = openai.beta.chat.completions.parse(
model="gpt-4o",
messages=[
{"role": "system", "content": promptText},
{"role": "user", "content": contextText}
],
response_format=EscalateCheckerOutput
)