4 LLM Backends
| (require llm/base) | package: llm-lib | 
Internal tools for developing new backends.
procedure
(base-send-prompt! uri headers json cost-base-info inference-cost-maker) → void? uri : string? headers : headers/c json : jsexpr? cost-base-info : model-cost-info? inference-cost-maker : (-> response? inference-cost-info?) 
The wrapper records some debug and cost logging information. inference-cost-maker receives the response, and should build an inference-cost-info for use in the cost-log-entry for this prompt.
procedure
(cached-send-prompt! uri headers json cost-base-info inference-cost-maker prompt-key) → void? uri : string? headers : headers/c json : jsexpr? cost-base-info : model-cost-info? inference-cost-maker : (-> response? inference-cost-info?) prompt-key : string? 
4.1 OpenAI
Some OpenAI models are supported in the collection llm/openai. Not much of the API is supported at this time.
| (require llm/openai/config) | package: llm-lib | 
parameter
(OPENAI_API_KEY key) → void? key : string? 
= (getenv "OPENAI_API_KEY") 
4.1.1 GPT 3.5 Turbo
| (require llm/openai/gpt3-5) | package: llm-lib | 
Sets the current-send-prompt! to gpt3-5-send-prompt! when visited.
procedure
(gpt3-5-send-prompt! prompt) → string?
prompt : string? 
4.1.2 GPT 4o Mini
| (require llm/openai/gpt4o-mini) | package: llm-lib | 
Sets the current-send-prompt! to gpt4o-mini-send-prompt! when visited.
procedure
(gpt4-add-image! type base64-data) → void?
type : (or/c 'png 'jpeg) base64-data : string? 
Images can make prompts very expensive.
procedure
(gpt4o-mini-send-prompt! prompt) → string?
prompt : string? 
4.2 Ollama
Some Ollama is a platform for distributing, building, and running models locally, and several are supported in the collection llm/ollama.
It’s API is documented at https://github.com/ollama/ollama/blob/main/docs/api.md Not much of the API is supported at this time.
4.2.1 Phi3
| (require llm/ollama/phi3) | package: llm-lib | 
Sets the current-send-prompt! to phi3-send-prompt! when visited.
procedure
(phi3-send-prompt! prompt) → string?
prompt : string? 
4.2.2 Llava
| (require llm/ollama/llava) | package: llm-lib | 
Sets the current-send-prompt! to llava-send-prompt! when visited.
procedure
(llava-add-image! base64-data) → void?
base64-data : string? 
procedure
(llava-send-prompt! prompt) → string?
prompt : string?