pepperoni21 / ollama-rs

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

How can the parameter "keep_alive": -1, be sent in a generate_embeddings request ? #57

Closed 0xSchellen closed 3 months ago

0xSchellen commented 4 months ago

It seems that there is no parameter to set "keep_alive": -1 in the Struct Generation Options.

The idea is to load the embedding model and keeping it in the memory.

pepperoni21 commented 4 months ago

Hey, you can do that:

let request = GenerationRequest::new(...).keep_alive(KeepAlive::Indefinitely);

Is that what you meant?

0xSchellen commented 4 months ago

Hi! Thanks for the response!

This works fine for the Completions API.

But i can´t use it in the generate_embeddings trait.

let response = ollama
    .generate_embeddings(model.to_string(), prompt, None)
    .await?;
pepperoni21 commented 3 months ago

Sorry for the delay, I'll fix that