lispm-llm / native-api /include /lispm_llm.h
Ryan.K
Add reusable Emacs retraining workflow and C FFI API
2109241 unverified
Raw History Blame Contribute Delete
1.2 kB
/* LispM LLM training workflow C ABI. SPDX-License-Identifier: AGPL-3.0-only */
#ifndef LISPM_LLM_H
#define LISPM_LLM_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Returns 1 for this ABI. JSON operation documentation: docs/training-workflow.md. */
uint32_t lispm_llm_abi_version(void);
/* Read a UTF-8 NUL-terminated request, return an owned JSON response.
* Input remains caller-owned and is never retained. Non-null input must remain
* readable through its terminating NUL for this call. Null is an invalid request.
* Long operations return a numeric job immediately; poll/cancel/release using JSON.
* Calls are thread-safe. At most 128 unreleased jobs are retained per library.
* Keep this library loaded for the process lifetime. Releasing a job is not
* a thread join, and does not make dlclose safe. Load either this standalone
* library or the Emacs module in a host, not both copies of the runtime.
*/
char *lispm_llm_request(const char *input);
/* Free a response from this library exactly once; NULL is allowed.
* Do not pass libc-owned, modified, or already-freed pointers.
*/
void lispm_llm_string_free(char *response);
#ifdef __cplusplus
}
#endif
#endif