Download the PHP package paparascaldev/sidekick without Composer
On this page you can find all versions of the php package paparascaldev/sidekick. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paparascaldev/sidekick
More information about paparascaldev/sidekick
Files in paparascaldev/sidekick
Package sidekick
Short Description Laravel's AI sidekick, work with various AI services with a uniformed syntax
License GPL-2.0-or-later
Informations about the package sidekick
Sidekick for LaravelSay hello to Sidekick! A Laravel plugin that provides a common syntax for using Claude, Mistral, Cohere and OpenAi APIs. |
|
Description
This project provides a unified wrapper around the OpenAI, Claude, Cohere and Mistral APIs for Laravel. The goal is to simplify switching between different AI models and APIs, making it as seamless as possible.
https://github.com/user-attachments/assets/4a3afa1a-0130-4c6c-bf1e-54dbe51117e4
Installation Guide
The easiest way to install the package in your laravel app is to run the following command from within your projects directory:
Other Methods
If you would like to install a specific version you can manually update your composer.json
file under require
section like so:
You can also use @dev
tag.
After you have updated the file run:
Configuring the .env
Once Sidekick is installed you need to update your .env
file with your access tokens.
You only need to specify the token for the provider(s) you will use.
Where can I get an API key?
If you are not yet signed up with any of the AI providers, here are some links to help:
- https://platform.openai.com (Open Ai)
- https://console.anthropic.com (Claude)
- https://console.mistral.ai (Mistral)
- https://dashboard.cohere.com (Cohere)
Running Migrations
Run your migrations using the command below:
The Sidekick Playground
After the .env
is updated you can start testing the plugin. I have added some routes with example calls for you to try out or learn from.
You can also publish these to your routes
and views
directory to directly modify with the following commands:
To access the playground head to:
Documentation
For the documentation we will be using the OpenAi model as it supports all endpoints, where Claude and Mistral are supported you can just hot-swap OpenAi when initialising the Sidekick/SidekickConversation
class.
Sidekick Conversations
This allows you to create a chatbot that remembers previos interactions.
To start a new conversation:
This will create a new conversation in the Database
and make the call to the AI for a response.
An example of the formatted response can be found below:
Once you have this response, to continue the conversation you can write the following in your controller making sure to pass the conversation_id
in the request:
An example of the formatted response can be found below:
Managing Sidekick Conversations
There is very basic functionality to list, show and delete conversations. This will be updated in the near future.
However, currently you do this by calling an instance of SidekickChatManager
. Examples of each are below:
Completion
Embedding
Image (Image From Text)
Audio (Text To Speech)
Transcription (Speech To Text)
Example Response
Moderation
This is a service where you feed it text from a comment for example and it will return with an array of boolean values for certain moderation points.
Example Response
[!NOTE]
Quick note on error handling. Currently, if there is an error it is printed as the AI responds. I will be updating this over the next few days to be uniformed so that all errors are presented in tha same way regardless of AI driver/model
Ways to Contribute
I want this composer package for Laravel to be as useful as possible, so with that in mind here are the ways you can contribute:
- Submitting a Pull Request (if your a dev and want to help with this project)
- Raise issues to Github
- Submit ideas/feedback to [email protected]
- Star this repository (if you feel inclined)
Testing Information
I have tested the package using the following models: