pepperoni21 / ollama-rs

A Rust library allowing to interact with the Ollama API.
MIT License
367 stars 47 forks source link

Use `url` create for holding url to ollama #44

Closed SpeedCrash100 closed 2 months ago

SpeedCrash100 commented 2 months ago

Brief

Reasoning

The ollama can be mounted anywhere using reverse proxy. ex: http://example.com/path/to/ollama. This does not allow user to set such a path. It also allows users accidentally set 'http://localhost/' with leading slash, resulting in bad url 'http://localhost/:11434'. url will handle this and all you need to do is overwrite port with 'Url::set_port' or, better, remove port argument completely from Ollama::new and move into url string.