Skip to content

Commit b446155

Browse files
committed
fix info output on used models
1 parent 8c08cb3 commit b446155

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Model/AbstractModel.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ abstract class AbstractModel implements ModelInterface
2121
{
2222
/** @var string The model name */
2323
protected $modelName;
24+
/** @var string The full model name */
25+
protected $modelFullName;
2426
/** @var array The model info from the model.json file */
2527
protected $modelInfo;
2628

@@ -65,6 +67,8 @@ public function __construct(string $name, array $config)
6567
throw new \Exception('Failed to parse model info file: ' . $e->getMessage(), $e->getCode(), $e);
6668
}
6769

70+
$this->modelFullName = basename(dirname($reflect->getFileName()) . ' ' . $name);
71+
6872
if ($this instanceof ChatInterface) {
6973
if (!isset($modelinfos['chat'][$name])) {
7074
throw new \Exception('Invalid chat model configured: ' . $name);
@@ -80,6 +84,13 @@ public function __construct(string $name, array $config)
8084
}
8185
}
8286

87+
/** @inheritdoc */
88+
public function __toString(): string
89+
{
90+
return $this->modelFullName;
91+
}
92+
93+
8394
/** @inheritdoc */
8495
public function getModelName()
8596
{

Model/ModelInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ interface ModelInterface
1818
*/
1919
public function __construct(string $name, array $config);
2020

21+
/**
22+
* Get the full model name as used in the configuration
23+
*/
24+
public function __toString(): string;
25+
2126
/**
2227
* The name as used by the LLM provider
2328
*

cli.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ protected function main(Options $options)
133133
protected function showinfo()
134134
{
135135
$stats = [
136-
'chat model' => $this->getConf('chatmodel'),
137-
'embed model' => $this->getConf('embedmodel'),
136+
'embed model' => (string) $this->helper->getEmbeddingModel(),
137+
'rephrase model' => (string) $this->helper->getRephraseModel(),
138+
'chat model' => (string) $this->helper->getChatModel(),
138139
];
139140
$stats = array_merge(
140141
$stats,

0 commit comments

Comments
 (0)