OpenAI agents#

There are two OpenAI agents:

  • Batch agent: The Batch API agent allows you to submit requests for asynchronous batch processing on OpenAI.

  • ChatGPT agent The ChatGPT agent allows you to submit prompts to ChatGPT and receive responses synchronously.

Installation#

To use the OpenAI batch or ChatGPT agent, run the following command:

pip install flytekitplugins-openai

Example usage#

Batch agent#

For a batch agent usage example, see OpenAI Batch agent example usage.

ChatGPT agent#

For a ChatGPT usage example, see ChatGPT agent example.

Local testing#

Batch agent#

To test the batch agent locally, create a class for the agent task that inherits from AsyncAgentExecutorMixin. This mixin can handle asynchronous tasks and allows flytekit to mimic FlytePropeller’s behavior in calling the agent.

ChatGPT agent#

To test the ChatGPT agent locally, create a class for the agent task that inherits from SyncAgentExecutorMixin. This mixin can handle synchronous tasks and allows flytekit to mimic FlytePropeller’s behavior in calling the agent.

Union cluster deployment#

After you have finished testing the batch or ChatGPT agent locally, contact the Union team to enable it in your cluster.