An open API service indexing awesome lists of open source software.

https://github.com/assistantengine/open-functions-actions

Serializes OpenFunctions into ready-to-use ChatGPT actions.
https://github.com/assistantengine/open-functions-actions

chatgpt customgpt

Last synced: over 1 year ago
JSON representation

Serializes OpenFunctions into ready-to-use ChatGPT actions.

Awesome Lists containing this project

README

          

![Demo Assistant Example](media/open-functions-actions.gif)

# Open Functions Actions

This repository helps to connect **OpenFunctions** as Actions to Custom GPTs inside ChatGPT. It provides an easy way to serialize **OpenFunctions** to the required OpenAPI schema and includes a controller to receive requests directly from ChatGPT.

## Installation

Install the package via Composer:

```bash
composer require assistant-engine/open-functions-actions
```

## Usage

### Serializing OpenFunction to the OpenAPI Schema

The repository provides the ActionSerializer class that converts your **OpenFunctions** instance into an OpenAPI-compliant specification. This schema is essential for integrating your functions as actions in ChatGPT.

```php
// Instantiate an OpenFunction (e.g., DeliveryOpenFunction).
$deliveryFunction = new DeliveryOpenFunction([
'Margherita',
'Pepperoni',
'Hawaiian',
'Veggie',
'BBQ Chicken',
'Meat Lovers'
]);

// Create an instance of ActionSerializer.
$serializer = new ActionSerializer('Delivery Action API', '1.0.0', 'https://api.example.com', 'default');

// Generate the API spec as an array.
$apiSpecArray = $serializer->serialize($deliveryFunction);

echo $serializer->toJson($deliveryFunction);
```

You can copy the output directly into the *Schema* from you custom GPT.

### Providing the Endpoint for ChatGPT

#### Extend the Abstract Controller

You can create a controller by extending the provided abstract controller and implement the resolveOpenFunction() method. This method should return an instance of your Open Function implementation (for example, the DeliveryOpenFunction).

```php
We are a young startup aiming to make it easy for developers to add AI to their applications. We welcome feedback, questions, comments, and contributions. Feel free to contact us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com).

## Consultancy & Support

Do you need assistance integrating Filament Assistant into your Laravel Filament application, or help setting it up?
We offer consultancy services to help you get the most out of our package, whether you’re just getting started or looking to optimize an existing setup.

Reach out to us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com).

## Contributing

We welcome contributions from the community! Feel free to submit pull requests, open issues, and help us improve the package.

## License

This project is licensed under the MIT License. Please see [License File](LICENSE.md) for more information.