Skip to contents

Creates a httr2 request object with base URL, headers and endpoint. Used by other functions in the package and not intended to be used directly.

Usage

create_request(endpoint, host = NULL)

Arguments

endpoint

The endpoint to create the request

host

The base URL to use. Default is NULL, which uses http://127.0.0.1:11434

Value

A httr2 request object.

Examples

create_request("/api/tags")
#> <httr2_request>
#> GET http://127.0.0.1:11434/api/tags
#> Headers:
#>content_type: 'application/json'
#>accept: 'application/json'
#>user_agent: 'ollama-r/1.2.1.9000 (x86_64-pc-linux-gnu) R/4.4.1'
#> Body: empty
create_request("/api/chat")
#> <httr2_request>
#> GET http://127.0.0.1:11434/api/chat
#> Headers:
#>content_type: 'application/json'
#>accept: 'application/json'
#>user_agent: 'ollama-r/1.2.1.9000 (x86_64-pc-linux-gnu) R/4.4.1'
#> Body: empty
create_request("/api/embeddings")
#> <httr2_request>
#> GET http://127.0.0.1:11434/api/embeddings
#> Headers:
#>content_type: 'application/json'
#>accept: 'application/json'
#>user_agent: 'ollama-r/1.2.1.9000 (x86_64-pc-linux-gnu) R/4.4.1'
#> Body: empty