Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ai_agents
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
ai_agents
Merge requests
!107
Resolve
#3522896
"Add event for"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve
#3522896
"Add event for"
issue/ai_agents-3522896:3522896-add-event-for
into
1.1.x
Overview
2
Commits
4
Pipelines
5
Changes
2
All threads resolved!
Show all comments
Merged
Marcus Johansson
requested to merge
issue/ai_agents-3522896:3522896-add-event-for
into
1.1.x
1 month ago
Overview
2
Commits
4
Pipelines
5
Changes
2
All threads resolved!
Show all comments
Expand
Closes
#3522896
0
0
Merge request reports
Compare
1.1.x
version 3
c973420d
1 month ago
version 2
e26517ed
1 month ago
version 1
a72ab4e3
1 month ago
1.1.x (base)
and
latest version
latest version
5a5bc1ee
4 commits,
1 month ago
version 3
c973420d
3 commits,
1 month ago
version 2
e26517ed
2 commits,
1 month ago
version 1
a72ab4e3
1 commit,
1 month ago
2 files
+
178
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/Event/AgentResponseEvent.php
0 → 100644
+
163
−
0
Options
<?php
namespace
Drupal\ai_agents\Event
;
use
Drupal\Component\EventDispatcher\Event
;
use
Drupal\ai_agents
\AiAgentInterface
;
/**
* This can be used to log the responses for each loop.
*/
class
AgentResponseEvent
extends
Event
{
// The event name.
const
EVENT_NAME
=
'ai_agents.response'
;
/**
* The agent.
*
* @var \Drupal\ai_agents\AiAgentInterface
*/
protected
$agent
;
/**
* The system prompt.
*
* @var string
*/
protected
$systemPrompt
;
/**
* The agent id.
*
* @var string
*/
protected
$agentId
;
/**
* The instructions.
*
* @var string
*/
protected
$instructions
;
/**
* The chat history.
*
* @var array
*/
protected
$chatHistory
;
/**
* The response.
*
* @var string
*/
protected
$response
;
/**
* The loop count.
*
* @var int
*/
protected
$loopCount
;
/**
* Constructs the object.
*
* @param \Drupal\ai_agents\AiAgentInterface $agent
* The agent.
* @param string $system_prompt
* The system prompt.
* @param string $agent_id
* The agent id.
* @param string $instructions
* The instructions.
* @param array $chat_history
* The chat messages.
* @param string $response
* The response.
* @param int $loop_count
* The loop count.
*/
public
function
__construct
(
AiAgentInterface
$agent
,
string
$system_prompt
,
string
$agent_id
,
string
$instructions
,
array
$chat_history
,
string
$response
,
int
$loop_count
)
{
$this
->
agent
=
$agent
;
$this
->
systemPrompt
=
$system_prompt
;
$this
->
agentId
=
$agent_id
;
$this
->
instructions
=
$instructions
;
$this
->
chatHistory
=
$chat_history
;
$this
->
response
=
$response
;
$this
->
loopCount
=
$loop_count
;
}
/**
* Gets the agent.
*
* @return \Drupal\ai_agents\AiAgentInterface
* The agent.
*/
public
function
getAgent
():
AiAgentInterface
{
return
$this
->
agent
;
}
/**
* Gets the system prompt.
*
* @return string
* The system prompt.
*/
public
function
getSystemPrompt
():
string
{
return
$this
->
systemPrompt
;
}
/**
* Gets the agent id.
*
* @return string
* The agent id.
*/
public
function
getAgentId
():
string
{
return
$this
->
agentId
;
}
/**
* Gets the instructions.
*
* @return string
* The instructions.
*/
public
function
getInstructions
():
string
{
return
$this
->
instructions
;
}
/**
* Gets the chat history.
*
* @return array
* The chat history.
*/
public
function
getChatHistory
():
array
{
return
$this
->
chatHistory
;
}
/**
* Gets the response.
*
* @return string
* The response.
*/
public
function
getResponse
():
string
{
return
$this
->
response
;
}
/**
* Gets the loop count.
*
* @return int
* The loop count.
*/
public
function
getLoopCount
():
int
{
return
$this
->
loopCount
;
}
}
Loading