{"id":26338948,"url":"https://github.com/assistantengine/filament-assistant","last_synced_at":"2025-07-25T06:39:43.327Z","repository":{"id":258953645,"uuid":"875964970","full_name":"AssistantEngine/filament-assistant","owner":"AssistantEngine","description":"Add conversational AI capabilities directly into Laravel Filament","archived":false,"fork":false,"pushed_at":"2025-03-04T13:04:49.000Z","size":3306,"stargazers_count":17,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T14:19:54.835Z","etag":null,"topics":["assistant","filament","laravel","openai"],"latest_commit_sha":null,"homepage":"https://www.assistant-engine.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AssistantEngine.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"assistant-engine"}},"created_at":"2024-10-21T07:12:29.000Z","updated_at":"2025-03-04T13:02:02.000Z","dependencies_parsed_at":"2025-02-25T11:25:43.596Z","dependency_job_id":"abc9ff68-72e8-4983-84d1-acae62c2c517","html_url":"https://github.com/AssistantEngine/filament-assistant","commit_stats":null,"previous_names":["assistantengine/filament-assistant"],"tags_count":4,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Ffilament-assistant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Ffilament-assistant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Ffilament-assistant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AssistantEngine%2Ffilament-assistant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AssistantEngine","download_url":"https://codeload.github.com/AssistantEngine/filament-assistant/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818169,"owners_count":20352629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assistant","filament","laravel","openai"],"created_at":"2025-03-16T03:15:48.982Z","updated_at":"2025-03-16T03:15:49.555Z","avatar_url":"https://github.com/AssistantEngine.png","language":"PHP","funding_links":["https://github.com/sponsors/assistant-engine"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n![Demo Video](media/filament-assistant.gif)\n\n\u003c/div\u003e\n\n# Filament Assistant\n\n**Free \u0026 Open Source Version**  \n*For more features and a cloud-based assistant experience, check out [Assistant Engine](https://assistant-engine.com/).*\n\n**Filament Assistant** is an AI-powered plugin that seamlessly integrates conversational capabilities into your Laravel Filament projects. Developed by [Assistant Engine](https://assistant-engine.com/), it provides a feature-rich chat sidebar, intelligent context resolution, and effortless integration with popular tools like **Slack**, **Trello**, **Notion**, **Jira Service Desk**, **Bitbucket**, and **GitHub**.\n\n## Key Features:\n- ✅ **Multiple Assistants** – Create AI assistants for different use cases.\n- ✅ **Tool Calls** – Let your assistant execute actions, retrieve data and integrate with external tools.\n- ✅ **Context Awareness** – Pass relevant page data for smarter responses.\n- ✅ **Easy Setup** – Configurable \u0026 ready to go in minutes.\n- ✅ **Privacy First** – Runs entirely locally, ensuring full control over your data.\n- ✅ **Flexible AI Integration** – Works with OpenAI \u0026 any LLM using the same API format.\n\n## Requirements\n\n- **PHP**: 8.2 or higher\n- **Composer**\n- **Filament**: (See [Filament Installation Guide](https://filamentphp.com/docs/3.x/panels/installation))\n- **Filament Custom Theme**: (See [Installation Guide](https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme))\n- **OpenAI API Key**: (See [OpenAI Documentation](https://platform.openai.com/docs/api-reference/authentication))\n\n## Installation\n\nYou can install Filament Assistant via Composer:\n\n```bash\ncomposer require assistant-engine/filament-assistant\n```\n\nAfter installing the plugin, follow the instructions to create a [custom theme](https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme) and add the following lines to your new theme's `tailwind.config.js`:\n\n```typescript\n// resources/css/filament/admin(theme name)/tailwind.config.js\nexport default {\n    content: [\n        './vendor/assistant-engine/filament-assistant/resources/**/*.blade.php',\n    ]\n};\n```\n\nAs well as enabling the plugin within your panel:\n\n```php\nuse AssistantEngine\\Filament\\FilamentAssistantPlugin;\n\nclass YourPanelProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            -\u003eplugin(FilamentAssistantPlugin::make());\n\n    }\n}\n```\n\nNow add you *OPEN_AI_KEY* to your .env File\n\n```\nOPEN_AI_KEY=your_openai_key\n```\n\nRun the migrations, start a queue worker and building the theme:\n\n```bash\nphp artisan migrate\nphp artisan queue:work\n\nnpm run dev\n```\n\nAfter that you can directly talk to one of the Demo Assistants (eg. Frank) and have a conversation about food delivery :)\n\n![Demo Assistant Example](media/demo-assistant.png)\n\n#### Dark Mode Support\n\nThe `Filament Assistant` also supports dark mode based on the [Tailwind Concept](https://tailwindcss.com/docs/dark-mode).\n\n## Configuration\n\nYou can publish the configuration file using the command below:\n\n```bash\nphp artisan vendor:publish --tag=filament-assistant-config\n```\n\nAfter publishing the configuration, you can find it in `config/assistant-engine.php`:\n\n```php\nreturn [\n    // Set the default chat driver class. You can override this in your local config.\n    'chat_driver' =\u003e \\AssistantEngine\\Filament\\Chat\\Driver\\DefaultChatDriver::class,\n    'conversation_resolver' =\u003e \\AssistantEngine\\Filament\\Chat\\Resolvers\\ConversationOptionResolver::class,\n    'context_resolver' =\u003e \\AssistantEngine\\Filament\\Chat\\Resolvers\\ContextResolver::class,\n    'run_processor' =\u003e \\AssistantEngine\\Filament\\Runs\\Services\\RunProcessorService::class,\n\n    'default_run_queue' =\u003e env('DEFAULT_RUN_QUEUE', 'default'),\n    'default_assistant' =\u003e env('DEFAULT_ASSISTANT_KEY', 'food-delivery'),\n\n    // Assistants configuration: each assistance is identified by a key.\n    // Each assistance has a name, a instruction, and a reference to an LLM connection.\n    'assistants' =\u003e [\n        // Example assistance configuration with key \"default\"\n        'default' =\u003e [\n            'name'              =\u003e 'Genius',\n            'description'       =\u003e 'Your friendly assistant ready to help with any question.',\n            'instruction'       =\u003e 'You are a helpful assistant.',\n            'llm_connection'    =\u003e 'openai', // This should correspond to an entry in the llm_connections section.\n            'model'             =\u003e 'gpt-4o',\n            'registry_meta_mode' =\u003e false, // See meta mode for details\n            // List the tool identifiers to load for this assistant.\n            'tools'             =\u003e ['weather']\n        ],\n        'food-delivery' =\u003e [\n            'name'              =\u003e 'Frank',\n            'description'       =\u003e 'Franks here to help to get you a nice meal',\n            'instruction'       =\u003e 'Your are Frank a funny person who loves to help customers find the right food.',\n            'llm_connection'    =\u003e 'openai', // This should correspond to an entry in the llm_connections section.\n            'model'             =\u003e 'gpt-4o',\n            'registry_meta_mode' =\u003e false,  // See meta mode for details\n            // List the tool identifiers to load for this assistant.\n            'tools'             =\u003e ['pizza', 'burger']\n        ],\n    ],\n\n    // LLM Connections configuration: each connection is identified by an identifier.\n    // Each connection must include an URL and an API key.\n    'llm_connections' =\u003e [\n        // Example LLM connection configuration with identifier \"openai\"\n        'openai' =\u003e [\n            'url'     =\u003e 'https://api.openai.com/v1/',\n            'api_key' =\u003e env('OPEN_AI_KEY'),\n        ]\n    ],\n\n    // Registry configuration, learn more about the registry in the Core Repository (https://github.com/AssistantEngine/open-functions-core)\n    'registry' =\u003e [\n        'description' =\u003e 'Registry where you can control active functions.',\n        'presenter'   =\u003e function($registry) {\n            // This closure receives the open function registry as a parameter.\n            // You can customize how the registry is \"presented\" here.\n            return new \\AssistantEngine\\OpenFunctions\\Core\\Presenter\\RegistryPresenter($registry);\n        },\n    ],\n\n    // Tools configuration: each tool is identified by a key.\n    'tools' =\u003e [\n        'weather' =\u003e [\n            'namespace'   =\u003e 'weather',\n            'description' =\u003e 'Function to get informations about the weather.',\n            'tool'        =\u003e function () {\n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\WeatherOpenFunction();\n            },\n        ],\n        'pizza' =\u003e [\n            'namespace'   =\u003e 'pizza',\n            'description' =\u003e 'This is a nice pizza place',\n            'tool'        =\u003e function () {\n                $pizza = [\n                    'Margherita',\n                    'Pepperoni',\n                    'Hawaiian',\n                    'Veggie',\n                    'BBQ Chicken',\n                    'Meat Lovers'\n                ];\n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\DeliveryOpenFunction($pizza);\n            },\n        ],\n        'burger' =\u003e [\n            'namespace'   =\u003e 'burger',\n            'description' =\u003e 'This is a nice burger place',\n            'tool'        =\u003e function () {\n\n                $burgers = [\n                    'Classic Burger',\n                    'Cheese Burger',\n                    'Bacon Burger',\n                    'Veggie Burger',\n                    'Double Burger'\n                ];\n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\DeliveryOpenFunction($burgers);\n            },\n        ],\n    ],\n\n    'button' =\u003e [\n        'show' =\u003e true,\n        'options' =\u003e [\n            'label' =\u003e 'Food Delivery',\n            'size' =\u003e \\Filament\\Support\\Enums\\ActionSize::ExtraLarge,\n            'color' =\u003e \\Filament\\Support\\Colors\\Color::Sky,\n            'icon' =\u003e 'heroicon-o-chat-bubble-bottom-center-text'\n        ]\n    ],\n\n    // Sidebar configuration\n    'sidebar' =\u003e [\n        // Whether the sidebar is enabled\n        'enabled' =\u003e true,\n        // If set to true, the sidebar will be open by default on load.\n        // Using 'open_by_default' instead of 'auto_visible'\n        'open_by_default' =\u003e false,\n        // The width of the sidebar, defined as a CSS dimension.\n        // must be an integer\n        'width' =\u003e 400,\n    ],\n];\n\n```\n\nIf you need runtime information during tool calling you can also inject the active run into the closure and then you have access to the actual thread and user identifier.\n\n```php\n    'tools' =\u003e [\n        'weather' =\u003e [\n            'namespace'   =\u003e 'weather',\n            'description' =\u003e 'Function to get informations about the weather.',\n            'tool'        =\u003e function (\\AssistantEngine\\Filament\\Runs\\Models\\Run $run) {\n                // Now you can access:\n                // $thread = $run-\u003ethread;\n                // $userIdentifier = $thread-\u003euser_identifier;\n                \n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\WeatherOpenFunction();\n            },\n        ]\n    ]\n```\n\nIf you want to add a presenter to your tool you can do it by defining the *presenter* key to the tool configuration. The presenter is an optional callable that returns an instance implementing the **MessageListExtensionInterface**. Learn more about *Extensions* in the **[Core Repository](https://github.com/AssistantEngine/open-functions-core?tab=readme-ov-file#message-list-extensions)**.\n\n```php\n    'tools' =\u003e [\n        'weather' =\u003e [\n            'namespace'   =\u003e 'weather',\n            'description' =\u003e 'Function to get information about the weather.',\n            'tool'        =\u003e function () {\n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\WeatherOpenFunction();\n            },\n            'presenter'   =\u003e function (\\AssistantEngine\\Filament\\Runs\\Models\\Run $run) {\n                // Return an instance that implements MessageListExtensionInterface, if needed.             \n                return new \\AssistantEngine\\OpenFunctions\\Core\\Examples\\WeatherMessageListExtension();\n            },\n        ]\n    ]\n```\n\nFeel free to change the assistants, add new tools and also update the other configuration parameters as needed.\n\n## Tool Calling\n\nIf you want your assistant to access your application, all you need to do is implement the *AbstractOpenFunction* to create a new Tool and add it to your configuration file. Please read also the **[Open Function Repository](https://github.com/AssistantEngine/open-functions-core?tab=readme-ov-file#function-calling)** to learn more about Open Functions.\n\nAn example implementation could be:\n\n```php\nuse AssistantEngine\\OpenFunctions\\Core\\Contracts\\AbstractOpenFunction;\nuse AssistantEngine\\OpenFunctions\\Core\\Models\\Responses\\TextResponseItem;\nuse AssistantEngine\\OpenFunctions\\Core\\Helpers\\FunctionDefinition;\nuse AssistantEngine\\OpenFunctions\\Core\\Helpers\\Parameter;\n\nclass HelloWorldOpenFunction extends AbstractOpenFunction\n{\n    /**\n     * Generate function definitions.\n     *\n     * This method returns a schema that defines the \"helloWorld\" function.\n     */\n    public function generateFunctionDefinitions(): array\n    {\n        // Create a new function definition for helloWorld.\n        $functionDef = new FunctionDefinition(\n            'helloWorld',\n            'Returns a friendly greeting.'\n        );\n\n        // In this simple example, no parameters are required.\n        // If parameters were needed, you could add them like this:\n        // $functionDef-\u003eaddParameter(Parameter::string(\"name\")\n        //     -\u003edescription(\"Optional name to greet\")\n        //     -\u003erequired());\n        \n        // Return the function schema as an array.\n        return [$functionDef-\u003ecreateFunctionDescription()];\n    }\n\n    /**\n     * The actual implementation of the function.\n     *\n     * @return TextResponseItem A text response containing the greeting.\n     */\n    public function helloWorld()\n    {\n        return new TextResponseItem(\"Hello, world!\");\n    }\n}\n```\n\n#### Meta Mode\n\nEnable **MetaMode** in the assistant configuration to expose only the meta registry functions, letting the assistant dynamically activate or deactivate additional functions as needed—ideal for when too many functions may overwhelm an LLM call. For more details, see the **[Open Functions Core](https://github.com/AssistantEngine/open-functions-core?tab=readme-ov-file#meta-mode)** repository.\n\n### Available Open Function Implementations\n\nIn addition to creating your own Open Functions, there are several ready-to-use implementations available to extend your assistant’s capabilities. Simply add the corresponding tool configuration in your config/filament-assistant.php file to integrate them. Here’s a quick overview:\n\n- **[Memory](https://github.com/AssistantEngine/open-functions-memory)**:  Provides a standardized API for storing, updating, retrieving, and removing conversational memories.\n- **[Notion](https://github.com/AssistantEngine/open-functions-notion)**: Connects to your Notion workspace and enables functionalities such as listing databases, retrieving pages, and managing content blocks.\n- **[GitHub](https://github.com/AssistantEngine/open-functions-github)**: Integrates with GitHub to allow repository operations like listing branches, reading files, and committing changes.\n- **[Bitbucket](https://github.com/AssistantEngine/open-functions-bitbucket)**: Provides an interface similar to GitHub’s, enabling you to interact with Bitbucket repositories to list files, read file contents, and commit modifications.\n- **[Trello](https://github.com/AssistantEngine/open-functions-trello)**: Enables interactions with Trello boards, lists, and cards, facilitating project management directly within your assistant.\n- **[Slack](https://github.com/AssistantEngine/open-functions-slack)**: Seamlessly connects your assistant to Slack and perform actions like listing channels, posting messages, replying to threads, adding reactions, and retrieving channel history and user profiles.\n- **[Jira Service Desk](https://github.com/AssistantEngine/open-functions-jira-service-desk)**: Integrates with Jira Service Desk to interact with service requests—enabling you to create, update, and manage requests (cards), list queues, add comments, transition statuses, and manage priorities.\n\n## Resolvers\n\n### Conversation Option Resolver\n\nThe **Conversation Option Resolver** is used to determine which conversation option should be used when initializing the assistant. It allows you to implement custom logic based on the current page or other factors to control whether an assistant should be displayed and how it should behave.\n\nYou can create a custom conversation option resolver by implementing the `ConversationOptionResolverInterface`. This gives you complete control over the behavior, including the ability to determine whether to return a conversation option or not. If you return `null`, no conversation or assistant will be shown on the page.\n\nExample of the built-in Conversation Option Resolver:\n\n```php\nnamespace AssistantEngine\\Filament\\Chat\\Resolvers;\n\nuse AssistantEngine\\Filament\\Chat\\Contracts\\ConversationOptionResolverInterface;\nuse AssistantEngine\\Filament\\Chat\\Models\\ConversationOption;\nuse Filament\\Pages\\Page;\nuse Illuminate\\Support\\Facades\\Config;\n\nclass ConversationOptionResolver implements ConversationOptionResolverInterface\n{\n    public function resolve(Page $page): ?ConversationOption\n    {\n        $assistantKey = Config::get('filament-assistant.default_assistant');\n\n        if (!$assistantKey) {\n            throw new \\Exception('assistant-key must be set');\n        }\n\n        if (!auth()-\u003echeck()) {\n            return null;\n        }\n\n        return new ConversationOption($assistantKey, auth()-\u003euser()-\u003eid);\n    }\n}\n```\n\nYou can also customize the resolver logic to adapt to different pages or user roles, providing a tailored conversational experience by extending the built-in ConversationOptionResolver or implement the interface on your own.\n\n### ConversationOption Object\n\nThe `ConversationOption` object allows you to configure how a conversation is created or retrieved. The available fields include:\n\n```php\nnamespace AssistantEngine\\Filament\\Chat\\Models\\ConversationOption;\n\n// Create a new ConversationOption\n$options = new ConversationOption($assistantKey, $userId);\n\n// arbitrary data you want to pass to the llm\n$options-\u003eadditionalRunData = [\n    'your_context' =\u003e 'data'\n]; // default []\n\n// add additional tools for the assistant independent of the configuration\n$options-\u003eadditionalTools = ['weather']; // default []\n\n// arbitrary data without any function\n$options-\u003emetadata = ['foo' =\u003e 'bar']; // default [] \n\n// if true the next time the conversation is recreated\n$options-\u003erecreate = false; // default false\n```\n\n- **assistantKey** (required): Unique key identifying the assistant.\n- **userId** (required): ID of the user associated with the conversation, allowing multiple users to have different conversations with the same assistant.\n- **additionalRunData** (optional): Arbitrary data to provide context to the conversation. This context is included with the conversation data sent to the LLM.\n- **metadata** (optional): Data intended for the front-end or client application, allowing additional operations based on its content.\n- **recreate** (optional): If set to true, recreates the conversation, deactivating the previous one.\n\n\u003e Note: The Filament Assistant will attempt to locate an existing conversation based on the combination of `assistantKey`, `userId`. If a match is found, that conversation will be retrieved; otherwise, a new one will be created.\n\n### Context Resolver\n\nThe **Context Resolver** is responsible for resolving context models that are visible on the page and providing them to the assistant. This helps the assistant understand the context of the current page and allows it to access relevant information during the conversation.\n\n![Custom Pages Example](media/context-resolver-2.png)\n\nThe default **Context Resolver** (`ContextResolver`) tries to collect models related to the page, such as records or list items, and injects them into the context of the `ConversationOption` object.\n\nExample of a Context Resolver:\n\n```php\n\u003c?php\n\nnamespace AssistantEngine\\Filament\\Chat\\Resolvers;\n\nuse AssistantEngine\\Filament\\Chat\\Contracts\\ContextModelInterface;\nuse AssistantEngine\\Filament\\Chat\\Contracts\\ContextResolverInterface;\nuse Filament\\Pages\\Page;\nuse Filament\\Resources\\Pages\\ListRecords;\nuse Filament\\Resources\\Pages\\ManageRelatedRecords;\nuse Filament\\Resources\\RelationManagers\\RelationManager;\n\nclass ContextResolver implements ContextResolverInterface\n{\n    public function resolve(Page $page): array\n    {\n        $result = [];\n\n        // Collect models directly related to the page's record\n        if (isset($page-\u003erecord)) {\n            $this-\u003ecollectFromRecord($result, $page-\u003erecord);\n        }\n\n        // Collect models for ListRecords page\n        if ($page instanceof ListRecords) {\n            $this-\u003ecollectFromListRecordsPage($result, $page);\n        }\n\n        // Collect models for ManageRelatedRecords page\n        if ($page instanceof ManageRelatedRecords) {\n            $this-\u003ecollectFromManageRelatedRecordsPage($result, $page);\n        }\n\n        // Collect models from relation managers\n        if (method_exists($page, \"getRelationManagers\") \u0026\u0026 !empty($page-\u003egetRelationManagers())) {\n            $this-\u003ecollectFromRelationManagers($result, $page);\n        }\n\n        return $this-\u003eresolveCollectedModels($result);\n    }\n}\n```\n\nThe **Context Resolver** automatically gathers information about the page and its related models, enabling the assistant to leverage this information during a conversation.\n\n### Custom Context Resolvers\n\nSometimes you have pages which are fully custom, and where the standard Context Resolver doesn't get all the models visible to the customer. In this case, you can either implement your own Context Resolver based on the interface, or you can extend it, like in the example below, to add more context. You can extend the Context Resolver and, based on different pages, inject other contexts, like models or the description of the page, to give the LLM even more context about what the user is seeing right now.\n\nExample of a Custom Context Resolver:\n\n```php\n\u003c?php\n\nnamespace App\\Modules\\Assistant\\Resolvers;\n\nuse App\\Filament\\Resources\\ProductResource\\Pages\\Ideas\\IdeaPlanner;\nuse App\\Modules\\Product\\Models\\ProductGoal;\nuse App\\Modules\\Product\\Models\\ProductIdea;\nuse Filament\\Pages\\Page;\n\nclass ContextResolver extends AssistantEngine\\Filament\\Chat\\Resolvers\\ContextResolver\n{\n    public function resolve(Page $page): array\n    {\n        $context = parent::resolve($page);\n\n        return match (get_class($page)) {\n            IdeaPlanner::class =\u003e $this-\u003ehandleIdeaPlannerPage($page, $context),\n            default =\u003e $context\n        };\n    }\n\n    protected function handleIdeaPlannerPage(IdeaPlanner $page, array $context): array\n    {\n        $context['pageDescription'] = \"This page shows a matrix where product goals are the rows and the roadmap phases (now, next, later)\"\n        . \" are the columns. The user can drag and drop the product ideas between different phases and product goals\"\n        . \" The Ideas you find in the context which don't belong to a goal are unassigned\";\n\n        $context = array_merge_recursive($context, $this-\u003eresolveModels(ProductGoal::class, $page-\u003egoals-\u003eall()));\n\n        return array_merge_recursive($context, $this-\u003eresolveModels(ProductIdea::class, $page-\u003eideas-\u003eall()));\n    }\n}\n```\n\n### Custom Model Serialization\n\nThe standard resolving mechanism for models is to transform them to arrays. But sometimes you want to have a different model serialization. Maybe you want to hide properties or give the LLM a little bit more context regarding the models it sees. Therefore, another interface exists called **Context Model Interface**, which defines a static function `resolveModels` that you can implement and use to resolve a list of models of the same type.\n\n\n```php\n\u003c?php\n\nnamespace AssistantEngine\\Filament\\Chat\\Contracts;\n\ninterface ContextModelInterface\n{\n    public static function resolveModels(array $models): array;\n}\n\n```\n\nThere is also a trait implementing this interface called **Context Model**, where you can group models from the same class inside a data object and provide the LLM with metadata as well as exclude properties from the model itself. This ensures that sensitive data is not sent to the LLM directly, but you can adjust it to your needs.\n\n```php\n\u003c?php\n\nnamespace AssistantEngine\\Filament\\Chat\\Traits;\n\nuse AssistantEngine\\Filament\\Chat\\Resolvers\\ContextModelResolver;\n\ntrait ContextModel\n{\n    public static function getContextMetaData(): array\n    {\n        return [\n            'schema' =\u003e self::class\n        ];\n    }\n\n    public static function getContextExcludes(): array\n    {\n        return [];\n    }\n\n    public static function resolveModels(array $models): array\n    {\n        $result = [];\n        $result['data'] = null;\n\n        if (count($models) \u003e 0) {\n            $result['data'] = ContextModelResolver::collection($models)-\u003eresolve();\n        }\n\n        $result['meta'] = self::getContextMetaData();\n\n        return $result;\n    }\n}\n```\n\nThis Trait you can implement in your Model Classes and overwrite the defined methods if needed:\n\n```php\nnamespace AssistantEngine\\Filament\\Chat\\Contracts\\ContextModelInterface;\n\n#[Schema(\n    schema: \"Product\",\n    properties: [\n        new Property(property: \"id\", type: \"integer\"),\n        new Property(property: \"title\", type: \"string\"),\n        new Property(property: \"description\", type: \"string\"),\n        new Property(property: \"created_at\", type: \"string\", format: \"date-time\"),\n        new Property(property: \"updated_at\", type: \"string\", format: \"date-time\"),\n    ]\n)]\nclass Product extends Model implements ContextModelInterface\n{\n    use ContextModel;\n\n    protected $fillable = ['title', 'description', 'integration_settings', 'assistant_overwrites'];\n\n    public static function getContextExcludes(): array\n    {\n        return ['integration_settings'];\n    }\n\n    public static function getContextMetaData(): array\n    {\n        return ['schema' =\u003e 'Product'];\n    }\n}\n```\n\n## Assistant Chat Page\n\nIn addition to the built-in chat sidebar, you can add a dedicated Assistant Chat Page in your Filament panel. This page allows you to interact with your assistants directly from a full-page interface. To enable this feature, simply add the chat page to your panel provider.\n\nFor example, you can update your panel provider as follows:\n\n```php\nuse AssistantEngine\\Filament\\Chat\\Components\\ChatPage;\nuse AssistantEngine\\Filament\\FilamentAssistantPlugin;\nuse Filament\\Panels\\Panel;\nuse Filament\\Panels\\PanelProvider;\n\nclass YourPanelProvider extends PanelProvider\n{\n    public function panel(Panel $panel): Panel\n    {\n        return $panel\n            -\u003eplugin(FilamentAssistantPlugin::make())\n            // Register the dedicated chat page:\n           -\u003epages([\n                \\AssistantEngine\\Filament\\Chat\\Pages\\AssistantChat::class\n            ])\n    }\n}\n```\n\n![Assistant Chat Example](media/assistant-chat.png)\n\n\n## Events\n\nAfter the message is processed, the page component automatically refreshes so that you can see what the assistant updated for you. If you want, you can also manually listen to the event; just implement a listener on ```ChatComponent::EVENT_RUN_FINISHED``` and then you can process your custom logic.\n\n```php\nuse AssistantEngine\\Filament\\Chat\\Components\\ChatComponent;\n\n#[On(ChatComponent::EVENT_RUN_FINISHED)]\npublic function onRunFinished($messages)\n{\n    // Handle run finished event\n}\n```\n\n## More Repositories\n\nWe’ve created more repositories to make AI integration even simpler and more powerful! Check them out:\n\n- **[Open Functions Core](https://github.com/AssistantEngine/open-functions-core)**: Powerful primitives that simplify LLM calling.\n- **[Open Functions Actions](https://github.com/AssistantEngine/open-functions-actions)**: Serializes OpenFunctions into ChatGPT actions.\n\nReady-to-use **OpenFunctions** implementations:\n- **[Memory](https://github.com/AssistantEngine/open-functions-memory)**:  Provides a standardized API for storing, updating, retrieving, and removing conversational memories.\n- **[Notion](https://github.com/AssistantEngine/open-functions-notion)**: Connects to your Notion workspace and enables functionalities such as listing databases, retrieving pages, and managing content blocks.\n- **[GitHub](https://github.com/AssistantEngine/open-functions-github)**: Integrates with GitHub to allow repository operations like listing branches, reading files, and committing changes.\n- **[Bitbucket](https://github.com/AssistantEngine/open-functions-bitbucket)**: Provides an interface similar to GitHub’s, enabling you to interact with Bitbucket repositories to list files, read file contents, and commit modifications.\n- **[Trello](https://github.com/AssistantEngine/open-functions-trello)**: Enables interactions with Trello boards, lists, and cards, facilitating project management directly within your assistant.\n- **[Slack](https://github.com/AssistantEngine/open-functions-slack)**: Seamlessly connects your assistant to Slack and perform actions like listing channels, posting messages, replying to threads, adding reactions, and retrieving channel history and user profiles.\n- **[Jira Service Desk](https://github.com/AssistantEngine/open-functions-jira-service-desk)**: Integrates with Jira Service Desk to interact with service requests—enabling you to create, update, and manage requests (cards), list queues, add comments, transition statuses, and manage priorities.\n\n\u003e 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).\n\n\n## PRO Version\n\nFor users looking for enhanced functionality, the **PRO Version** offers advanced features beyond the standard Filament Assistant capabilities:\n- **Tool Call Confirmations:** Require explicit user confirmation for specific tool calls before they are executed, ensuring an extra layer of safety.\n- **RAG:** Index documents and make them accessible via a dedicated RAG tool.\n- **Conversational Memory Management:** Enhance your assistants with dynamic conversational memory, featuring an intuitive admin panel that lets users view and manage stored memories for improved context awareness and more natural interactions.\n- **Assistant Admin Panel:** Easily configure your assistants and tools.\n- **Monitoring and Analytics:** Benefit from built-in monitoring and analytic capabilities to keep track of performance and usage.\n\nIf you are interested in the **PRO Version** or would like to learn more about its implementation, please contact us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com) for further details and access options.\n\n## Consultancy \u0026 Support\n\nDo you need assistance integrating Filament Assistant into your Laravel Filament application, or help setting it up?  \nWe 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.\n\nReach out to us at [contact@assistant-engine.com](mailto:contact@assistant-engine.com).\n\n## Contributing\n\nWe welcome contributions from the community! Feel free to submit pull requests, open issues, and help us improve the package.\n\n## License\n\nThis project is licensed under the MIT License. Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassistantengine%2Ffilament-assistant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassistantengine%2Ffilament-assistant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassistantengine%2Ffilament-assistant/lists"}