#include "components/optimization_guide/core/model_execution/aqa_response_parser.h"
#include "base/functional/callback.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/types/expected.h"
#include "base/values.h"
#include "components/optimization_guide/core/model_execution/on_device_model_execution_proto_descriptors.h"
#include "components/optimization_guide/core/model_execution/response_parser.h"
#include "components/optimization_guide/proto/features/history_answer.pb.h"
#include "third_party/re2/src/re2/re2.h"
namespace {
auto UnanswerableRegex() { … }
auto IdRegex() { … }
constexpr std::string_view kCitationSuffix = …;
constexpr std::string_view kAnswerPrefix = …;
optimization_guide::AqaResponseParser::Result ParseAqaResponse(
const std::string& redacted_output) { … }
}
namespace optimization_guide {
AqaResponseParser::AqaResponseParser(
const proto::OnDeviceModelExecutionOutputConfig& config)
: … { … }
AqaResponseParser::~AqaResponseParser() = default;
void AqaResponseParser::ParseAsync(const std::string& redacted_output,
ResultCallback result_callback) const { … }
AqaResponseParserFactory::AqaResponseParserFactory() = default;
AqaResponseParserFactory::~AqaResponseParserFactory() = default;
std::unique_ptr<ResponseParser> AqaResponseParserFactory::CreateParser(
const proto::OnDeviceModelExecutionOutputConfig& config) { … }
}