feat: Add OpenAI provider and template

This commit is contained in:
Petr Mironychev
2025-01-17 01:22:12 +01:00
parent 43ac662671
commit 289a19ac1a
6 changed files with 319 additions and 1 deletions

39
templates/OpenAI.hpp Normal file
View File

@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 Petr Mironychev
*
* This file is part of QodeAssist.
*
* QodeAssist is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* QodeAssist is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with QodeAssist. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include <QJsonArray>
#include "llmcore/PromptTemplate.hpp"
namespace QodeAssist::Templates {
class OpenAI : public LLMCore::PromptTemplate
{
public:
LLMCore::TemplateType type() const override { return LLMCore::TemplateType::Chat; }
QString name() const override { return "OpenAI"; }
QString promptTemplate() const override { return {}; }
QStringList stopWords() const override { return QStringList(); }
void prepareRequest(QJsonObject &request, const LLMCore::ContextData &context) const override {}
QString description() const override { return "OpenAI"; }
};
} // namespace QodeAssist::Templates

View File

@ -30,6 +30,7 @@
#include "templates/Llama2.hpp"
#include "templates/Llama3.hpp"
#include "templates/Ollama.hpp"
#include "templates/OpenAI.hpp"
#include "templates/Qwen.hpp"
#include "templates/StarCoder2Fim.hpp"
@ -51,6 +52,7 @@ inline void registerTemplates()
templateManager.registerTemplate<Alpaca>();
templateManager.registerTemplate<Llama2>();
templateManager.registerTemplate<Claude>();
templateManager.registerTemplate<OpenAI>();
}
} // namespace QodeAssist::Templates