LLM API Reference
This page documents the LLM API for PromptSite.
promptsite.llm.LLM
Base class for LLM backends.
To add a new LLM backend, you need to implement the run
method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Dict[str, Any]
|
A dictionary of configuration for the LLM backend. |
required |
run(prompt, **kwargs)
Run the LLM with the given prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
The prompt to run the LLM with. |
required |
promptsite.llm.OpenAiLLM
Bases: LLM
LLM backend for OpenAI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Dict[str, Any]
|
A dictionary of configuration for the OpenAI backend. |
required |
run(user_prompt, system_prompt=None, **kwargs)
Run the LLM with the given prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_prompt
|
str
|
The prompt to run the LLM with. |
required |
system_prompt
|
Optional[str]
|
The system prompt to run the LLM with. |
None
|
promptsite.llm.AnthropicLLM
Bases: LLM
LLM backend for Anthropic.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Dict[str, Any]
|
A dictionary of configuration for the Anthropic backend. |
required |
run(user_prompt, system_prompt=None, **kwargs)
Run the LLM with the given prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_prompt
|
str
|
The prompt to run the LLM with. |
required |
system_prompt
|
Optional[str]
|
The system prompt to run the LLM with. |
None
|
promptsite.llm.OllamaLLM
Bases: LLM
LLM backend for Ollama.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
Dict[str, Any]
|
A dictionary of configuration for the Ollama backend. |
required |
run(user_prompt, system_prompt=None, **kwargs)
Run the LLM with the given prompt.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_prompt
|
str
|
The prompt to run the LLM with. |
required |
system_prompt
|
Optional[str]
|
The system prompt to run the LLM with. |
None
|