From 61c3e72289c3d34d17934fc0ea25fcd13e4c418b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Fri, 8 Aug 2025 00:37:17 -0300 Subject: [PATCH] Added GitHub LLM provider and models. Added new GPT-5 models. --- bin/assets/plugins/aiassistant.json | 83 ++++++++++++++++--- .../plugins/aiassistant/aiassistantplugin.cpp | 15 ++++ .../ecode/plugins/aiassistant/protocol.hpp | 2 + 3 files changed, 89 insertions(+), 11 deletions(-) diff --git a/bin/assets/plugins/aiassistant.json b/bin/assets/plugins/aiassistant.json index 3fb4458a7..aa0d2570c 100644 --- a/bin/assets/plugins/aiassistant.json +++ b/bin/assets/plugins/aiassistant.json @@ -217,10 +217,6 @@ "api_url": "https://api.openai.com/v1/chat/completions", "display_name": "OpenAI", "models": [ - { - "max_tokens": 16385, - "name": "gpt-3.5-turbo" - }, { "max_tokens": 8192, "name": "gpt-4" @@ -241,10 +237,6 @@ "max_tokens": 200000, "name": "o1" }, - { - "max_tokens": 128000, - "name": "o1-preview" - }, { "max_tokens": 128000, "name": "o1-mini" @@ -254,8 +246,7 @@ "name": "o3-mini" }, { - "name": "gpt-4.1-nano", - "cheapest": true + "name": "gpt-4.1-nano" }, { "name": "gpt-4.1-mini" @@ -276,7 +267,14 @@ "name": "o1-pro" }, { - "name": "gpt-4.5-preview" + "name": "gpt-5" + }, + { + "name": "gpt-5-mini" + }, + { + "name": "gpt-5-nano", + "cheapest": true } ], "version": 1 @@ -293,6 +291,69 @@ "name": "grok-3-latest" } ] + }, + "github": { + "api_url": "https://models.github.ai/inference/chat/completions", + "display_name": "GitHub", + "models": [ + { + "name": "openai/gpt-4.1", + "display_name": "GitHub OpenAI GPT-4.1", + "tool_calling": true + }, + { + "name": "openai/gpt-4.1-mini", + "display_name": "GitHub OpenAI GPT-4.1 Mini", + "tool_calling": true + }, + { + "name": "openai/o3", + "display_name": "GitHub OpenAI o3", + "reasoning": true, + "tool_calling": true + }, + { + "name": "openai/o3-mini", + "display_name": "GitHub OpenAI o3 Mini", + "reasoning": true, + "tool_calling": true + }, + { + "name": "openai/o4-mini", + "display_name": "GitHub OpenAI o4 Mini", + "reasoning": true, + "tool_calling": true + }, + { + "name": "deepseek/deepseek-v3-0324", + "display_name": "GitHub DeepSeek V3-0324" + }, + { + "name": "mistral-ai/codestral-2501", + "display_name": "GitHub Mistral Codestral 25.01" + }, + { + "name": "meta/llama-4-scout-17b-16e-instruct", + "display_name": "GitHub Meta Llama 4 Scout 17B", + "reasoning": true, + "tool_calling": true + }, + { + "name": "deepseek/deepseek-r1-0528", + "display_name": "GitHub DeepSeek R1-0528", + "tool_calling": true + }, + { + "name": "xai/grok-3", + "display_name": "GitHub xAI Grok 3", + "reasoning": true + }, + { + "name": "xai/grok-3-mini", + "display_name": "GitHub xAI Grok 3 Mini", + "cheapest": true + } + ] } } } diff --git a/src/tools/ecode/plugins/aiassistant/aiassistantplugin.cpp b/src/tools/ecode/plugins/aiassistant/aiassistantplugin.cpp index 0f2e917a5..972f256ec 100644 --- a/src/tools/ecode/plugins/aiassistant/aiassistantplugin.cpp +++ b/src/tools/ecode/plugins/aiassistant/aiassistantplugin.cpp @@ -87,6 +87,14 @@ static std::map parseLLMProviders( const nlohmann::jso model.cheapest = modelJson.value( "cheapest", false ); } + if ( modelJson.contains( "reasoning" ) ) { + model.reasoning = modelJson.value( "reasoning", false ); + } + + if ( modelJson.contains( "tool_calling" ) ) { + model.toolCalling = modelJson.value( "tool_calling", false ); + } + if ( modelJson.contains( "cache_configuration" ) && !modelJson["cache_configuration"].is_null() ) { const auto& cacheJson = modelJson["cache_configuration"]; @@ -308,6 +316,11 @@ void AIAssistantPlugin::loadAIAssistantConfig( const std::string& path, bool upd mApiKeys["xai"] = config.value( "xai_api_key", "" ); else if ( updateConfigFile ) config["xai_api_key"] = mApiKeys["xai"]; + + if ( config.contains( "github_api_key" ) ) + mApiKeys["github"] = config.value( "github_api_key", "" ); + else if ( updateConfigFile ) + config["github_api_key"] = mApiKeys["github"]; } if ( mKeyBindings.empty() ) { @@ -486,6 +499,8 @@ std::optional AIAssistantPlugin::getApiKeyFromProvider( const std:: ret = apiKey; else ret = getenv( "GROK_API_KEY" ); + } else if ( provider == "github" ) { + ret = getenv( "GITHUB_API_KEY" ); } if ( ret ) return std::string{ ret }; diff --git a/src/tools/ecode/plugins/aiassistant/protocol.hpp b/src/tools/ecode/plugins/aiassistant/protocol.hpp index 8b07313eb..0382f4add 100644 --- a/src/tools/ecode/plugins/aiassistant/protocol.hpp +++ b/src/tools/ecode/plugins/aiassistant/protocol.hpp @@ -23,6 +23,8 @@ struct LLMModel { std::optional cacheConfiguration; bool isEphemeral{ false }; bool cheapest{ false }; + bool reasoning{ false }; + bool toolCalling{ false }; }; struct LLMProvider {