generated

package
v1.2.1-4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Go bindings for rkllm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RKLLMInput_GetPrompt

func RKLLMInput_GetPrompt(in []RKLLMInput) string

RKLLMInput_GetPrompt function as declared in include/rkllm_input_wrappers.h:6

func RKLLMInput_SetEmbed

func RKLLMInput_SetEmbed(in []RKLLMInput, e RKLLMEmbedInput)

RKLLMInput_SetEmbed function as declared in include/rkllm_input_wrappers.h:16

func RKLLMInput_SetMultimodal

func RKLLMInput_SetMultimodal(in []RKLLMInput, m RKLLMMultiModelInput)

RKLLMInput_SetMultimodal function as declared in include/rkllm_input_wrappers.h:30

func RKLLMInput_SetPrompt

func RKLLMInput_SetPrompt(in *RKLLMInput, s string)

RKLLMInput_SetPrompt function as declared in include/rkllm_input_wrappers.h:9

func RKLLMInput_SetToken

func RKLLMInput_SetToken(in *RKLLMInput, t RKLLMTokenInput)

RKLLMInput_SetToken function as declared in include/rkllm_input_wrappers.h:23

func Rkllm_abort

func Rkllm_abort(handle *LLMHandle) int32

Rkllm_abort function as declared in include/rkllm.h:286

func Rkllm_clear_kv_cache

func Rkllm_clear_kv_cache(handle *LLMHandle, keep_system_prompt int32) int32

Rkllm_clear_kv_cache function as declared in include/rkllm.h:301

func Rkllm_destroy

func Rkllm_destroy(handle *LLMHandle) int32

Rkllm_destroy function as declared in include/rkllm.h:259

func Rkllm_init

func Rkllm_init(handle **LLMHandle, param *RKLLMParam, callback LLMResultCallback) int32

Rkllm_init function as declared in include/rkllm.h:229

func Rkllm_is_running

func Rkllm_is_running(handle *LLMHandle) int32

Rkllm_is_running function as declared in include/rkllm.h:293

func Rkllm_load_lora

func Rkllm_load_lora(handle *LLMHandle, lora_adapter []RKLLMLoraAdapter) int32

Rkllm_load_lora function as declared in include/rkllm.h:237

func Rkllm_load_prompt_cache

func Rkllm_load_prompt_cache(handle *LLMHandle, prompt_cache_path string) int32

Rkllm_load_prompt_cache function as declared in include/rkllm.h:245

func Rkllm_release_prompt_cache

func Rkllm_release_prompt_cache(handle *LLMHandle) int32

Rkllm_release_prompt_cache function as declared in include/rkllm.h:252

func Rkllm_run

func Rkllm_run(handle *LLMHandle, rkllm_input *RKLLMInput, rkllm_infer_params *RKLLMInferParam, userdata unsafe.Pointer) int32

Rkllm_run function as declared in include/rkllm.h:269

func Rkllm_run_async

func Rkllm_run_async(handle *LLMHandle, rkllm_input []RKLLMInput, rkllm_infer_params []RKLLMInferParam, userdata unsafe.Pointer) int32

Rkllm_run_async function as declared in include/rkllm.h:279

func Rkllm_set_chat_template

func Rkllm_set_chat_template(handle *LLMHandle, system_prompt string, prompt_prefix string, prompt_postfix string) int32

Rkllm_set_chat_template function as declared in include/rkllm.h:317

Types

type LLMCallState

type LLMCallState int32

LLMCallState as declared in include/rkllm.h:32

const (
	RKLLM_RUN_NORMAL  LLMCallState = iota
	RKLLM_RUN_WAITING LLMCallState = 1
	RKLLM_RUN_FINISH  LLMCallState = 2
	RKLLM_RUN_ERROR   LLMCallState = 3
)

LLMCallState enumeration from include/rkllm.h:32

type LLMHandle

