Skip to content

Commit 6c1b709

Browse files
committed
feature #348 [Agent] Expose Agent model (VincentLanglet)
This PR was merged into the main branch. Discussion ---------- [Agent] Expose Agent model | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Similar to #344 `@OskarStark` Do you think it could be ok to expose the Agent model ? It would be useful to access data like model name for logging purpose (without the need for reflection class). But I'm dunno if it should be in the AgentInterface, your call. Commits ------- 6eea55d Expose Agent model
2 parents 314b183 + 6eea55d commit 6c1b709

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/agent/src/Agent.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ public function __construct(
5454
$this->outputProcessors = $this->initializeProcessors($outputProcessors, OutputProcessorInterface::class);
5555
}
5656

57+
public function getModel(): Model
58+
{
59+
return $this->model;
60+
}
61+
5762
/**
5863
* @param array<string, mixed> $options
5964
*

src/agent/tests/AgentTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ public function testConstructorThrowsExceptionForInvalidOutputProcessor()
123123
new Agent($platform, $model, [], [$invalidProcessor]);
124124
}
125125

126+
public function testAgentExposesHisModel()
127+
{
128+
$platform = $this->createMock(PlatformInterface::class);
129+
$model = $this->createMock(Model::class);
130+
131+
$agent = new Agent($platform, $model);
132+
133+
$this->assertSame($model, $agent->getModel());
134+
}
135+
126136
public function testCallProcessesInputThroughProcessors()
127137
{
128138
$platform = $this->createMock(PlatformInterface::class);

0 commit comments

Comments
 (0)