20#include <unordered_map>
75 const std::string& input,
98 struct RegisteredTool {
99 std::shared_ptr<Tool> implementation;
103 [[nodiscard]] std::vector<ToolExecution>
104 execute_tools(
Session& session,
105 const std::string& run_id,
106 const std::vector<ToolCall>& calls)
const;
108 [[nodiscard]] ToolExecution
110 const std::string& run_id,
113 void validate_input(
const Message& input)
const;
120 std::unordered_map<std::string, RegisteredTool> tools_;
121 std::vector<ToolSpec> tool_specs_;
const ModelDescriptor & model() const noexcept
Returns the immutable model description used by this client.
AIResponse generate(Session &session, const std::string &input, const GenerateOptions &options={})
Convenience overload for text input.
virtual AIResponse generate_once(const AIRequest &request)=0
Performs exactly one provider request without mutating a Session.
AIClient(ModelDescriptor model, const ClientOptions &options={})
Creates a provider client for a model with shared tools, tracing, and transport.
void trace(const TraceEvent &event) const noexcept
Emits a custom event through this client's exception-isolated tracer fan-out.
AIResponse generate(const Message &input, const GenerateOptions &options={})
One-shot convenience overload that uses an internal Session.
AIResponse generate(const std::string &input, const GenerateOptions &options={})
One-shot convenience overload for text input.
Definition client.hpp:128
FunctionAIClient(ModelDescriptor model, Function function, const ClientOptions &options={})
Creates a client that delegates each model round to function.
std::function< AIResponse(const AIRequest &)> Function
Callback signature for one provider-independent model round.
Definition client.hpp:131
A valid conversation message with one normalized role.
Definition types.hpp:208
Definition session.hpp:106
Immutable snapshot passed to one provider round.
Definition types.hpp:372
Normalized response returned by both one provider round and the full tool loop.
Definition types.hpp:393
Dependencies and behavior shared by all AIClient implementations.
Definition client.hpp:25
std::shared_ptr< HttpTransport > transport
Injectable transport; null selects CurlHttpTransport.
Definition client.hpp:33
Tracers tracers
Zero or more tracing/logging destinations.
Definition client.hpp:30
std::size_t max_model_rounds
Hard limit for provider requests in one generation.
Definition client.hpp:36
Tools tools
Immutable set of tools advertised to the configured model.
Definition client.hpp:27
std::size_t max_parallel_tool_calls
Maximum number of tool callbacks executing concurrently.
Definition client.hpp:42
bool stop_on_tool_error
Returns after recording a failed tool batch instead of asking the model again.
Definition client.hpp:48
std::size_t max_tool_calls_per_generation
Maximum tool callbacks allowed across one generate call.
Definition client.hpp:45
bool capture_trace_payloads
Adds prompt/response/tool text to TraceEvent::payload when true.
Definition client.hpp:51
bool parallel_tool_calls
Executes calls from one provider round concurrently when true.
Definition client.hpp:39
Per-call generation settings shared by all providers.
Definition types.hpp:339
Data-driven model description; no C++ subclass is needed per model name.
Definition types.hpp:315
One metadata-first trace record.
Definition tracing.hpp:42
std::vector< std::shared_ptr< Tracer > > Tracers
Shared tracer collection accepted by ClientOptions.
Definition tracing.hpp:215