type LLMHandle unsafe.Pointer

LLMHandle type as declared in include/rkllm.h:21

type LLMResultCallback

type LLMResultCallback func(result *RKLLMResult, userdata unsafe.Pointer, state LLMCallState)

LLMResultCallback type as declared in include/rkllm.h:214

func NewLLMResultCallbackRef

func NewLLMResultCallbackRef(ref unsafe.Pointer) *LLMResultCallback

func (LLMResultCallback) PassRef

func (x LLMResultCallback) PassRef() (ref *C.LLMResultCallback, allocs *cgoAllocMap)

func (LLMResultCallback) PassValue

func (x LLMResultCallback) PassValue() (ref C.LLMResultCallback, allocs *cgoAllocMap)

type RKLLMEmbedInput

type RKLLMEmbedInput struct {
	Embed    []float32
	N_tokens uint64
	// contains filtered or unexported fields
}

RKLLMEmbedInput as declared in include/rkllm.h:110

func NewRKLLMEmbedInputRef

func NewRKLLMEmbedInputRef(ref unsafe.Pointer) *RKLLMEmbedInput

NewRKLLMEmbedInputRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func RKLLMInput_GetEmbed

func RKLLMInput_GetEmbed(in []RKLLMInput) RKLLMEmbedInput

RKLLMInput_GetEmbed function as declared in include/rkllm_input_wrappers.h:13

func (*RKLLMEmbedInput) Deref

func (x *RKLLMEmbedInput) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMEmbedInput) Free

func (x *RKLLMEmbedInput) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMEmbedInput) PassRef

func (x *RKLLMEmbedInput) PassRef() (*C.RKLLMEmbedInput, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMEmbedInput) PassValue

func (x RKLLMEmbedInput) PassValue() (C.RKLLMEmbedInput, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMEmbedInput) Ref

func (x *RKLLMEmbedInput) Ref() *C.RKLLMEmbedInput

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMExtendParam

type RKLLMExtendParam struct {
	Base_domain_id    int32
	Embed_flash       int8
	Enabled_cpus_num  int8
	Enabled_cpus_mask uint32
	Reserved          [106]byte
	// contains filtered or unexported fields
}

RKLLMExtendParam as declared in include/rkllm.h:65

func NewRKLLMExtendParamRef

func NewRKLLMExtendParamRef(ref unsafe.Pointer) *RKLLMExtendParam

NewRKLLMExtendParamRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMExtendParam) Deref

func (x *RKLLMExtendParam) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMExtendParam) Free

func (x *RKLLMExtendParam) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMExtendParam) PassRef

func (x *RKLLMExtendParam) PassRef() (*C.RKLLMExtendParam, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMExtendParam) PassValue

func (x RKLLMExtendParam) PassValue() (C.RKLLMExtendParam, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMExtendParam) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMInferMode

type RKLLMInferMode int32

RKLLMInferMode as declared in include/rkllm.h:53

const (
	RKLLM_INFER_GENERATE              RKLLMInferMode = iota
	RKLLM_INFER_GET_LAST_HIDDEN_LAYER RKLLMInferMode = 1
	RKLLM_INFER_GET_LOGITS            RKLLMInferMode = 2
)

RKLLMInferMode enumeration from include/rkllm.h:53

type RKLLMInferParam

type RKLLMInferParam struct {
	Mode                RKLLMInferMode
	Lora_params         []RKLLMLoraParam
	Prompt_cache_params []RKLLMPromptCacheParam
	Keep_history        int32
	// contains filtered or unexported fields
}

RKLLMInferParam as declared in include/rkllm.h:174

func NewRKLLMInferParamRef

func NewRKLLMInferParamRef(ref unsafe.Pointer) *RKLLMInferParam

NewRKLLMInferParamRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMInferParam) Deref

func (x *RKLLMInferParam) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMInferParam) Free

func (x *RKLLMInferParam) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMInferParam) PassRef

