Skip to content

Commit

Permalink
refactor(SK): - Comments and removed responseFormat for now from comp…
Browse files Browse the repository at this point in the history
…letion function
  • Loading branch information
PapaRascal2020 committed Sep 7, 2024
1 parent 48ed5c9 commit 0b63672
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 17 deletions.
5 changes: 3 additions & 2 deletions resources/views/sidekick-examples/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<div class="flex items-start justify-center">
<div class="text-gray-300 w-3/4 text-center">
<h1 class="font-bold text-3xl">Hello!</h1>
<img src="https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3449a7-44de-4ce2-b384-cea763c0901e_500x500.heic" class="pt-20" alt="Sidekick Robot" />

<img src="https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0e3449a7-44de-4ce2-b384-cea763c0901e_500x500.heic"
class="pt-20 m-auto"
alt="Sidekick Robot" />
<p class="pt-20"><strong class="font-bold">Note:</strong> To use this playground you must have configured the .env with your <i>SIDEKICK_OPENAI_TOKEN</i>.</p>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use PapaRascalDev\Sidekick\Drivers\Claude;
use PapaRascalDev\Sidekick\Drivers\Cohere;
use PapaRascalDev\Sidekick\Drivers\Mistral;
use \PapaRascalDev\Sidekick\Sidekick;
use \PapaRascalDev\Sidekick\Drivers\OpenAi;
use PapaRascalDev\Sidekick\SidekickConversation;
Expand Down
17 changes: 13 additions & 4 deletions src/Drivers/Claude.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@

use PapaRascalDev\Sidekick\Features\Completion;

/**
* Supported Models:
*
* - claude-3-opus-20240229
* - claude-3-sonnet-20240229
* - claude-3-haiku-20240307
*
* Supported Methods
* - Completions
*/

class Claude implements Driver
{

/**
* OpenAi Api Base URL
* Api Base URL
* @strind $baseUrl
*/
private string $baseUrl = "https://api.anthropic.com/v1";
Expand Down Expand Up @@ -54,8 +64,7 @@ public function complete(): Completion
'$allMessages ? $allMessages : null',
'["role" => "user", "content" => $message]',
]
],
responseFormat: []
]
);
}

Expand Down
16 changes: 14 additions & 2 deletions src/Drivers/Cohere.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@

use PapaRascalDev\Sidekick\Features\Completion;

/**
* Unlike other AI's passing no model sets a defaults
* to Command-r
*
* Supported Models:
*
*- command-r-08-2024
*- command-r-plus-08-2024
*
* Supported Methods
* - Completions
*/

class Cohere implements Driver
{

Expand Down Expand Up @@ -56,8 +69,7 @@ public function complete(): Completion
requestRules: [
'chat_history' => '$allMessages ? $allMessages : null',
'message' => '$message'
],
responseFormat: []
]
);
}

Expand Down
15 changes: 13 additions & 2 deletions src/Drivers/Mistral.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

use PapaRascalDev\Sidekick\Features\{Completion, Embedding};

/**
* Supported Models:
*
* - claude-3-opus-20240229
* - claude-3-sonnet-20240229
* - claude-3-haiku-20240307
*
* Supported Methods
* - Completions
* - Embed
*/

class Mistral implements Driver
{

Expand Down Expand Up @@ -58,8 +70,7 @@ public function complete(): Completion
'$allMessages ? $allMessages : null',
'["role" => "user", "content" => $message]',
]
],
responseFormat: []
]
);
}

Expand Down
30 changes: 26 additions & 4 deletions src/Drivers/OpenAi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,31 @@
namespace PapaRascalDev\Sidekick\Drivers;

use PapaRascalDev\Sidekick\Features\{Completion, Audio, Transcribe, Image, Embedding, Moderate};
use Illuminate\Config\Repository;
use Illuminate\Foundation\Application;

/**
* Supported Models:
*
*- gpt-3.5-turbo
* - gpt-4
* - tts-1
* - tts-1-hd
* - dall-e-2
* - dall-e-3
* - whisper-1
* - text-embedding-3-small
* - text-embedding-3-large
* - text-embedding-ada-002
* - text-moderation-latest
* - text-moderation-stable
* - text-moderation-007
*
* Supported Methods
* - Completions
* - Embed
* - Audio
* - Transcription
* - Moderate
*/

class OpenAi implements Driver
{
Expand Down Expand Up @@ -81,8 +104,7 @@ public function complete(): Completion
'$allMessages ? $allMessages : null',
'["role" => "user", "content" => $message]',
]
],
responseFormat: []
]
);
}

Expand Down
1 change: 0 additions & 1 deletion src/Features/Completion.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function __construct(
protected string $url,
protected array $headers,
protected $requestRules,
protected $responseFormat,
)
{
}
Expand Down

0 comments on commit 0b63672

Please sign in to comment.