ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
vlm_protocol.hpp File Reference
#include <nlohmann/json.hpp>
#include <optional>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for vlm_protocol.hpp:

Go to the source code of this file.

Classes

struct  reusex::vision::VlmResult
 The description + arbitrary attributes a vision-language model returned for one crop. More...

Namespaces

namespace  reusex
namespace  reusex::vision
namespace  reusex::vision::detail

Functions

nlohmann::json reusex::vision::build_chat_request_json (const std::string &model, const std::string &b64_jpeg, const std::string &prompt)
 Build an OpenAI-compatible chat/completions request body for one image.
std::string reusex::vision::detail::strip_json_fence (std::string s)
 Strip a leading/trailing markdown json ... fence if present, and trim surrounding whitespace.
bool reusex::vision::detail::is_chat_envelope (const nlohmann::json &body)
 Whether a parsed body is an OpenAI-/Ollama-style chat envelope, i.e.
std::string reusex::vision::detail::extract_message_content (const nlohmann::json &body)
 Pull the assistant message text out of an OpenAI-style chat response.
std::optional< std::string > reusex::vision::detail::scalar_to_string (const nlohmann::json &v)
 Stringify a JSON scalar (string / number / bool).
bool reusex::vision::detail::is_description_key (const std::string &k)
 True for any of the keys treated as the free-text description slot.
VlmResult reusex::vision::parse_vlm_response (const std::string &body)
 Parse an OpenAI-compatible chat/completions response into a VlmResult.