#include "components/history_embeddings/ml_answerer.h"
#include "base/barrier_callback.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/stringprintf.h"
#include "components/history_embeddings/history_embeddings_features.h"
#include "components/optimization_guide/core/optimization_guide_model_executor.h"
#include "components/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/proto/features/history_answer.pb.h"
namespace history_embeddings {
ModelExecutionError;
Session;
OptimizationGuideModelExecutionError;
OptimizationGuideModelStreamingExecutionResult;
Answer;
HistoryAnswerRequest;
Passage;
namespace {
static constexpr std::string kPassageIdToken = …;
std::string GetPassageIdStr(size_t id) { … }
float GetMlAnswerScoreThreshold() { … }
void AddQueryAndPassagesToSession(const std::string& query,
const std::vector<std::string>& passages,
Session* session) { … }
}
class MlAnswerer::SessionManager { … };
MlAnswerer::MlAnswerer(OptimizationGuideModelExecutor* model_executor)
: … { … }
MlAnswerer::~MlAnswerer() = default;
void MlAnswerer::ComputeAnswer(std::string query,
Context context,
ComputeAnswerCallback callback) { … }
}