Llama.prg

Llama.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.



Project on gitflic

Demo - Windows
Demo - Debian 12

Stable-diffusion.prg

Features

What is it for?

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.




Comments:       ()       prev.    next.       Add comment
The length of a comment - no more than 4000 characters.
Your name:

Email address:
(not be shown publicly)
 
Input text from an image: