MCPcopy Create free account
hub / github.com/cocoindex-io/cocoindex-code / _check_model

Function _check_model

src/cocoindex_code/daemon.py:333–368  ·  view source on GitHub ↗

Test the embedding model by embedding a short string using *params*. *label* appears in the check's name (e.g. ``"indexing"`` / ``"query"``) so users see which side of the config the result corresponds to. Returns a failed result when the embedder is ``None`` (daemon running in no-sett

(
    embedder: Embedder | None,
    label: str,
    params: dict[str, Any],
)

Source from the content-addressed store, hash-verified

331
332
333async def _check_model(
334 embedder: Embedder | None,
335 label: str,
336 params: dict[str, Any],
337) -> DoctorCheckResult:
338 """Test the embedding model by embedding a short string using *params*.
339
340 *label* appears in the check's name (e.g. ``"indexing"`` / ``"query"``) so
341 users see which side of the config the result corresponds to. Returns a
342 failed result when the embedder is ``None`` (daemon running in no-settings
343 mode).
344 """
345 name = f"Model Check ({label})"
346 if embedder is None:
347 return DoctorCheckResult(
348 name=name,
349 ok=False,
350 details=[],
351 errors=["Daemon has no global settings loaded. Run `ccc init` to set up."],
352 )
353 result = await check_embedding(embedder, params)
354 params_detail = f"params: {params}" if params else "params: {} (no extra kwargs)"
355 if result.error is None:
356 return DoctorCheckResult(
357 name=name,
358 ok=True,
359 details=[params_detail, f"Embedding dimension: {result.dim}"],
360 errors=[],
361 )
362 return DoctorCheckResult(
363 name=name,
364 ok=False,
365 details=[params_detail],
366 errors=[result.error],
367 traceback=result.traceback,
368 )
369
370
371async def _check_file_walk(project_root_str: str) -> DoctorCheckResult:

Calls 2

DoctorCheckResultClass · 0.85
check_embeddingFunction · 0.85