DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
openai_voice_summary.cpp

This example shows how to create a voice summary by chaining an OpenAI summarizer and a text-to-speech model.

#include "docwire.h"
#include <fstream>
int main(int argc, char* argv[])
{
using namespace docwire;
try
{
std::filesystem::path("1.doc") | content_type::detector{} | office_formats_parser{} | plain_text_exporter() | openai::summarize(environment::get("OPENAI_API_KEY").value()) | openai::text_to_speech(environment::get("OPENAI_API_KEY").value()) | std::ofstream("summary.mp3");
}
catch (const std::exception& e)
{
std::cerr << errors::diagnostic_message(e) << std::endl;
return 1;
}
return 0;
}
DOCWIRE_CORE_EXPORT std::string diagnostic_message(const std::exception &e)
Generates a diagnostic message for the given nested exceptions chain.
std::variant< std::nullptr_t, bool, std::int64_t, std::uint64_t, double, std::string, array, object > value
A variant type representing any serialized value.
The main namespace for the DocWire SDK.
Definition: ai_elements.h:19