Skip to content

Commit bb498d7

Browse files
committed
refactor(sdk): remove dead license_key / validation subsystem
GENIEX_VALIDATION is never defined by any build file, so the entire license-validation path was compiled out. No plugin implements is_validation_needed, so the create()/create_impl() split existed only to host the dead dispatch. Delete validation.h, IValidatable.h, the license_id/license_key fields on the create-input structs, the LICENSE_INVALID/EXPIRED error codes, and the Python-binding mirrors; collapse create()/create_impl() back into a single create() per modality. Signed-off-by: Mengsheng Wu <mengshengwu@outlook.com>
1 parent 857d511 commit bb498d7

18 files changed

Lines changed: 16 additions & 849 deletions

File tree

bindings/python/geniex/_ffi/_types.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ class geniex_LlmCreateInput(Structure):
146146
('config', geniex_ModelConfig),
147147
('plugin_id', c_char_p),
148148
('device_id', c_char_p),
149-
('license_id', c_char_p),
150-
('license_key', c_char_p),
151149
]
152150

153151

@@ -228,8 +226,6 @@ class geniex_VlmCreateInput(Structure):
228226
('plugin_id', c_char_p),
229227
('device_id', c_char_p),
230228
('tokenizer_path', c_char_p),
231-
('license_id', c_char_p),
232-
('license_key', c_char_p),
233229
]
234230

235231