func (x *RKLLMInferParam) PassRef() (*C.RKLLMInferParam, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMInferParam) PassValue

func (x RKLLMInferParam) PassValue() (C.RKLLMInferParam, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMInferParam) Ref

func (x *RKLLMInferParam) Ref() *C.RKLLMInferParam

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMInput

type RKLLMInput struct {
	Input_type RKLLMInputType
	// contains filtered or unexported fields
}

RKLLMInput as declared in include/rkllm.h:146

func NewRKLLMInputRef

func NewRKLLMInputRef(ref unsafe.Pointer) *RKLLMInput

NewRKLLMInputRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMInput) Deref

func (x *RKLLMInput) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMInput) Free

func (x *RKLLMInput) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMInput) PassRef

func (x *RKLLMInput) PassRef() (*C.RKLLMInput, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMInput) PassValue

func (x RKLLMInput) PassValue() (C.RKLLMInput, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMInput) Ref

func (x *RKLLMInput) Ref() *C.RKLLMInput

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMInputType

type RKLLMInputType int32

RKLLMInputType as declared in include/rkllm.h:43

const (
	RKLLM_INPUT_PROMPT     RKLLMInputType = iota
	RKLLM_INPUT_TOKEN      RKLLMInputType = 1
	RKLLM_INPUT_EMBED      RKLLMInputType = 2
	RKLLM_INPUT_MULTIMODAL RKLLMInputType = 3
)

RKLLMInputType enumeration from include/rkllm.h:43

type RKLLMLoraAdapter

type RKLLMLoraAdapter struct {
	Lora_adapter_path []byte
	Lora_adapter_name []byte
	Scale             float32
	// contains filtered or unexported fields
}

RKLLMLoraAdapter as declared in include/rkllm.h:101

func NewRKLLMLoraAdapterRef

func NewRKLLMLoraAdapterRef(ref unsafe.Pointer) *RKLLMLoraAdapter

NewRKLLMLoraAdapterRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMLoraAdapter) Deref

func (x *RKLLMLoraAdapter) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMLoraAdapter) Free

func (x *RKLLMLoraAdapter) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMLoraAdapter) PassRef

func (x *RKLLMLoraAdapter) PassRef() (*C.RKLLMLoraAdapter, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMLoraAdapter) PassValue

func (x RKLLMLoraAdapter) PassValue() (C.RKLLMLoraAdapter, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMLoraAdapter) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMLoraParam

type RKLLMLoraParam struct {
	Lora_adapter_name []byte
	// contains filtered or unexported fields
}

RKLLMLoraParam as declared in include/rkllm.h:154

func NewRKLLMLoraParamRef

func NewRKLLMLoraParamRef(ref unsafe.Pointer) *RKLLMLoraParam

NewRKLLMLoraParamRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMLoraParam) Deref

func (x *RKLLMLoraParam) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMLoraParam) Free

func (x *RKLLMLoraParam) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMLoraParam) PassRef

func (x *RKLLMLoraParam) PassRef() (*C.RKLLMLoraParam, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMLoraParam) PassValue

func (x RKLLMLoraParam) PassValue() (C.RKLLMLoraParam, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMLoraParam) Ref

func (x *RKLLMLoraParam) Ref() *C.RKLLMLoraParam

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMMultiModelInput

type RKLLMMultiModelInput struct {
	Prompt         []byte
	Image_embed    []float32
	N_image_tokens uint64
	N_image        uint64
	Image_width    uint64
	Image_height   uint64
	// contains filtered or unexported fields
}

RKLLMMultiModelInput as declared in include/rkllm.h:132

func NewRKLLMMultiModelInputRef

func NewRKLLMMultiModelInputRef(ref unsafe.Pointer) *RKLLMMultiModelInput

NewRKLLMMultiModelInputRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func RKLLMInput_GetMultimodal

