Skill v1.0.1
currentAutomated scan100/100+2 new
version: "1.0.1" name: crestapps-core-ollama description: Skill for running local and self-hosted Ollama models in CrestApps.Core 2.0. Covers AddOllama and AddCoreAIOllama registration, connections with the Ollama client name and a required Endpoint, configured chat and embedding deployments that declare model capabilities through Features instead of the removed Purpose or Type, declaring toolCalling only for models that support tools, deployment slots resolved with ResolveSlotAsync, Docker and model pulling, unsupported image, speech and realtime clients, and upgrading from 1.x. Use it for local development, offline or air-gapped hosts, and privacy-sensitive workloads, or when troubleshooting missing endpoints, skipped deployments, tool calls that never happen, or slow local responses. license: Apache-2.0 metadata: author: CrestApps Team version: "1.0"
CrestApps.Core Ollama
The CrestApps.Core.AI.Ollama package uses OllamaApiClient (OllamaSharp) to talk to a local or self-hosted Ollama server. No API key is involved; data stays on your infrastructure.
Guidelines
- Use Ollama for local development, offline work, and privacy-sensitive scenarios.
- The connection's
Endpointis required. There is no built-in default; a connection without one fails when a client is created. - Capabilities are model-dependent. Declare
toolCallingonly for models that support tools (for examplellama3.1,llama3.2,qwen2.5,mistral), andimageInputonly for multimodal models such asllava. - Only chat and embeddings are supported. Image generation, speech-to-text, text-to-speech and realtime are not; put those on another provider and resolve them through their slots.
- Pull a model before configuring a deployment that names it.
Registration
using CrestApps.Core.AI.Ollama;builder.Services.AddCrestAppsCore(crestApps => crestApps.AddAISuite(ai => ai.AddOllama()));
Raw registration:
builder.Services.AddCoreAIServices().AddCoreAIOrchestration().AddCoreAIOllama();
It registers OllamaAIClientProvider, the ProviderAICompletionClient<OllamaClientMarker> completion client, a connection source, and a deployment provider for OllamaConstants.ClientName ("Ollama").
Configuration
{"CrestApps": {"AI": {"Connections": [{"Name": "local-ollama","ClientName": "Ollama","Endpoint": "http://localhost:11434"}],"Deployments": [{"ClientName": "Ollama","ConnectionName": "local-ollama","Name": "llama3.1","Features": [ "textGeneration", "toolCalling", "streaming" ]},{"ClientName": "Ollama","ConnectionName": "local-ollama","Name": "phi3","Features": [ "textGeneration", "streaming" ]},{"ClientName": "Ollama","ConnectionName": "local-ollama","Name": "nomic-embed-text","Features": [ "textEmbedding" ]}]}}}
Name(orModelName, which falls back toName) must match the pulled Ollama model tag.- A configured deployment with no
Featuresand no legacyPurpose/Typeis skipped with the warning "declares no model capabilities". - The connection shorthand
ChatDeploymentNamealways declarestextGeneration,toolCallingandstreaming. Use an explicitDeploymentsentry for a model that cannot call tools, otherwise the model receives tools it cannot use. UtilityDeploymentName(textGeneration,streaming) andEmbeddingDeploymentName(textEmbedding) work the same way.
Point the slot defaults at the local models:
using CrestApps.Core.AI.Models;builder.Services.Configure<DefaultAIDeploymentSettings>(settings =>{settings.DefaultChatDeploymentName = "llama3.1";settings.DefaultUtilityDeploymentName = "phi3";settings.DefaultEmbeddingDeploymentName = "nomic-embed-text";});
using CrestApps.Core.AI.Deployments;using CrestApps.Core.AI.Models;namespace MyApp.Services;public sealed class LocalModelSelector{private readonly IAIDeploymentManager _deploymentManager;public LocalModelSelector(IAIDeploymentManager deploymentManager){_deploymentManager = deploymentManager;}public ValueTask<AIDeployment> GetUtilityModelAsync(CancellationToken cancellationToken = default)=> _deploymentManager.ResolveSlotAsync(AIDeploymentSlotNames.Utility,clientName: "Ollama",cancellationToken: cancellationToken);}
The utility slot falls back to the chat slot, so background work (titles, extraction, query rewriting) runs on the chat model when no utility model is set.
Running Ollama
# CPUdocker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama# NVIDIA GPUdocker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollamadocker exec -it ollama ollama pull llama3.1docker exec -it ollama ollama pull nomic-embed-textcurl http://localhost:11434/api/tags
The CrestApps.Core repository's Aspire AppHost (src/Startup/CrestApps.Core.Aspire.AppHost) can start Ollama alongside the sample hosts.
Troubleshooting
- `Endpoint` errors when the first chat runs: the connection has no
Endpoint. Addhttp://localhost:11434or the server URL. - Deployment missing from pickers: no
Features, an unknownClientName, or the slot requires a capability the entry does not declare. - The model talks about calling a tool and stops: either the model does not support tools, or
toolCallingis not declared and tools were stripped. Pick a tool-capable model and declare it. - Model not found: pull the exact tag named by
ModelName. - Slow or timed-out responses: local throughput depends on hardware; use a GPU or a smaller model, and keep the utility slot on a small model.
Upgrading from 1.x
- Replace
"Purpose": "Chat"with"Features": [ "textGeneration", "streaming" ], addingtoolCallingonly for tool-capable models. LegacyPurpose,CapabilityandTypevalues still load, but the projection is narrow:ChatorUtilitybecomestextGenerationonly (not whenrealtimeis declared), andEmbedding,Image,Vision,SpeechToTextandTextToSpeechbecometextEmbedding,imageOutput,imageInput,speechToTextandtextToSpeech. A 1.x chat entry therefore loses tool calling and streaming untiltoolCallingandstreamingare declared. - Replace
ResolveOrDefaultAsync(AIDeploymentPurpose.X, ...)withResolveSlotAsync(AIDeploymentSlotNames.X, ...)and purpose lookups withGetAllBySlotAsync.