bindings/python/geniex/auto.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,6 @@ def _create_vlm_handle(
313313
plugin_id: str | None,
314314
device_id: str | None,
315315
config: geniex_ModelConfig,
316-
license_id: str | None,
317-
license_key: str | None,
318316
meta: dict | None = None,
319317
) -> GenieXVLM:
320318
inp = geniex_VlmCreateInput(
@@ -330,10 +328,6 @@ def _create_vlm_handle(
330328
inp.plugin_id = plugin_id.encode()
331329
if device_id:
332330
inp.device_id = device_id.encode()
333-
if license_id:
334-
inp.license_id = license_id.encode()
335-
if license_key:
336-
inp.license_key = license_key.encode()
337331

338332
handle = c_void_p()
339333
lib = load_library()
@@ -356,8 +350,6 @@ def from_pretrained(
356350
n_gpu_layers: int = -1,
357351
mmproj_path: str | None = None,
358352
tokenizer_path: str | None = None,
359-
license_id: str | None = None,
360-
license_key: str | None = None,
361353
hf_token: str | None = None,
362354
progress: ProgressCallback | bool | None = None,
363355
**kwargs,
@@ -407,8 +399,6 @@ def from_pretrained(
407399
plugin_id,
408400
device_id,
409401
config,
410-
license_id,
411-
license_key,
412402
meta=meta,
413403
)
414404

@@ -423,10 +413,6 @@ def from_pretrained(
423413
inp.plugin_id = plugin_id.encode()
424414
if device_id:
425415
inp.device_id = device_id.encode()
426-
if license_id:
427-
inp.license_id = license_id.encode()
428-
if license_key:
429-
inp.license_key = license_key.encode()
430416

431417
handle = c_void_p()
432418
lib = load_library()
@@ -449,8 +435,6 @@ def from_pretrained(
449435
n_gpu_layers: int = -1,
450436
mmproj_path: str | None = None,
451437
tokenizer_path: str | None = None,
452-
license_id: str | None = None,
453-
license_key: str | None = None,
454438
hf_token: str | None = None,
455439
progress: ProgressCallback | bool | None = None,
456440
**kwargs,
@@ -495,7 +479,5 @@ def from_pretrained(
495479
plugin_id,
496480
device_id,
497481
config,
498-
license_id,
499-
license_key,
500482
meta=meta,
501483
)

sdk/include/geniex.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ typedef enum {
6767
GENIEX_ERROR_COMMON_PLUGIN_LOAD = -100301, /**< Plugin loading failed */
6868
GENIEX_ERROR_COMMON_PLUGIN_INVALID = -100302, /**< Invalid plugin */
6969

70-
GENIEX_ERROR_COMMON_LICENSE_INVALID = -100601, /**< Invalid license */
71-
GENIEX_ERROR_COMMON_LICENSE_EXPIRED = -100602, /**< License expired */
72-
7370
/* ===== LLM ERRORS (200xxx) ===== */
7471

7572
GENIEX_ERROR_LLM_TOKENIZATION_FAILED = -200001, /**< Tokenization failed */
@@ -438,9 +435,6 @@ typedef struct {
438435
geniex_ModelConfig config; /** Model configuration */
439436
geniex_PluginId plugin_id; /** plugin to use for the model */
440437
const char* device_id; /** device to use for the model, NULL for default device */
441-
const char* license_id; /** licence id for loading NPU models, must be provided upon the first use of the license
442-
key. null terminated string */
443-
const char* license_key; /** licence key for loading NPU models, null terminated string */
444438
} geniex_LlmCreateInput;
445439

446440
/**
@@ -639,9 +633,6 @@ typedef struct {
639633
geniex_PluginId plugin_id; /** Plugin to use for the model */
640634
const char* device_id; /** device to use for the model */
641635
geniex_Path tokenizer_path; /** Path to the tokenizer file */
642-
const char* license_id; /** licence id for loading NPU models, must be provided upon the first use of the license
643-
key. null terminated string */
644-
const char* license_key; /** licence key for loading NPU models, null terminated string */
645636
} geniex_VlmCreateInput;
646637

647638
/**

sdk/include/logging.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,16 +342,14 @@ struct fmt::formatter<geniex_VlmCreateInput> {
342342
auto format(const geniex_VlmCreateInput& p, fmt::format_context& ctx) const {
343343
return fmt::format_to(ctx.out(),
344344
"VlmCreateInput(model_name: {}, model_path: {}, mmproj_path: {}, config: {}, plugin_id: {}, device_id: {}, "
345-
"tokenizer_path: {}, license_id: {}, license_key: {})",
345+
"tokenizer_path: {})",
346346
lp(p.model_name),
347347
lp(p.model_path),
348348
lp(p.mmproj_path),
349349
lp(p.config),
350350
lp(p.plugin_id),
351351
lp(p.device_id),
352-
lp(p.tokenizer_path),
353-
lp(p.license_id),
354-
lp(p.license_key));
352+
lp(p.tokenizer_path));
355353
}
356354
};
357355

sdk/include/plugin/ILlm.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#pragma once
55

6-
#include "IValidatable.h"
76
#include "geniex.h"
87

98
namespace geniex {
@@ -13,27 +12,11 @@ class ILlm {
1312
virtual ~ILlm() = default;
1413

1514
/**
16-
* @brief Create the LLM model with optional validation
15+
* @brief Create and initialize the LLM model
1716
* @param input The creation input parameters
1817
* @return ML error code (GENIEX_SUCCESS on success, negative on failure)
1918
*/
20-
virtual int32_t create(const geniex_LlmCreateInput* input) {
21-
// Check if this instance implements IValidatable
22-
auto* validatable = dynamic_cast<IValidatable<geniex_LlmCreateInput>*>(this);
23-
if (validatable) {
24-
// Check if validation is needed
25-
if (validatable->is_validation_needed(input)) {
26-
// Perform validation
27-
int32_t validation_result = validatable->validate(input);
28-
if (validation_result != GENIEX_SUCCESS) {
29-
return validation_result;
30-
}
31-
}
32-
}
33-
34-
// Call the actual implementation
35-
return create_impl(input);
36-
}
19+
virtual int32_t create(const geniex_LlmCreateInput* input) = 0;
3720

3821
virtual int32_t reset() = 0;
3922

@@ -52,14 +35,6 @@ class ILlm {
5235
* information keep building. Plugins able to report it MUST override.
5336
*/
5437
virtual int32_t get_model_info(geniex_LlmModelInfo*) { return GENIEX_ERROR_COMMON_PARAM_NOT_SUPPORTED; }
55-
56-
protected:
57-
/**
58-
* @brief Pure virtual method for actual model creation implementation
59-
* @param input The creation input parameters
60-
* @return ML error code (GENIEX_SUCCESS on success, negative on failure)
61-
*/
62-
virtual int32_t create_impl(const geniex_LlmCreateInput* input) = 0;
6338
};
6439

6540
} // namespace geniex

sdk/include/plugin/IValidatable.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

sdk/include/plugin/IVlm.h

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#pragma once
55

6-
#include "IValidatable.h"
76
#include "geniex.h"
87

98
namespace geniex {
@@ -13,27 +12,11 @@ class IVlm {
1312
virtual ~IVlm() = default;
1413

1514
/**
16-
* @brief Create the VLM model with optional validation
15+
* @brief Create and initialize the VLM model
1716
* @param input The creation input parameters
1817
* @return ML error code (GENIEX_SUCCESS on success, negative on failure)
1918
*/
20-
virtual int32_t create(const geniex_VlmCreateInput* input) {
21-
// Check if this instance implements IValidatable
22-
auto* validatable = dynamic_cast<IValidatable<geniex_VlmCreateInput>*>(this);
23-
if (validatable) {
24-
// Check if validation is needed
25-
if (validatable->is_validation_needed(input)) {
26-
// Perform validation
27-
int32_t validation_result = validatable->validate(input);
28-
if (validation_result != GENIEX_SUCCESS) {
29-
return validation_result;
30-
}
31-
}
32-
}
33-
34-
// Call the actual implementation
35-
return create_impl(input);
36-
}
19+
virtual int32_t create(const geniex_VlmCreateInput* input) = 0;
3720

3821
virtual int32_t reset() = 0;
3922

@@ -48,14 +31,6 @@ class IVlm {
4831
output->supports_audio = false;
4932
return GENIEX_SUCCESS;
5033
}
51-
52-
protected:
53-
/**
54-
* @brief Pure virtual method for actual model creation implementation
55-
* @param input The creation input parameters
56-
* @return ML error code (GENIEX_SUCCESS on success, negative on failure)
57-
*/
58-
virtual int32_t create_impl(const geniex_VlmCreateInput* input) = 0;
5934
};
6035

6136
} // namespace geniex

0 commit comments

Comments
 (0)