#pragma once // Typed builders for Responses API input items and tools. Shapes follow the // Responses schemas page (InputItem, EasyInputMessage, InputText/Image/File/ // Video content, FunctionCallOutputItemParam, ReasoningItemParam, Tool union). // Anything the docs describe only in prose (custom and namespace tools) is // marked in SPEC "Unverified". #include #include #include "meta/jsonx.h" namespace molo::meta { class ResponseInput { public: // Content parts. static Json text(const std::string& text); static Json image_url(const std::string& url, const std::string& detail = ""); static Json image_file(const std::string& file_id, const std::string& detail = ""); // Bytes become a data: URL; mime must be a documented image type. static Json image_bytes(const std::string& mime, const std::string& bytes); static Json file_id(const std::string& file_id); static Json file_url(const std::string& url); static Json file_data(const std::string& filename, const std::string& mime, const std::string& bytes); static Json video_url(const std::string& url, double fps = 0); static Json video_file(const std::string& file_id, double fps = 0); static Json audio_bytes(const std::string& format, const std::string& bytes); // wav | mp3 // Items. static Json message(const std::string& role, const Json& content_parts, const std::string& phase = ""); static Json user(const std::string& text); static Json developer(const std::string& text); static Json assistant(const std::string& text, const std::string& phase = ""); static Json function_call(const std::string& call_id, const std::string& name, const std::string& arguments_json); static Json function_call_output(const std::string& call_id, const std::string& output); // Stateless reasoning replay: `summary` may be empty, encrypted_content must // be the exact value the previous response returned. static Json reasoning(const std::string& encrypted_content, const std::string& id = "", const std::vector& summary = {}); static Json item_reference(const std::string& id); // Counts input items of an `input` value (string = 1). static std::size_t count(const Json& input); }; class ToolBuilder { public: static Json function(const std::string& name, const std::string& description, const Json& parameters, bool strict = false, bool defer_loading = false); // docs: tool-calling "Custom tools" (prose only, not in the schema union). static Json custom(const std::string& name, const std::string& description, bool strict = false, bool defer_loading = false); static Json web_search(const std::string& search_context_size = "", const Json& user_location = Json(), const Json& filters = Json()); static Json tool_search(const std::string& execution = ""); // server | client static Json computer(); // docs: tool-search "Deferring tools" (prose only). static Json namespace_tool(const std::string& name, const std::string& description, const std::vector& functions); }; } // namespace molo::meta