From a8799cfee2de8ac53cc07c571c56ae5d9c98cbbd Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Fri, 17 Oct 2025 19:02:21 +0200 Subject: model selection for ai service --- include/administration.hpp | 1 + include/file_templates.hpp | 1 + include/importer.hpp | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/administration.hpp b/include/administration.hpp index c046dba..5053d7e 100644 --- a/include/administration.hpp +++ b/include/administration.hpp @@ -381,6 +381,7 @@ typedef enum typedef struct { ai_provider provider; + char model_name[MAX_LEN_SHORT_DESC]; char api_key_public[MAX_LEN_API_KEY]; } ai_service; diff --git a/include/file_templates.hpp b/include/file_templates.hpp index 506df67..b4a4a07 100644 --- a/include/file_templates.hpp +++ b/include/file_templates.hpp @@ -68,6 +68,7 @@ namespace file_template { " \n" " {{AI_SERVICE_PROVIDER}}\n" " {{AI_SERVICE_PUBLIC_KEY}}\n" + " {{AI_SERVICE_MODEL}}\n" " \n" ""; diff --git a/include/importer.hpp b/include/importer.hpp index cb24cf8..e206204 100644 --- a/include/importer.hpp +++ b/include/importer.hpp @@ -18,10 +18,13 @@ #include "administration.hpp" +#define MAX_MODEL_LIST_RESULT_COUNT 50 + #define I_ERR_SUCCESS 0 #define I_ERR_FAILED_UPLOAD 1 #define I_ERR_FAILED_QUERY 2 #define I_ERR_FAILED_IMPORT 3 +#define I_ERR_UNIMPLEMENTED 4 typedef uint32_t i_err; @@ -46,16 +49,29 @@ namespace importer { status status; } invoice_request; + typedef struct + { + time_t started_at; + i_err error; + status status; + u32 result_count; + char result[MAX_MODEL_LIST_RESULT_COUNT][MAX_LEN_SHORT_DESC]; + ai_provider service; + } model_list_request; + typedef struct { char* provider_name; + char* default_model; bool (*upload_file)(char* file_path, char* file_id, size_t file_id_len); bool (*query_with_file)(char* query, size_t query_length, char* file_id, char** response); + bool (*get_available_models)(model_list_request* buffer); } ai_provider_impl; const char* error_to_string(i_err error); const char* status_to_string(status status); - invoice_request* ai_document_to_invoice(char* file_path); ai_provider_impl get_ai_provider_implementation(ai_provider provider); + invoice_request* ai_document_to_invoice(char* file_path); + model_list_request* ai_get_available_models(ai_provider service); } \ No newline at end of file -- cgit v1.2.3-70-g09d2