func RKLLMInput_GetMultimodal(in []RKLLMInput) RKLLMMultiModelInput

RKLLMInput_GetMultimodal function as declared in include/rkllm_input_wrappers.h:27

func (*RKLLMMultiModelInput) Deref

func (x *RKLLMMultiModelInput) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMMultiModelInput) Free

func (x *RKLLMMultiModelInput) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMMultiModelInput) PassRef

func (x *RKLLMMultiModelInput) PassRef() (*C.RKLLMMultiModelInput, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMMultiModelInput) PassValue

func (x RKLLMMultiModelInput) PassValue() (C.RKLLMMultiModelInput, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMMultiModelInput) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMParam

type RKLLMParam struct {
	Model_path         []byte
	Max_context_len    int32
	Max_new_tokens     int32
	Top_k              int32
	N_keep             int32
	Top_p              float32
	Temperature        float32
	Repeat_penalty     float32
	Frequency_penalty  float32
	Presence_penalty   float32
	Mirostat           int32
	Mirostat_tau       float32
	Mirostat_eta       float32
	Skip_special_token bool
	Is_async           bool
	Img_start          []byte
	Img_end            []byte
	Img_content        []byte
	Extend_param       RKLLMExtendParam
	// contains filtered or unexported fields
}

RKLLMParam as declared in include/rkllm.h:91

func NewRKLLMParamRef

func NewRKLLMParamRef(ref unsafe.Pointer) *RKLLMParam

NewRKLLMParamRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func Rkllm_createDefaultParam

func Rkllm_createDefaultParam() RKLLMParam

Rkllm_createDefaultParam function as declared in include/rkllm.h:220

func (*RKLLMParam) Deref

func (x *RKLLMParam) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMParam) Free

func (x *RKLLMParam) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMParam) PassRef

func (x *RKLLMParam) PassRef() (*C.RKLLMParam, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMParam) PassValue

func (x RKLLMParam) PassValue() (C.RKLLMParam, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMParam) Ref

func (x *RKLLMParam) Ref() *C.RKLLMParam

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMPromptCacheParam

type RKLLMPromptCacheParam struct {
	Save_prompt_cache int32
	Prompt_cache_path []byte
	// contains filtered or unexported fields
}

RKLLMPromptCacheParam as declared in include/rkllm.h:163

func NewRKLLMPromptCacheParamRef

func NewRKLLMPromptCacheParamRef(ref unsafe.Pointer) *RKLLMPromptCacheParam

NewRKLLMPromptCacheParamRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMPromptCacheParam) Deref

func (x *RKLLMPromptCacheParam) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMPromptCacheParam) Free

func (x *RKLLMPromptCacheParam) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMPromptCacheParam) PassRef

func (x *RKLLMPromptCacheParam) PassRef() (*C.RKLLMPromptCacheParam, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMPromptCacheParam) PassValue

func (x RKLLMPromptCacheParam) PassValue() (C.RKLLMPromptCacheParam, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMPromptCacheParam) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMResult

type RKLLMResult struct {
	Text              *byte
	Token_id          int32
	Last_hidden_layer RKLLMResultLastHiddenLayer
	Logits            RKLLMResultLogits
	// contains filtered or unexported fields
}

RKLLMResult as declared in include/rkllm.h:205

func NewRKLLMResultRef

func NewRKLLMResultRef(ref unsafe.Pointer) *RKLLMResult

NewRKLLMResultRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMResult) Deref

func (x *RKLLMResult) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMResult) Free

func (x *RKLLMResult) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMResult) PassRef

func (x *RKLLMResult) PassRef() (*C.RKLLMResult, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMResult) PassValue

func (x RKLLMResult) PassValue() (C.RKLLMResult, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMResult) Ref

func (x *RKLLMResult) Ref() *C.RKLLMResult

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMResultLastHiddenLayer

