You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 909259a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/index.md
+19-61Lines changed: 19 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,67 +14,25 @@ Pydantic is the most widely used data validation library for Python.
14
14
15
15
Fast and extensible, Pydantic plays nicely with your linters/IDE/brain. Define how data should be in pure, canonical Python 3.9+; validate it with Pydantic.
16
16
17
-
!!! logfire "Monitor Pydantic with Pydantic Logfire :fire:"
18
-
**[Pydantic Logfire](https://pydantic.dev/logfire)** is a production-grade observability platform for AI and general applications. See LLM interactions, agent behavior, API requests, and database queries in one unified trace. With SDKs for Python, JavaScript/TypeScript, and Rust, Logfire works with all OpenTelemetry-compatible languages.
19
-
20
-
Logfire integrates with many popular Python libraries including FastAPI, OpenAI and Pydantic itself, so you can use Logfire to monitor Pydantic validations and understand why some inputs fail validation:
21
-
22
-
```python {title="Monitoring Pydantic with Logfire" test="skip"}
23
-
from datetime import datetime
24
-
25
-
import logfire
26
-
27
-
from pydantic import BaseModel
28
-
29
-
logfire.configure()
30
-
logfire.instrument_pydantic() # (1)!
31
-
32
-
33
-
class Delivery(BaseModel):
34
-
timestamp: datetime
35
-
dimensions: tuple[int, int]
36
-
37
-
38
-
# this will record details of a successful validation to logfire
39
-
m = Delivery(timestamp='2020-01-02T03:04:05Z', dimensions=['10', '20'])
1. Set logfire record all both successful and failed validations, use `record='failure'` to only record failed validations, [learn more](https://logfire.pydantic.dev/docs/integrations/pydantic/).
49
-
2. This will raise a `ValidationError` since there are too few `dimensions`, details of the input data and validation errors will be recorded in Logfire.
50
-
51
-
Would give you a view like this in the Logfire platform:
0 commit comments