Savanty

Using Ollama Cloud instead of GPT-4o

Savanty defaults to GPT-4o, but any OpenAI-compatible endpoint works. Here is how to point the translation step at Ollama Cloud with OLLAMA_API_KEY.

Level: beginnerTime: 4 min

Savanty’s translation step is an LLM call orchestrated by DSPy, and DSPy speaks the OpenAI client protocol. That means the model provider is a configuration detail, not a hard dependency. The default is GPT-4o via OPENAI_API_KEY, but Ollama Cloud exposes an OpenAI-compatible v1 endpoint, so it drops in with a credential swap.

Set the credential

export OLLAMA_API_KEY=...        # Ollama Cloud key
# (OPENAI_API_KEY is no longer required)

Savanty detects the Ollama credential and routes its DSPy Predict calls to the Ollama-compatible endpoint. Everything downstream — generation, the suitability check, the repair signatures — is unchanged.

Run exactly as before

from savanty import solve_optimization_problem
result = solve_optimization_problem("Assign 5 tasks to 3 workers, balance the workload")
print(result.solution)

What does and does not change

The guarantee does not change. Clingo produces the answer set, and Clingo is provider-agnostic; a returned assign/2 assignment satisfies every integrity constraint no matter which model generated the encoding.

What can change is how often the self-repair loop fires. A smaller or weaker translation model may mis-formalize more often, costing extra repair iterations. The typed repair loop and the minimal unsatisfiable core still localize the problem the same way — you simply pay for more rounds. Choose a model strong enough that first-pass translation usually succeeds, and the loop stays a safety net rather than the main event.

Frequently asked questions

Does the correctness guarantee change with a different LLM?

No. Clingo provides the guarantee, and Clingo is the same regardless of which model wrote the encoding. A weaker translation model may need more repair iterations, but a returned answer set still satisfies every emitted constraint.

Can I use a local Ollama instance?

Any OpenAI-compatible endpoint works. The project documents Ollama Cloud via OLLAMA_API_KEY; other compatible endpoints follow the same OpenAI client configuration.

Related

Try Savanty on your own problem

Open source, MIT licensed. Install from PyPI and solve your first constraint problem.