type RKLLMResultLastHiddenLayer struct {
	Hidden_states []float32
	Embd_size     int32
	Num_tokens    int32
	// contains filtered or unexported fields
}

RKLLMResultLastHiddenLayer as declared in include/rkllm.h:184

func NewRKLLMResultLastHiddenLayerRef

func NewRKLLMResultLastHiddenLayerRef(ref unsafe.Pointer) *RKLLMResultLastHiddenLayer

NewRKLLMResultLastHiddenLayerRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMResultLastHiddenLayer) Deref

func (x *RKLLMResultLastHiddenLayer) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMResultLastHiddenLayer) Free

func (x *RKLLMResultLastHiddenLayer) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMResultLastHiddenLayer) PassRef

func (x *RKLLMResultLastHiddenLayer) PassRef() (*C.RKLLMResultLastHiddenLayer, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMResultLastHiddenLayer) PassValue

func (x RKLLMResultLastHiddenLayer) PassValue() (C.RKLLMResultLastHiddenLayer, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMResultLastHiddenLayer) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMResultLogits

type RKLLMResultLogits struct {
	Logits     []float32
	Vocab_size int32
	Num_tokens int32
	// contains filtered or unexported fields
}

RKLLMResultLogits as declared in include/rkllm.h:194

func NewRKLLMResultLogitsRef

func NewRKLLMResultLogitsRef(ref unsafe.Pointer) *RKLLMResultLogits

NewRKLLMResultLogitsRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func (*RKLLMResultLogits) Deref

func (x *RKLLMResultLogits) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMResultLogits) Free

func (x *RKLLMResultLogits) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMResultLogits) PassRef

func (x *RKLLMResultLogits) PassRef() (*C.RKLLMResultLogits, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMResultLogits) PassValue

func (x RKLLMResultLogits) PassValue() (C.RKLLMResultLogits, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMResultLogits) Ref

Ref returns the underlying reference to C object or nil if struct is nil.

type RKLLMTokenInput

type RKLLMTokenInput struct {
	Input_ids []int32
	N_tokens  uint64
	// contains filtered or unexported fields
}

RKLLMTokenInput as declared in include/rkllm.h:119

func NewRKLLMTokenInputRef

func NewRKLLMTokenInputRef(ref unsafe.Pointer) *RKLLMTokenInput

NewRKLLMTokenInputRef creates a new wrapper struct with underlying reference set to the original C object. Returns nil if the provided pointer to C object is nil too.

func RKLLMInput_GetToken

func RKLLMInput_GetToken(in []RKLLMInput) RKLLMTokenInput

RKLLMInput_GetToken function as declared in include/rkllm_input_wrappers.h:20

func (*RKLLMTokenInput) Deref

func (x *RKLLMTokenInput) Deref()

Deref uses the underlying reference to C object and fills the wrapping struct with values. Do not forget to call this method whether you get a struct for C object and want to read its values.

func (*RKLLMTokenInput) Free

func (x *RKLLMTokenInput) Free()

Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. Does nothing if struct is nil or has no allocation map.

func (*RKLLMTokenInput) PassRef

func (x *RKLLMTokenInput) PassRef() (*C.RKLLMTokenInput, *cgoAllocMap)

PassRef returns the underlying C object, otherwise it will allocate one and set its values from this wrapping struct, counting allocations into an allocation map.

func (RKLLMTokenInput) PassValue

func (x RKLLMTokenInput) PassValue() (C.RKLLMTokenInput, *cgoAllocMap)

PassValue does the same as PassRef except that it will try to dereference the returned pointer.

func (*RKLLMTokenInput) Ref

func (x *RKLLMTokenInput) Ref() *C.RKLLMTokenInput

Ref returns the underlying reference to C object or nil if struct is nil.

type RawString

type RawString string

RawString reperesents a string backed by data on the C side.

func (RawString) Copy

func (raw RawString) Copy() string

Copy returns a Go-managed copy of raw string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL