This class handles the creation of LLM skeletons
Usage
skellm_skeleton(
url = class_missing,
model = class_missing,
history = class_missing,
stream = class_missing,
api_key = class_missing,
extra = class_missing
)Arguments
- url
The host's URL.
- model
Identifier of the model to be used.
- history
Messages to be included in the request. By default, is an empty
skellm_message_historyS7 object.- stream
Whether or not to stream the incomming response. FALSE by default.
- api_key
(Optional) The API key of the service.
Examples
# For Ollama
skellm_skeleton(
url = "http://localhost:11434/api/chat",
model = "mistral"
)
#> <skellm::skellm_skeleton>
#> @ url : chr "http://localhost:11434/api/chat"
#> @ model : chr "mistral"
#> @ history: <skellm_message_history> list()
#> @ stream : logi FALSE
#> @ api_key: NULL
#> @ extra : list()
# For OpenAI
skellm_skeleton(
url = "https://api.openai.com/v1/chat/completions",
model = "gpt-3.5-turbo",
history = skellm_message_history(
skellm_message(role = "system", content = "You are a helpful assistant"),
skellm_message(role = "user", content = "What is 2 + 2")
),
stream = TRUE,
api_key = "<your_api_key>"
)
#> <skellm::skellm_skeleton>
#> @ url : chr "https://api.openai.com/v1/chat/completions"
#> @ model : chr "gpt-3.5-turbo"
#> @ history: <skellm_message_history> List of 2
#> .. $ : <skellm_message>
#> .. ..@ role : chr "system"
#> .. ..@ content: chr "You are a helpful assistant"
#> .. ..@ name : NULL
#> .. $ : <skellm_message>
#> .. ..@ role : chr "user"
#> .. ..@ content: chr "What is 2 + 2"
#> .. ..@ name : NULL
#> @ stream : logi TRUE
#> @ api_key: chr "<your_api_key>"
#> @ extra : list()