> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/type-models.md).

# Type models (Pydantic)

The SDK returns Pydantic models throughout. Top-level exports — verified from `src/layerlens/__init__.py`:

## Models exported from `layerlens`

```python
from layerlens import (
 Judge,
 JudgeVersion,
 JudgeSnapshot,
 Trace,
 TraceEvaluation,
 TraceEvaluationStep,
 TraceEvaluationResult,
 TraceEvaluationStatus,
 TraceEvaluationSummary,
 TraceWithEvaluations,
 JudgeOptimizationRun,
 OptimizationBudget,
 OptimizationRunStatus,
 BenchmarkPrompt,
 BenchmarkPromptsResponse,
 PublicModelDetail,
 PublicBenchmarkDetail,
 PublicModelsListResponse,
 PublicBenchmarksListResponse,
 ComparisonResult,
 ComparisonResponse,
 Integration,
)
```

## Type by resource

| Resource                       | Returned types                                                                                                                               |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `client.judges.*`              | `Judge`, `JudgeVersion`, `JudgeSnapshot`, plus list responses with `.judges`, `.total_count`                                                 |
| `client.traces.*`              | `Trace`, plus `TracesResponse` with `.traces`, `.total_count`, `.count`                                                                      |
| `client.trace_evaluations.*`   | `TraceEvaluation`, `TraceEvaluationStep`, `TraceEvaluationResult`, `TraceEvaluationSummary`, `TraceEvaluationStatus`, `TraceWithEvaluations` |
| `client.judge_optimizations.*` | `JudgeOptimizationRun`, `OptimizationBudget`, `OptimizationRunStatus`                                                                        |
| `client.evaluations.*`         | `Evaluation` and result types (drawn from the SDK; check `result.accuracy`, `result.is_success`, `result.status`)                            |
| `client.benchmarks.*`          | `BenchmarkPrompt`, `BenchmarkPromptsResponse`                                                                                                |
| `client.public.models.*`       | `PublicModelDetail`, `PublicModelsListResponse`                                                                                              |
| `client.public.benchmarks.*`   | `PublicBenchmarkDetail`, `PublicBenchmarksListResponse`                                                                                      |
| `client.public.comparisons.*`  | `ComparisonResult`, `ComparisonResponse`                                                                                                     |
| `client.integrations.*`        | `Integration`                                                                                                                                |
| `client.results.*`             | Result types — fields depend on evaluation kind (see [Evaluations](/more-in-this-section-9/evaluations-1.md))                                |

## Common patterns

All Pydantic models support:

```python
result = client.evaluations.wait_for_completion(evaluation)
result.dict() # Python dict
result.json() # JSON string
result.accuracy # field access
result.is_success # boolean helper on Evaluation
```

For Pydantic v1 / v2 compatibility, the SDK includes a dual-compat shim (`layerlens._compat.pydantic`). Both `model_dump()` (v2) and `dict()` (v1) work.

## IDE support

The SDK ships with PEP 561 inline type annotations. Pylance, Pyright, mypy `--strict`, and PyCharm all introspect types correctly. See [Type stubs and IDE support](/13.1-sdk-and-apis/type-stubs.md).

## Type access for fields not in the top-level export

If a method returns a type not exported from the top-level package (e.g. internal response wrappers), import from `layerlens.models`:

```python
from layerlens.models import (
 JudgesResponse,
 TracesResponse,
 EvaluationsResponse,
)
```

## See also

* [Type stubs and IDE support](/13.1-sdk-and-apis/type-stubs.md)
* [Errors](/more-in-this-section-9/errors-1.md) — exception type hierarchy
* [Source: `stratix-python/src/layerlens/__init__.py`](https://github.com/layerlens/stratix-python/blob/main/src/layerlens/__init__.py)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layerlens.ai/more-in-this-section-9/type-models.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
