-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Drupal\llm_services\Model; | ||
|
||
class ChatMessage { | ||
|
||
/** | ||
* The role of this message. | ||
* | ||
* @var \Drupal\llm_services\Model\MessageRoles | ||
*/ | ||
public MessageRoles $role; | ||
|
||
/** | ||
* The message content. | ||
* | ||
* @var string | ||
*/ | ||
public string $content; | ||
|
||
/** | ||
* Images base64 encoded. | ||
* | ||
* Used for multimodal models such as llava. Which can describe the content of | ||
* the image. | ||
* | ||
* @var array<string> | ||
*/ | ||
public array $images; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace Drupal\llm_services\Model; | ||
|
||
class Message { | ||
|
||
/** | ||
* Name of the model to use. | ||
* | ||
* @var string | ||
*/ | ||
public string $model; | ||
|
||
/** | ||
* Message(s) to send | ||
* | ||
* @see https://github.com/ollama/ollama/blob/main/docs/api.md#parameters-1 | ||
* | ||
* @var array<\Drupal\llm_services\Model\ChatMessage> | ||
*/ | ||
public array $messages; | ||
|
||
/** | ||
* Additional model parameters. | ||
* | ||
* @see https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values | ||
* | ||
* @var array<string, string> | ||
*/ | ||
public array $options; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Drupal\llm_services\Model; | ||
|
||
enum MessageRoles: string { | ||
case Assistant = 'assistant'; | ||
case System = "system"; | ||
case User = 'user'; | ||
} |