solidworks_mcp.ui.routers.local_model¶
solidworks_mcp.ui.routers.local_model ¶
Local Ollama model probe / pull / query routes for the Prefab CAD dashboard.
Attributes¶
Classes¶
LocalAgentResult ¶
Bases: BaseModel, Generic[_T]
Typed envelope wrapping a structured pydantic-ai agent response.
data holds the validated result_type instance; config echoes back the
LocalLLMConfig used so callers can log or audit provenance. Set success=False
and error when the agent returned a RecoverableFailure or raised an exception.
Attributes:
| Name | Type | Description |
|---|---|---|
config |
LocalLLMConfig
|
The config value. |
data |
Any
|
The data value. |
error |
str | None
|
The error value. |
retry_hint |
str | None
|
The retry hint value. |
success |
bool
|
The success value. |
LocalModelProbeResult ¶
Bases: BaseModel
Full hardware-detection and Ollama availability result.
Returned by probe_local_model() and serialised as the JSON response from GET
/api/ui/local-model/probe. The to_config() helper converts directly into a
LocalLLMConfig ready for run_local_agent().
Attributes:
| Name | Type | Description |
|---|---|---|
all_tiers |
dict[str, str]
|
The all tiers value. |
available |
bool
|
The available value. |
endpoint |
str
|
The endpoint value. |
label |
str
|
The label value. |
ollama_model |
str
|
The ollama model value. |
openai_endpoint |
str
|
The openai endpoint value. |
pull_command |
str
|
The pull command value. |
pulled_models |
list[str]
|
The pulled models value. |
ram_gb |
float
|
The ram gb value. |
service_model |
str
|
The service model value. |
status_message |
str
|
The status message value. |
tier |
Literal['small', 'balanced', 'large']
|
The tier value. |
tier_already_pulled |
bool
|
The tier already pulled value. |
vram_gb |
float
|
The vram gb value. |
Functions¶
to_config ¶
Convert probe result into a ready-to-use LocalLLMConfig.
Returns:
| Name | Type | Description |
|---|---|---|
LocalLLMConfig |
LocalLLMConfig
|
The result produced by the operation. |
Source code in src/solidworks_mcp/ui/local_llm.py
LocalModelPullRequest ¶
Bases: BaseModel
Request body for POST /api/ui/local-model/pull.
Attributes:
| Name | Type | Description |
|---|---|---|
endpoint |
str | None
|
The endpoint value. |
model |
str
|
The model value. |
LocalModelPullResult ¶
Bases: BaseModel
Result from POST /api/ui/local-model/pull.
Attributes:
| Name | Type | Description |
|---|---|---|
error |
str | None
|
The error value. |
model |
str
|
The model value. |
queued |
bool
|
The queued value. |
response |
dict[str, Any] | None
|
The response value. |
LocalModelQueryRequest ¶
Bases: BaseModel
Request body for POST /api/ui/local-model/query.
Attributes:
| Name | Type | Description |
|---|---|---|
endpoint |
str | None
|
The endpoint value. |
model |
str | None
|
The model value. |
prompt |
str
|
The prompt value. |
system_prompt |
str
|
The system prompt value. |
Functions¶
probe_local_model_endpoint
async
¶
Probe for a running Ollama server and recommend the best Gemma model tier.
Source code in src/solidworks_mcp/ui/routers/local_model.py
pull_local_model_endpoint
async
¶
Trigger an Ollama pull for the specified model name.
Source code in src/solidworks_mcp/ui/routers/local_model.py
query_local_model_endpoint
async
¶
Run a free-form prompt against the local Ollama model.