PHP code example of kauffinger / livewire-chat-kit
1. Go to this page and download the library: Download kauffinger/livewire-chat-kit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kauffinger / livewire-chat-kit example snippets
// In app/Livewire/Chat.php
// ...
use Prism\Prism\Enums\Provider;
// ...
public function runChatToolLoop(): void
{
$generator = Prism::text()
->using(Provider::Anthropic, 'claude-3-opus-20240229') // Example for Claude
// ->using(Provider::OpenAI, 'gpt-4o-mini') // Default
->withSystemPrompt('You are a helpful assistant.')
->withMessages(collect($this->messages)->map->toPrism()->all())
->asStream();
// ...
}
// ...
// In your Livewire component - using named parameters
$this->dispatch('toast',
variant: 'success',
title: 'Success!',
description: 'Your changes have been saved.',
icon: 'check-circle',
duration: 3000
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.