chromium/components/optimization_guide/core/model_execution/aqa_response_parser.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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 {

// Expected model output when the question is unanswerable.
auto UnanswerableRegex() {}

// Regex for a passage ID, capturing ID numbers.
// The IDs should be comma-delimited, but there could be arbitrary whitespaces.
auto IdRegex() {}
// Suffix that comes after a citation of passage IDs.
constexpr std::string_view kCitationSuffix =;
constexpr std::string_view kAnswerPrefix =;

// Parse the given string as an AQA model response, and return the response
// message wrapped in an optimization_guide::proto::Any object. If parsing
// fails, return the corresponding failure enum.
optimization_guide::AqaResponseParser::Result ParseAqaResponse(
    const std::string& redacted_output) {}

}  // namespace

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) {}

}  // namespace optimization_guide