![]() |
Llama.prgLlama.prg is a Harbour API for popular projects llama.cpp and whisper.cpp, which allows the use of local LLM (Large Language Models) and speech into text conversion (STT) directly from Harbour programs. |
|
Features
- Launching local LLM models in gguf format (support llama.cpp )
- Transcription of audio into text (support whisper.cpp )
- A simple API for integration into Harbour applications
- Cross-platform (Windows, Linux)
What is it for?
- Embedding AI capabilities in classic xBase applications
- Creation of chatbots, voice assistants and analytical tools
- Experimenting with local language models without switching to Python/C++
Usage example
The following is the simplest example: load the model, initialize the context, ask a question, and receive an answer token by token.
Function Main()
LOCAL cModel := "/ai/models/Qwen3-8B-Q6_K.gguf"
LOCAL cQue, cAns, cAnswer
? cModel, "Loading..."
IF llm_Open_Model( cModel ) == 0
IF llm_Create_Context() == 0
ACCEPT "Your question:" TO cQue
?
llm_Ask( cQue )
cAnswer := ""
DO WHILE ( cAns := llm_GetNextToken() ) != Nil
IF !Empty( cAns )
cAnswer += cAns
?? cAns
ENDIF
ENDDO
llm_Close_Context()
ENDIF
llm_Close_Model()
ENDIF
RETURN Nil
Documentation
Detailed instructions and code examples are available in project repositories.
The length of a comment - no more than 4000 characters.
Your name:
Email address:
(not be shown publicly)
Input text from an image:
Your name:
Email address:
(not be shown publicly)
|   |
