Skip to content

feat: add OllamaBuilder; deprecate host+port constructors - #336

Merged
pepperoni21 merged 1 commit into
pepperoni21:masterfrom
SarthakB11:feat/ollama-builder-136
Jun 3, 2026
Merged

pepperoni21 merged 1 commit into
pepperoni21:masterfrom
SarthakB11:feat/ollama-builder-136

Conversation

@SarthakB11

Copy link
Copy Markdown
Contributor

Fixes #136

Adds OllamaBuilder with .host(), .port(), .url(), .reqwest_client(), .request_headers() (under the headers feature) and .build(), plus an Ollama::builder() shortcut. Marks Ollama::new and Ollama::new_with_client as #[deprecated] since they were the awkward host + port pair called out in #135.

let ollama = Ollama::builder()
    .host("http://localhost")
    .port(11434)
    .build();

Defaults match Ollama::default() (http://127.0.0.1:11434, fresh reqwest::Client, empty header map). Left try_new, from_url, From<Url> and Default alone since they aren't redundant with the builder, but happy to deprecate those too if you'd prefer one path in.

The deprecation since is set to 0.3.5 as a guess at the next release; feel free to bump if it lands under a different version.

@pepperoni21
pepperoni21 merged commit d4830c1 into pepperoni21:master Jun 3, 2026
2 of 3 checks passed
@pepperoni21

Copy link
Copy Markdown
Owner

Hi, thanks for doing it! 0.3.5 is perfect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement builder pattern for Ollama constructor

2 participants