Ollama Client Initialization
The initialize_ollama_client step creates an ollama.Client instance and stores it in the experiment context.
Installation
Section titled “Installation”pip install --upgrade --pre crystallize-extras[ollama]from crystallize_extras.ollama_step import ( initialize_ollama_client, initialize_async_ollama_client,)
init_sync = initialize_ollama_client(host="http://localhost:11434")init_async = initialize_async_ollama_client(host="http://localhost:11434")
pipeline = Pipeline([ init_sync, call_ollama(),])- The step stores a
resource_factoryunderollama_client(override viacontext_key). Later steps can retrieve the client withclient = ctx.get("ollama_client")(ctx). - Use the async variant when your pipeline runs under
AsyncExecution. - If
ollamais missing, the step raises an ImportError suggesting the extras installation command.