AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
InvokeAgentHandler.h
1
6#pragma once
7#include <aws/core/utils/HashingUtils.h>
8#include <aws/core/utils/event/EventStreamHandler.h>
9#include <aws/core/client/AWSError.h>
10#include <aws/bedrock-agent-runtime/BedrockAgentRuntime_EXPORTS.h>
11#include <aws/bedrock-agent-runtime/BedrockAgentRuntimeErrors.h>
12
13#include <aws/bedrock-agent-runtime/model/InvokeAgentInitialResponse.h>
14#include <aws/bedrock-agent-runtime/model/PayloadPart.h>
15#include <aws/bedrock-agent-runtime/model/FilePart.h>
16#include <aws/bedrock-agent-runtime/model/ReturnControlPayload.h>
17#include <aws/bedrock-agent-runtime/model/TracePart.h>
18
19namespace Aws
20{
21namespace BedrockAgentRuntime
22{
23namespace Model
24{
26 {
28 CHUNK,
29 FILES,
31 TRACE,
33 };
34
36 {
37 typedef std::function<void(const InvokeAgentInitialResponse&)> InvokeAgentInitialResponseCallback;
38 typedef std::function<void(const InvokeAgentInitialResponse&, const Utils::Event::InitialResponseType)> InvokeAgentInitialResponseCallbackEx;
39 typedef std::function<void(const PayloadPart&)> PayloadPartCallback;
40 typedef std::function<void(const FilePart&)> FilePartCallback;
41 typedef std::function<void(const ReturnControlPayload&)> ReturnControlPayloadCallback;
42 typedef std::function<void(const TracePart&)> TracePartCallback;
43 typedef std::function<void(const Aws::Client::AWSError<BedrockAgentRuntimeErrors>& error)> ErrorCallback;
44
45 public:
46 AWS_BEDROCKAGENTRUNTIME_API InvokeAgentHandler();
47 AWS_BEDROCKAGENTRUNTIME_API InvokeAgentHandler& operator=(const InvokeAgentHandler&) = default;
48
49 AWS_BEDROCKAGENTRUNTIME_API virtual void OnEvent() override;
50
52
58 inline void SetInitialResponseCallbackEx(const InvokeAgentInitialResponseCallbackEx& callback) { m_onInitialResponse = callback; }
62 inline void SetInitialResponseCallback(const InvokeAgentInitialResponseCallback& noArgCallback)
63 {
64 m_onInitialResponse = [noArgCallback](const InvokeAgentInitialResponse& rs, const Utils::Event::InitialResponseType) { return noArgCallback(rs); };
65 }
67 inline void SetPayloadPartCallback(const PayloadPartCallback& callback) { m_onPayloadPart = callback; }
68 inline void SetFilePartCallback(const FilePartCallback& callback) { m_onFilePart = callback; }
69 inline void SetReturnControlPayloadCallback(const ReturnControlPayloadCallback& callback) { m_onReturnControlPayload = callback; }
70 inline void SetTracePartCallback(const TracePartCallback& callback) { m_onTracePart = callback; }
71 inline void SetOnErrorCallback(const ErrorCallback& callback) { m_onError = callback; }
72
73 inline InvokeAgentInitialResponseCallbackEx& GetInitialResponseCallbackEx() { return m_onInitialResponse; }
74
75 private:
76 AWS_BEDROCKAGENTRUNTIME_API void HandleEventInMessage();
77 AWS_BEDROCKAGENTRUNTIME_API void HandleErrorInMessage();
78 AWS_BEDROCKAGENTRUNTIME_API void MarshallError(const Aws::String& errorCode, const Aws::String& errorMessage);
79
80 InvokeAgentInitialResponseCallbackEx m_onInitialResponse;
81 PayloadPartCallback m_onPayloadPart;
82 FilePartCallback m_onFilePart;
83 ReturnControlPayloadCallback m_onReturnControlPayload;
84 TracePartCallback m_onTracePart;
85 ErrorCallback m_onError;
86 };
87
88namespace InvokeAgentEventMapper
89{
90 AWS_BEDROCKAGENTRUNTIME_API InvokeAgentEventType GetInvokeAgentEventTypeForName(const Aws::String& name);
91
93} // namespace InvokeAgentEventMapper
94} // namespace Model
95} // namespace BedrockAgentRuntime
96} // namespace Aws
virtual AWS_BEDROCKAGENTRUNTIME_API void OnEvent() override
AWS_BEDROCKAGENTRUNTIME_API InvokeAgentHandler & operator=(const InvokeAgentHandler &)=default
void SetPayloadPartCallback(const PayloadPartCallback &callback)
void SetReturnControlPayloadCallback(const ReturnControlPayloadCallback &callback)
void SetFilePartCallback(const FilePartCallback &callback)
void SetOnErrorCallback(const ErrorCallback &callback)
InvokeAgentInitialResponseCallbackEx & GetInitialResponseCallbackEx()
void SetTracePartCallback(const TracePartCallback &callback)
void SetInitialResponseCallbackEx(const InvokeAgentInitialResponseCallbackEx &callback)
AWS_BEDROCKAGENTRUNTIME_API InvokeAgentHandler()
void SetInitialResponseCallback(const InvokeAgentInitialResponseCallback &noArgCallback)
AWS_BEDROCKAGENTRUNTIME_API InvokeAgentEventType GetInvokeAgentEventTypeForName(const Aws::String &name)
AWS_BEDROCKAGENTRUNTIME_API Aws::String GetNameForInvokeAgentEventType(InvokeAgentEventType value)
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String