diff options
Diffstat (limited to 'src/providers/openAI.cpp')
| -rw-r--r-- | src/providers/openAI.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/providers/openAI.cpp b/src/providers/openAI.cpp index d1495dc..6c60541 100644 --- a/src/providers/openAI.cpp +++ b/src/providers/openAI.cpp @@ -26,7 +26,7 @@ static bool _openAI_batch_query_with_file(const char** queries, size_t query_count, char* file_id, invoice* buffer, importer::batch_query_response_handler response_handler) { - const char *api_key = administration::get_ai_service().api_key_public; + const char *api_key = administration::get_active_ai_service().api_key_public; httplib::SSLClient cli("api.openai.com", 443); thrd_t threads[20]; @@ -50,7 +50,7 @@ static bool _openAI_batch_query_with_file(const char** queries, size_t query_cou " }" "], " " \"text\": { \"format\": { \"type\": \"json_object\" } } " - "}", administration::get_ai_service().model_name, file_id, query_escaped); + "}", administration::get_active_ai_service().model_name, file_id, query_escaped); httplib::Headers headers; headers.insert(std::make_pair("Authorization", std::string("Bearer ") + api_key)); @@ -96,7 +96,7 @@ static bool _openAI_batch_query_with_file(const char** queries, size_t query_cou static bool _openAI_query_with_file(const char* query, size_t query_length, char* file_id, char** response) { - const char *api_key = administration::get_ai_service().api_key_public; + const char *api_key = administration::get_active_ai_service().api_key_public; httplib::SSLClient cli("api.openai.com", 443); //cli.enable_server_certificate_verification(false); @@ -108,7 +108,7 @@ static bool _openAI_query_with_file(const char* query, size_t query_length, char char* body = (char*)memops::alloc(body_size); strops::format(body, body_size, "{\"model\":\"%s\", \"input\": [ { \"role\": \"user\", \"content\": [ { \"type\": \"input_file\", \"file_id\": \"%s\" }, " - "{ \"type\": \"input_text\", \"text\": \"%s\" } ] } ] }", administration::get_ai_service().model_name, file_id, query_escaped); + "{ \"type\": \"input_text\", \"text\": \"%s\" } ] } ] }", administration::get_active_ai_service().model_name, file_id, query_escaped); httplib::Headers headers; headers.insert(std::make_pair("Authorization", std::string("Bearer ") + api_key)); @@ -135,7 +135,7 @@ static bool _openAI_query_with_file(const char* query, size_t query_length, char static bool _openAI_upload_file(char* file_path, char* file_id, size_t file_id_len) { - const char *api_key = administration::get_ai_service().api_key_public; + const char *api_key = administration::get_active_ai_service().api_key_public; const char *filename = strops::get_filename(file_path); FILE* orig_file = fopen(file_path, "rb"); @@ -237,7 +237,7 @@ static bool _openAI_upload_file(char* file_path, char* file_id, size_t file_id_l static bool _openAI_get_available_models(importer::model_list_request* buffer) { - const char *api_key = administration::get_ai_service().api_key_public; + const char *api_key = administration::get_active_ai_service().api_key_public; httplib::SSLClient cli("api.openai.com", 443); @@ -273,4 +273,22 @@ importer::ai_provider_impl _chatgpt_api_provider = { _openAI_query_with_file, _openAI_batch_query_with_file, _openAI_get_available_models, +}; + +importer::ai_provider_impl _gemini_api_provider = { + "Gemini", + "", + 0, + 0, + 0, + 0, +}; + +importer::ai_provider_impl _perplexity_api_provider = { + "Perplexity", + "", + 0, + 0, + 0, + 0, };
\ No newline at end of file |
